Fix EEVE-Next: Broken Parallax
Parallax distance was not actually use. It was affecting the world and had unwanted effect if lower than influence radius.
This commit is contained in:
@@ -293,7 +293,9 @@ void ReflectionProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle)
|
||||
}
|
||||
|
||||
bool use_custom_parallax = (light_probe.flag & LIGHTPROBE_FLAG_CUSTOM_PARALLAX) != 0;
|
||||
float parallax_distance = use_custom_parallax ? light_probe.distpar : light_probe.distinf;
|
||||
float parallax_distance = use_custom_parallax ?
|
||||
max_ff(light_probe.distpar, light_probe.distinf) :
|
||||
light_probe.distinf;
|
||||
float influence_distance = light_probe.distinf;
|
||||
float influence_falloff = light_probe.falloff;
|
||||
probe.influence_shape = (light_probe.attenuation_type == LIGHTPROBE_SHAPE_BOX) ? SHAPE_CUBOID :
|
||||
|
||||
@@ -222,9 +222,13 @@ LightProbeSample lightprobe_load(vec3 P, vec3 Ng, vec3 V)
|
||||
/* Return the best parallax corrected ray direction from the probe center. */
|
||||
vec3 lightprobe_sphere_parallax(ReflectionProbeData probe, vec3 P, vec3 L)
|
||||
{
|
||||
bool is_world = (probe.influence_scale == 0.0);
|
||||
if (is_world) {
|
||||
return L;
|
||||
}
|
||||
/* Correct reflection ray using parallax volume intersection. */
|
||||
vec3 lP = vec4(P, 1.0) * probe.world_to_probe_transposed;
|
||||
vec3 lL = L * mat3x3(probe.world_to_probe_transposed);
|
||||
vec3 lL = (mat3x3(probe.world_to_probe_transposed) * L) / probe.parallax_distance;
|
||||
|
||||
float dist = (probe.parallax_shape == SHAPE_ELIPSOID) ? line_unit_sphere_intersect_dist(lP, lL) :
|
||||
line_unit_box_intersect_dist(lP, lL);
|
||||
|
||||
Reference in New Issue
Block a user