Eevee: Contact Shadows: Fix blue noise correlation.

This commit is contained in:
Clément Foucault 2018-04-19 18:05:25 +02:00
parent 5f6c45498c
commit 9c274b0d52
3 changed files with 3 additions and 5 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}