[Bf-blender-cvs] [922ebe960cc] temp-eeveelightcache: Eevee: LightCache: Add back visibility group.

Clément Foucault noreply at git.blender.org
Thu Jun 28 15:55:03 CEST 2018


Commit: 922ebe960cc4d53b0923c06ca597dc1a97dc08c9
Author: Clément Foucault
Date:   Mon Jun 25 18:16:36 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rB922ebe960cc4d53b0923c06ca597dc1a97dc08c9

Eevee: LightCache: Add back visibility group.

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

M	source/blender/draw/engines/eevee/eevee_lightcache.c
M	source/blender/draw/engines/eevee/eevee_render.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index ff6880fb786..f87257cd634 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -414,6 +414,7 @@ static void eevee_lightbake_cache_create(EEVEE_Data *vedata, EEVEE_LightBake *lb
 	EEVEE_StorageList *stl = vedata->stl;
 	EEVEE_FramebufferList *fbl = vedata->fbl;
 	EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
+	EEVEE_LightProbesInfo *pinfo = sldata->probes;
 	Scene *scene_eval = DEG_get_evaluated_scene(lbake->depsgraph);
 	/* Disable all effects BUT high bitdepth shadows. */
 	scene_eval->eevee.flag &= SCE_EEVEE_SHADOW_HIGH_BITDEPTH;
@@ -445,6 +446,12 @@ static void eevee_lightbake_cache_create(EEVEE_Data *vedata, EEVEE_LightBake *lb
 
 	EEVEE_lightbake_cache_init(sldata, vedata, lbake->rt_color, lbake->rt_depth);
 
+	if (lbake->probe) {
+		LightProbe *prb = *lbake->probe;
+		pinfo->vis_data.collection = prb->visibility_grp;
+		pinfo->vis_data.invert = prb->flag & LIGHTPROBE_FLAG_INVERT_GROUP;
+		pinfo->vis_data.cached = false;
+	}
 	DRW_render_object_iter(vedata, NULL, lbake->depsgraph, EEVEE_render_cache);
 
 	EEVEE_materials_cache_finish(vedata);
@@ -734,6 +741,7 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float
 
 	/* Render world irradiance and reflection first */
 	if (lcache->flag & LIGHTCACHE_UPDATE_WORLD) {
+		lbake->probe = NULL;
 		lightbake_do_sample(lbake, eevee_lightbake_render_world_sample);
 	}
 
diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c
index 11c88636118..7146bc5b379 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -140,8 +140,19 @@ void EEVEE_render_cache(
         struct RenderEngine *engine, struct Depsgraph *UNUSED(depsgraph))
 {
 	EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
+	EEVEE_LightProbesInfo *pinfo = sldata->probes;
 	bool cast_shadow = false;
 
+	if (pinfo->vis_data.collection) {
+		/* Used for rendering probe with visibility groups. */
+		bool ob_vis = BKE_collection_has_object_recursive(pinfo->vis_data.collection, ob);
+		ob_vis = (pinfo->vis_data.invert) ? !ob_vis : ob_vis;
+
+		if (!ob_vis) {
+			return;
+		}
+	}
+
 	if (engine) {
 		char info[42];
 		BLI_snprintf(info, sizeof(info), "Syncing %s", ob->id.name + 2);



More information about the Bf-blender-cvs mailing list