[Bf-blender-cvs] [8e5609665fe] blender2.8: Probe: Add grid probe parameters.

Clément Foucault noreply at git.blender.org
Thu Jun 15 01:16:07 CEST 2017


Commit: 8e5609665fefb004ce2e759a49e063479cf01b3d
Author: Clément Foucault
Date:   Tue Jun 13 15:56:04 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB8e5609665fefb004ce2e759a49e063479cf01b3d

Probe: Add grid probe parameters.

===================================================================

M	release/scripts/startup/bl_ui/properties_data_lightprobe.py
M	source/blender/makesdna/DNA_lightprobe_types.h
M	source/blender/makesrna/intern/rna_lightprobe.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_lightprobe.py b/release/scripts/startup/bl_ui/properties_data_lightprobe.py
index 5c5f4c3365f..bb74bff2616 100644
--- a/release/scripts/startup/bl_ui/properties_data_lightprobe.py
+++ b/release/scripts/startup/bl_ui/properties_data_lightprobe.py
@@ -64,16 +64,23 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
 
         split = layout.split()
 
-        col = split.column(align=True)
-        col.label("Influence:")
-        col.prop(probe, "influence_type", text="")
-
-        if probe.influence_type == 'ELIPSOID':
-            col.prop(probe, "influence_distance", "Radius")
+        if probe.type == 'GRID':
+            col = split.column(align=True)
+            col.label("Resolution:")
+            col.prop(probe, "grid_resolution_x", text="X")
+            col.prop(probe, "grid_resolution_y", text="Y")
+            col.prop(probe, "grid_resolution_z", text="Z")
         else:
-            col.prop(probe, "influence_distance", "Size")
+            col = split.column(align=True)
+            col.label("Influence:")
+            col.prop(probe, "influence_type", text="")
 
-        col.prop(probe, "falloff")
+            if probe.influence_type == 'ELIPSOID':
+                col.prop(probe, "influence_distance", "Radius")
+            else:
+                col.prop(probe, "influence_distance", "Size")
+
+            col.prop(probe, "falloff")
 
         col = split.column(align=True)
         col.label("Clipping:")
@@ -85,6 +92,11 @@ class DATA_PT_lightprobe_parallax(DataButtonsPanel, Panel):
     bl_label = "Parallax"
     COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'}
 
+    @classmethod
+    def poll(cls, context):
+        engine = context.scene.render.engine
+        return context.probe and context.probe.type == 'CUBEMAP' and (engine in cls.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
diff --git a/source/blender/makesdna/DNA_lightprobe_types.h b/source/blender/makesdna/DNA_lightprobe_types.h
index 559b02f5497..b66ea443570 100644
--- a/source/blender/makesdna/DNA_lightprobe_types.h
+++ b/source/blender/makesdna/DNA_lightprobe_types.h
@@ -54,6 +54,11 @@ typedef struct LightProbe {
 
 	float clipsta, clipend;
 
+	int grid_resolution_x;  /* Irradiance grid resolution */
+	int grid_resolution_y;
+	int grid_resolution_z;
+	int pad1;
+
 	struct Object *parallax_ob;    /* Object to use as a parallax origin */
 	struct Image *image;           /* Image to use on as lighting data */
 
@@ -67,6 +72,7 @@ enum {
 	LIGHTPROBE_TYPE_CUBE      = 0,
 	LIGHTPROBE_TYPE_PLANAR    = 1,
 	LIGHTPROBE_TYPE_IMAGE     = 2,
+	LIGHTPROBE_TYPE_GRID      = 3,
 };
 
 /* Probe->flag */
diff --git a/source/blender/makesrna/intern/rna_lightprobe.c b/source/blender/makesrna/intern/rna_lightprobe.c
index 6b9751f293a..fc1c05d8ad1 100644
--- a/source/blender/makesrna/intern/rna_lightprobe.c
+++ b/source/blender/makesrna/intern/rna_lightprobe.c
@@ -63,9 +63,10 @@ static EnumPropertyItem parallax_type_items[] = {
 };
 
 static EnumPropertyItem lightprobe_type_items[] = {
-	{LIGHTPROBE_TYPE_CUBE, "CUBEMAP", ICON_NONE, "Cubemap", ""},
+	{LIGHTPROBE_TYPE_CUBE, "CUBEMAP", ICON_NONE, "Cubemap", "Capture reflections"},
 	// {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_NONE, "Planar", ""},
 	// {LIGHTPROBE_TYPE_IMAGE, "IMAGE", ICON_NONE, "Image", ""},
+	{LIGHTPROBE_TYPE_GRID, "GRID", ICON_NONE, "Grid", "Volume used for precomputing indirect lighting"},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -145,6 +146,22 @@ static void rna_def_lightprobe(BlenderRNA *brna)
 	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);
 
+	/* irradiance grid */
+	prop = RNA_def_property(srna, "grid_resolution_x", PROP_INT, PROP_PIXEL);
+	RNA_def_property_range(prop, 1, 256);
+	RNA_def_property_ui_text(prop, "Resolution X", "Number of sample along the x axis of the volume");
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+	prop = RNA_def_property(srna, "grid_resolution_y", PROP_INT, PROP_PIXEL);
+	RNA_def_property_range(prop, 1, 256);
+	RNA_def_property_ui_text(prop, "Resolution Y", "Number of sample along the y axis of the volume");
+	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+	prop = RNA_def_property(srna, "grid_resolution_z", PROP_INT, PROP_PIXEL);
+	RNA_def_property_range(prop, 1, 256);
+	RNA_def_property_ui_text(prop, "Resolution Z", "Number of sample along the z axis of the volume");
+	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