Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-04-19 19:05:25 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-04-20 19:29:33 +0300
commit9c274b0d5282e035f6cf1974f8bf7d0f351e31e3 (patch)
treeb87f7ae2eadafc195b044a4f1c45c1540d19b149
parent5f6c45498c92b91a710a1317f6d41f73fbe83477 (diff)
Eevee: Contact Shadows: Fix blue noise correlation.
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c2
-rw-r--r--source/blender/draw/engines/eevee/shaders/lamps_lib.glsl2
-rw-r--r--source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl4
3 files changed, 3 insertions, 5 deletions
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);
}