Fix: EEVEE: AO: Only clip occluders based on front sample

This is cheaper but avoid loosing the sample influence when
thickness is large.
This commit is contained in:
Clément Foucault 2024-06-18 17:27:11 +02:00
parent 3112799804
commit 90c1d5832e

View file

@ -156,16 +156,12 @@ HorizonScanResult horizon_scan_eval(vec3 vP,
const float bias = 2.0 * 2.4e-7; const float bias = 2.0 * 2.4e-7;
sample_depth += reversed ? -bias : bias; sample_depth += reversed ? -bias : bias;
vec3 vP_sample = drw_point_screen_to_view(vec3(sample_uv, sample_depth)); vec3 vP_sample_front = drw_point_screen_to_view(vec3(sample_uv, sample_depth));
vec3 vP_sample_back = vP_sample_front - vV * thickness_near;
float sample_distance; float sample_distance;
vec3 vL_front = normalize_and_get_length(vP_sample - vP, sample_distance); vec3 vL_front = normalize_and_get_length(vP_sample_front - vP, sample_distance);
if (sample_distance > search_distance) { vec3 vL_back = normalize(vP_sample_back - vP);
continue;
}
vec3 vL_back = normalize_and_get_length((vP_sample - vV * thickness_near) - vP,
sample_distance);
if (sample_distance > search_distance) { if (sample_distance > search_distance) {
continue; continue;
} }