[Bf-blender-cvs] [f67c331bedd] blender2.8: Eevee: Volumetrics: Avoid light leaking if last step is going trough geometry.

Clément Foucault noreply at git.blender.org
Thu Jul 6 00:28:19 CEST 2017


Commit: f67c331bedd5bfd0a70f3d9774cf71c8267f7081
Author: Clément Foucault
Date:   Thu Jul 6 00:27:42 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBf67c331bedd5bfd0a70f3d9774cf71c8267f7081

Eevee: Volumetrics: Avoid light leaking if last step is going trough geometry.

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

M	source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl

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

diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl
index 56fa126e490..a99769c7fec 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl
@@ -181,7 +181,7 @@ void main()
 	// float rand = (1.0 / 16.0) * float(((int(gl_FragCoord.x + gl_FragCoord.y) & 0x3) << 2) + (int(gl_FragCoord.x) & 0x3));
 	float dist = volume_start;
 	for (float i = 0.5; i < VOLUMETRIC_INTEGRATION_MAX_STEP && i < (volume_integration_steps - 0.1); ++i) {
-		float new_dist = find_next_step(rand, i);
+		float new_dist = max(max_z, find_next_step(rand, i));
 		float step = dist - new_dist; /* Marching step */
 		dist = new_dist;
 
@@ -227,7 +227,7 @@ void main()
 		/* Evaluate transmittance to view independantely */
 		transmittance *= Tr;
 
-		if (dist < max_z)
+		if (dist <= max_z)
 			break;
 	}




More information about the Bf-blender-cvs mailing list