[Bf-blender-cvs] [9c274b0d528] blender2.8: Eevee: Contact Shadows: Fix blue noise correlation.

Clément Foucault noreply at git.blender.org
Fri Apr 20 18:30:18 CEST 2018


Commit: 9c274b0d5282e035f6cf1974f8bf7d0f351e31e3
Author: Clément Foucault
Date:   Thu Apr 19 18:05:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB9c274b0d5282e035f6cf1974f8bf7d0f351e31e3

Eevee: Contact Shadows: Fix blue noise correlation.

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

M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/draw/engines/eevee/shaders/lamps_lib.glsl
M	source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl

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

diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index e64b8c4282f..3749ab11007 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -449,7 +449,7 @@ static void eevee_init_util_texture(void)
 	/* Copy blue noise in 3rd layer  */
 	for (int i = 0; i < 64 * 64; i++) {
 		texels_layer[i][0] = blue_noise[i][0];
-		texels_layer[i][1] = blue_noise[i][1];
+		texels_layer[i][1] = blue_noise[i][2];
 		texels_layer[i][2] = cosf(blue_noise[i][1] * 2.0f * M_PI);
 		texels_layer[i][3] = sinf(blue_noise[i][1] * 2.0f * M_PI);
 	}
diff --git a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl
index 1c7956bb807..ae7cae9c4bb 100644
--- a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl
@@ -204,7 +204,6 @@ float light_visibility(LightData ld, vec3 W,
 			make_orthonormal_basis(L.xyz / L.w, T, B);
 
 			vec4 rand = texelfetch_noise_tex(gl_FragCoord.xy);
-			/* WATCH THIS : This still seems to have correlation artifacts for low samples. */
 			rand.zw *= fast_sqrt(rand.y) * data.sh_contact_spread;
 
 			/* We use the full l_vector.xyz so that the spread is minimize
@@ -309,7 +308,6 @@ vec3 light_translucent(LightData ld, vec3 W, vec3 N, vec4 l_vector, float scale)
 		make_orthonormal_basis(L.xyz / L.w, T, B);
 
 		vec4 rand = texelfetch_noise_tex(gl_FragCoord.xy);
-		/* WATCH THIS : This still seems to have correlation artifacts for low samples. */
 		rand.zw *= fast_sqrt(rand.y) * data.sh_blur;
 
 		/* We use the full l_vector.xyz so that the spread is minimize
diff --git a/source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl b/source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl
index 13ffe02eb0d..2907f25782f 100644
--- a/source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl
@@ -8,11 +8,11 @@ out vec4 FragColor;
 
 void main(void)
 {
-	vec2 blue_noise = texelFetch(blueNoise, ivec2(gl_FragCoord.xy), 0).xy;
+	vec3 blue_noise = texelFetch(blueNoise, ivec2(gl_FragCoord.xy), 0).xyz;
 
 	float noise = fract(blue_noise.y + offsets.z);
 	FragColor.x = fract(blue_noise.x + offsets.x);
-	FragColor.y = fract(blue_noise.y + offsets.y);
+	FragColor.y = fract(blue_noise.z + offsets.y);
 	FragColor.z = cos(noise * M_2PI);
 	FragColor.w = sin(noise * M_2PI);
 }



More information about the Bf-blender-cvs mailing list