[Bf-blender-cvs] [e45ebec335f] blender2.8: Probes: Add more parameters.
Clément Foucault
noreply at git.blender.org
Fri Jun 9 01:27:26 CEST 2017
Commit: e45ebec335f4b13835bce2c21aeb4ecd8726a02a
Author: Clément Foucault
Date: Thu Jun 8 23:10:28 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBe45ebec335f4b13835bce2c21aeb4ecd8726a02a
Probes: Add more parameters.
Add Min Max for box, and distance for sphere falloff.
Same for parallax.
Add clip distances.
===================================================================
M release/scripts/startup/bl_ui/properties_data_probe.py
M source/blender/blenkernel/intern/probe.c
M source/blender/draw/engines/eevee/eevee_probes.c
M source/blender/editors/object/object_add.c
M source/blender/makesdna/DNA_probe_types.h
M source/blender/makesrna/intern/rna_probe.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_probe.py b/release/scripts/startup/bl_ui/properties_data_probe.py
index e800c1ab9fa..4c407a9f06d 100644
--- a/release/scripts/startup/bl_ui/properties_data_probe.py
+++ b/release/scripts/startup/bl_ui/properties_data_probe.py
@@ -62,7 +62,11 @@ class DATA_PT_probe(DataButtonsPanel, Panel):
layout.prop(probe, "type", expand=True)
- layout.prop(probe, "distance")
+ layout.prop(probe, "influence_distance")
+ layout.prop(probe, "clip_start")
+ layout.prop(probe, "clip_end")
+ # layout.prop(probe, "influence_minimum")
+ # layout.prop(probe, "influence_maximum")
layout.prop(probe, "falloff")
diff --git a/source/blender/blenkernel/intern/probe.c b/source/blender/blenkernel/intern/probe.c
index 5c7ecedddd7..edceaab1013 100644
--- a/source/blender/blenkernel/intern/probe.c
+++ b/source/blender/blenkernel/intern/probe.c
@@ -44,8 +44,13 @@ void BKE_probe_init(Probe *probe)
{
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(probe, id));
- probe->dist = 5.0f;
+ copy_v3_fl(probe->mininf, -5.0f);
+ copy_v3_fl(probe->maxinf, 5.0f);
+ copy_v3_fl(probe->minpar, -5.0f);
+ copy_v3_fl(probe->maxpar, 5.0f);
probe->falloff = 0.25f;
+ probe->clipsta = 0.5f;
+ probe->clipend = 40.0f;
}
void *BKE_probe_add(Main *bmain, const char *name)
diff --git a/source/blender/draw/engines/eevee/eevee_probes.c b/source/blender/draw/engines/eevee/eevee_probes.c
index 48947e004b6..c7f7cece843 100644
--- a/source/blender/draw/engines/eevee/eevee_probes.c
+++ b/source/blender/draw/engines/eevee/eevee_probes.c
@@ -277,8 +277,8 @@ static void EEVEE_probes_updates(EEVEE_SceneLayerData *sldata)
Probe *probe = (Probe *)ob->data;
EEVEE_Probe *eprobe = &pinfo->probe_data[i];
- float dist_minus_falloff = probe->dist - (1.0f - probe->falloff) * probe->dist;
- eprobe->attenuation_bias = probe->dist / max_ff(1e-8f, dist_minus_falloff);
+ float dist_minus_falloff = probe->distinf - (1.0f - probe->falloff) * probe->distinf;
+ eprobe->attenuation_bias = probe->distinf / max_ff(1e-8f, dist_minus_falloff);
eprobe->attenuation_scale = 1.0f / max_ff(1e-8f, dist_minus_falloff);
}
}
@@ -408,16 +408,13 @@ static void render_one_probe(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl,
{
EEVEE_ProbesInfo *pinfo = sldata->probes;
EEVEE_Probe *eprobe = &pinfo->probe_data[probe_idx];
- Object *ob = NULL;
+ Object *ob = pinfo->probes_ref[probe_idx];
+ Probe *prb = (Probe *)ob->data;
float winmat[4][4], posmat[4][4];
- float near = 0.1f; /* TODO parameters */
- float far = 100.0f;
unit_m4(posmat);
- ob = pinfo->probes_ref[probe_idx];
-
/* Update transforms */
copy_v3_v3(eprobe->position, ob->obmat[3]);
@@ -428,7 +425,7 @@ static void render_one_probe(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl,
* We do this instead of using geometry shader because a) it's faster,
* b) it's easier than fixing the nodetree shaders (for view dependant effects). */
pinfo->layer = 0;
- perspective_m4(winmat, -near, near, -near, near, near, far);
+ perspective_m4(winmat, -prb->clipsta, prb->clipsta, -prb->clipsta, prb->clipsta, prb->clipsta, prb->clipend);
/* Detach to rebind the right cubeface. */
DRW_framebuffer_bind(sldata->probe_fb);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index f8f27f8785e..26a1f56bff9 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -154,9 +154,9 @@ static EnumPropertyItem field_type_items[] = {
/* copy from rna_probe.c */
static EnumPropertyItem probe_type_items[] = {
- {PROBE_CAPTURE, "CAPTURE", ICON_FORCE_FORCE, "Capture", ""},
- {PROBE_PLANAR, "PLANAR", ICON_FORCE_FORCE, "Planar", ""},
- {PROBE_CUSTOM, "CUSTOM", ICON_FORCE_FORCE, "Custom", ""},
+ {PROBE_CUBE, "CUBE", ICON_MESH_UVSPHERE, "Sphere", ""},
+ // {PROBE_PLANAR, "PLANAR", ICON_MESH_PLANE, "Planar", ""},
+ // {PROBE_IMAGE, "IMAGE", ICON_NONE, "Image", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesdna/DNA_probe_types.h b/source/blender/makesdna/DNA_probe_types.h
index 0ade10282f6..451acdca06e 100644
--- a/source/blender/makesdna/DNA_probe_types.h
+++ b/source/blender/makesdna/DNA_probe_types.h
@@ -48,19 +48,27 @@ typedef struct Probe {
char display; /* Probe visual appearance in the viewport */
char parallax; /* Parallax type */
- float dist; /* Influence radius or distance */
+ float distinf; /* Influence Radius */
+ float mininf[3]; /* Influence Bound Box */
+ float maxinf[3];
+
float falloff; /* Influence falloff */
- float pad;
- struct Object *parallax_ob; /* Object to use as a parallax volume */
+ float distpar; /* Parallax Radius */
+ float minpar[3]; /* Parallax Bound Box */
+ float maxpar[3];
+
+ float clipsta, clipend;
+
+ struct Object *parallax_ob; /* Object to use as a parallax origin */
struct Image *image; /* Image to use on as lighting data */
} Probe;
/* Probe->type */
enum {
- PROBE_CAPTURE = 0,
+ PROBE_CUBE = 0,
PROBE_PLANAR = 1,
- PROBE_CUSTOM = 2,
+ PROBE_IMAGE = 2,
};
/* Probe->display */
diff --git a/source/blender/makesrna/intern/rna_probe.c b/source/blender/makesrna/intern/rna_probe.c
index b8dced149ca..c8006787783 100644
--- a/source/blender/makesrna/intern/rna_probe.c
+++ b/source/blender/makesrna/intern/rna_probe.c
@@ -33,6 +33,8 @@
#include "DNA_probe_types.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
#include "MEM_guardedalloc.h"
@@ -46,9 +48,9 @@
#else
static EnumPropertyItem probe_type_items[] = {
- {PROBE_CAPTURE, "CAPTURE", ICON_NONE, "Capture", ""},
- {PROBE_PLANAR, "PLANAR", ICON_NONE, "Planar", ""},
- {PROBE_CUSTOM, "CUSTOM", ICON_NONE, "Custom", ""},
+ {PROBE_CUBE, "CUBE", ICON_NONE, "Cubemap", ""},
+ // {PROBE_PLANAR, "PLANAR", ICON_NONE, "Planar", ""},
+ // {PROBE_IMAGE, "IMAGE", ICON_NONE, "Image", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -64,18 +66,56 @@ static void rna_def_probe(BlenderRNA *brna)
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, probe_type_items);
RNA_def_property_ui_text(prop, "Type", "Type of probe");
- RNA_def_property_update(prop, 0, NULL); /* TODO */
-
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "dist");
- RNA_def_property_range(prop, 0.0f, 99999.0f);
- RNA_def_property_ui_text(prop, "Distance", "All surface within this distance will recieve the probe lighting");
- RNA_def_property_update(prop, 0, NULL); /* TODO */
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "clipsta");
+ RNA_def_property_range(prop, 0.0f, 999999.0f);
+ RNA_def_property_ui_text(prop, "Probe Clip Start",
+ "Probe clip start, below which objects will not appear in reflections");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "clipend");
+ RNA_def_property_range(prop, 0.0f, 999999.0f);
+ RNA_def_property_ui_text(prop, "Probe Clip End",
+ "Probe clip end, beyond which objects will not appear in reflections");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "influence_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "distinf");
+ RNA_def_property_ui_text(prop, "Influence Distance", "Influence distance of the probe");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "influence_minimum", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "mininf");
+ RNA_def_property_ui_text(prop, "Influence Min", "Lowest corner of the influence bounding box");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "influence_maximum", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "maxinf");
+ RNA_def_property_ui_text(prop, "Influence Max", "Highest corner of the influence bounding box");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe intensity decreases");
- RNA_def_property_update(prop, 0, NULL); /* TODO */
+ RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe influence decreases");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "parallax_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "distpar");
+ RNA_def_property_ui_text(prop, "Parallax Radius", "Lowest corner of the parallax bounding box");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "parallax_minimum", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "minpar");
+ RNA_def_property_ui_text(prop, "Parallax Min", "Lowest corner of the parallax bounding box");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "parallax_maximum", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "maxpar");
+ RNA_def_property_ui_text(prop, "Parallax Max", "Highest corner of the parallax bounding box");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
/* common */
rna_def_animdata_common(srna);
More information about the Bf-blender-cvs
mailing list