Fix: EEVEE-Next: Raytrace: Wrong ray BSDF bias

The bias was cutting the wrong end of the distribution,
making the result noisier than it should and missing
rays in the center.

This also increases the bias a bit more to reduce
noise.
This commit is contained in:
Clément Foucault
2024-05-16 22:39:47 +02:00
parent 3f07c63925
commit 1558bc7cb4

View File

@@ -20,9 +20,6 @@ struct BsdfSample {
float pdf;
};
/* Could maybe become parameters. */
#define RAY_BIAS 0.05
bool is_singular_ray(float roughness)
{
return roughness < BSDF_ROUGHNESS_THRESHOLD;
@@ -33,7 +30,8 @@ BsdfSample ray_generate_direction(vec2 noise, ClosureUndetermined cl, vec3 V, fl
{
vec3 random_point_on_cylinder = sample_cylinder(noise);
/* Bias the rays so we never get really high energy rays almost parallel to the surface. */
random_point_on_cylinder.x = random_point_on_cylinder.x * (1.0 - RAY_BIAS) + RAY_BIAS;
const float rng_bias = 0.08;
random_point_on_cylinder.x = random_point_on_cylinder.x * (1.0 - rng_bias);
mat3 world_to_tangent = from_up_axis(cl.N);