[Bf-blender-cvs] [4a83f3e2a57] blender2.8: Eevee: Disable specular when rendering probes.

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


Commit: 4a83f3e2a573fbaeee18898e3acb35e59c3965d5
Author: Clément Foucault
Date:   Wed Jun 14 10:35:28 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB4a83f3e2a573fbaeee18898e3acb35e59c3965d5

Eevee: Disable specular when rendering probes.

This prevents weird reflections and really strong indirect lighting.

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

M	source/blender/draw/engines/eevee/eevee_lightprobes.c
M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/draw/engines/eevee/eevee_private.h

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

diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 53cd49abf78..7776a9f938f 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -153,6 +153,7 @@ void EEVEE_lightprobes_init(EEVEE_SceneLayerData *sldata)
 
 	if (!sldata->probes) {
 		sldata->probes = MEM_callocN(sizeof(EEVEE_LightProbesInfo), "EEVEE_LightProbesInfo");
+		sldata->probes->specular_toggle = true;
 		sldata->probe_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_LightProbe) * MAX_PROBE, NULL);
 		sldata->grid_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_LightGrid) * MAX_GRID, NULL);
 	}
@@ -589,6 +590,9 @@ static void render_scene_to_probe(
 	/* Move to capture position */
 	negate_v3_v3(posmat[3], pos);
 
+	/* Disable specular lighting when rendering probes to avoid feedback loops (looks bad). */
+	sldata->probes->specular_toggle = false;
+
 	/* 1 - Render to each cubeface individually.
 	 * 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). */
@@ -644,6 +648,9 @@ static void render_scene_to_probe(
 	DRW_viewport_matrix_override_unset(DRW_MAT_VIEW);
 	DRW_viewport_matrix_override_unset(DRW_MAT_VIEWINV);
 	DRW_viewport_matrix_override_unset(DRW_MAT_WIN);
+
+	/* Restore */
+	sldata->probes->specular_toggle = true;
 }
 
 static void render_world_to_probe(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl)
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 40e6a89d209..6de9e7fef1d 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -298,6 +298,7 @@ static void add_standard_uniforms(DRWShadingGroup *shgrp, EEVEE_SceneLayerData *
 	DRW_shgroup_uniform_int(shgrp, "light_count", &sldata->lamps->num_light, 1);
 	DRW_shgroup_uniform_int(shgrp, "probe_count", &sldata->probes->num_render_cube, 1);
 	DRW_shgroup_uniform_int(shgrp, "grid_count", &sldata->probes->num_render_grid, 1);
+	DRW_shgroup_uniform_bool(shgrp, "specToggle", &sldata->probes->specular_toggle, 1);
 	DRW_shgroup_uniform_float(shgrp, "lodMax", &sldata->probes->lodmax, 1);
 	DRW_shgroup_uniform_texture(shgrp, "utilTex", e_data.util_tex);
 	DRW_shgroup_uniform_buffer(shgrp, "probeCubes", &sldata->probe_pool);
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index 77aa8d04278..564c9b85611 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -211,6 +211,7 @@ typedef struct EEVEE_LightProbesInfo {
 	float lodmax;
 	int shres;
 	int shnbr;
+	bool specular_toggle;
 	struct GPUTexture *backgroundtex;
 	/* List of probes in the scene. */
 	/* XXX This is fragile, can get out of sync quickly. */




More information about the Bf-blender-cvs mailing list