[Bf-blender-cvs] [49099c90486] temp-eeveelightcache: Eevee: LightCache: Add cubemap only baking button.

Clément Foucault noreply at git.blender.org
Mon Jul 9 23:03:38 CEST 2018


Commit: 49099c904860c8a5b3105deac21c84cb235ff7b5
Author: Clément Foucault
Date:   Mon Jul 9 15:24:30 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rB49099c904860c8a5b3105deac21c84cb235ff7b5

Eevee: LightCache: Add cubemap only baking button.

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

M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/draw/engines/eevee/eevee_lightcache.c
M	source/blender/editors/render/render_shading.c

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

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index d973eeb8f1d..3d4993697af 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -718,6 +718,7 @@ class RENDER_PT_eevee_indirect_lighting(RenderButtonsPanel, Panel):
 
         col = layout.column()
         col.operator("scene.light_cache_bake", text="Bake Indirect Lighting", icon='RENDER_STILL')
+        col.operator("scene.light_cache_bake", text="Bake Cubemap Only", icon='LIGHTPROBE_CUBEMAP').subset = "CUBEMAPS"
         col.prop(props, "gi_auto_bake")
 
         col.prop(props, "gi_diffuse_bounces")
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index c7694b0cbba..d0dcf563ae7 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -112,6 +112,7 @@ typedef struct EEVEE_LightBake {
 	int irr_size[3];                 /* Size of the irradiance texture. */
 	int total_irr_samples;           /* Total for all grids */
 	int grid_sample;                 /* Nth sample of the current grid being rendered. */
+	int grid_sample_len;             /* Total number of samples for the current grid. */
 	int grid_curr;                   /* Nth grid in the cache being rendered. */
 	int bounce_curr, bounce_len;     /* The current light bounce being evaluated. */
 	float vis_range, vis_blur;       /* Sample Visibility compression and bluring. */
@@ -790,7 +791,7 @@ static void eevee_lightbake_render_grid_sample(void *ved, void *user_data)
 	/* If it is the last sample grid sample (and last bounce). */
 	if ((lbake->bounce_curr == lbake->bounce_len - 1) &&
 	    (lbake->grid_curr == lbake->grid_len - 1) &&
-	    (lbake->grid_sample == lbake->grid_sample - 1))
+	    (lbake->grid_sample == lbake->grid_sample_len - 1))
 	{
 		lcache->flag &= ~LIGHTCACHE_UPDATE_GRID;
 	}
@@ -994,11 +995,11 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float
 			     ++lbake->grid_curr, ++lbake->probe, ++lbake->grid)
 			{
 				LightProbe *prb = *lbake->probe;
-				const int grid_sample_count = prb->grid_resolution_x *
-				                              prb->grid_resolution_y *
-				                              prb->grid_resolution_z;
+				lbake->grid_sample_len = prb->grid_resolution_x *
+				                         prb->grid_resolution_y *
+				                         prb->grid_resolution_z;
 				for (lbake->grid_sample = 0;
-				     lbake->grid_sample < grid_sample_count;
+				     lbake->grid_sample < lbake->grid_sample_len;
 				     ++lbake->grid_sample)
 				{
 					lightbake_do_sample(lbake, eevee_lightbake_render_grid_sample);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index f1a138e2292..dc2250f5105 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -791,9 +791,10 @@ static int light_cache_bake_invoke(bContext *C, wmOperator *op, const wmEvent *U
 void SCENE_OT_light_cache_bake(wmOperatorType *ot)
 {
 	static const EnumPropertyItem light_cache_subset_items[] = {
-		{LIGHTCACHE_SUBSET_ALL, "ALL", 0, "All LightProbes", ""},
-		{LIGHTCACHE_SUBSET_DIRTY, "DIRTY", 0, "Dirty Only", ""},
-		{LIGHTCACHE_SUBSET_CUBE, "CUBEMAPS", 0, "Cubemaps Only", ""},
+		{LIGHTCACHE_SUBSET_ALL, "ALL", 0, "All LightProbes", "Bake both irradiance grids and reflection cubemaps"},
+		{LIGHTCACHE_SUBSET_DIRTY, "DIRTY", 0, "Dirty Only", "Only bake lightprobes that are marked as dirty"},
+		{LIGHTCACHE_SUBSET_CUBE, "CUBEMAPS", 0, "Cubemaps Only", "Try to only bake reflection cubemaps if irradiance "
+	                                                             "grids are up to date"},
 		{0, NULL, 0, NULL, NULL}
 	};



More information about the Bf-blender-cvs mailing list