Fix T86448 EEVEE: SSRefraction Depth regression

Caused by recent change for contact shadow raytracing. rB4e236326c137
This commit is contained in:
Clément Foucault 2021-03-18 16:58:26 +01:00
parent 51c7ff9222
commit b1150fa1f5
Notes: blender-bot 2023-02-14 07:53:51 +01:00
Referenced by issue #86448, EEVEE SSR Refraction Depth regression
4 changed files with 7 additions and 4 deletions

View File

@ -141,7 +141,7 @@ void main()
data.is_hit = raytrace_planar(ray, params, planar_id, hit_sP);
}
else {
data.is_hit = raytrace(ray, params, true, hit_sP);
data.is_hit = raytrace(ray, params, true, false, hit_sP);
}
data.ray_pdf_inv = safe_rcp(pdf);

View File

@ -297,7 +297,7 @@ float light_contact_shadows(LightData ld, vec3 P, vec3 vP, vec3 vNg, float rand_
vec3 hit_position_unused;
if (raytrace(ray, params, false, hit_position_unused)) {
if (raytrace(ray, params, false, false, hit_position_unused)) {
return 0.0;
}
}

View File

@ -105,6 +105,7 @@ struct RayTraceParameters {
bool raytrace(Ray ray,
RayTraceParameters params,
const bool discard_backface,
const bool allow_self_intersection,
out vec3 hit_position)
{
/* Clip to near plane for perspective view where there is a singularity at the camera origin. */
@ -114,11 +115,13 @@ bool raytrace(Ray ray,
ScreenSpaceRay ssray = raytrace_screenspace_ray_create(ray, params.thickness);
/* Avoid no iteration. */
if (ssray.max_time < 1.1) {
if (!allow_self_intersection && ssray.max_time < 1.1) {
hit_position = ssray.origin.xyz + ssray.direction.xyz;
return false;
}
ssray.max_time = max(1.1, ssray.max_time);
float prev_delta = 0.0, prev_time = 0.0;
float depth_sample = get_depth_from_view_z(ray.origin.z);
float delta = depth_sample - ssray.origin.z;

View File

@ -53,7 +53,7 @@ vec4 screen_space_refraction(vec3 vP, vec3 N, vec3 V, float ior, float roughness
params.roughness = roughnessSquared;
vec3 hit_pos;
bool hit = raytrace(ray, params, false, hit_pos);
bool hit = raytrace(ray, params, false, true, hit_pos);
if (hit && (F_eta(ior, dot(H, V)) < 1.0)) {
hit_pos = get_view_space_from_depth(hit_pos.xy, hit_pos.z);