EEVEE-Next: Shadow: Hide banding artifact at projection edges

This affect all local lights (non-sun light).

We hide the artifact caused by different tracing results from
two adjacent projection. This is visible as the shading point
switches projections.

We fix this by randomizing which shadow map projection (face)
to trace. We do that by using the point at half the ray instead
of the shading point to choose the projection. This gives
a soft enough look proportional to the light shape.
This also has the benefit of being stupidly simple.

Pull Request: https://projects.blender.org/blender/blender/pulls/119555
This commit is contained in:
Clément Foucault
2024-03-16 15:20:46 +01:00
committed by Clément Foucault
parent df854248df
commit 38b180f236

View File

@@ -365,7 +365,9 @@ ShadowRayPunctual shadow_ray_generate_punctual(LightData light,
vec3 local_ray_start = lP + projection_origin;
vec3 local_ray_end = local_ray_start + direction;
int face_id = shadow_punctual_face_index_get(local_ray_start);
/* Use an offset in the ray direction to jitter which face is traced.
* This helps hiding some harsh discontinuity. */
int face_id = shadow_punctual_face_index_get(local_ray_start + direction * 0.5);
/* Local Light Space > Face Local (View) Space. */
vec3 view_ray_start = shadow_punctual_local_position_to_face_local(face_id, local_ray_start);
vec3 view_ray_end = shadow_punctual_local_position_to_face_local(face_id, local_ray_end);