EEVEE-Next: Use clamped linear spherical harmonic eval

This can produce ringing but it is usually not noticeable
since it is only present in indirect lighting.
This commit is contained in:
Clément Foucault
2023-06-30 13:12:21 +02:00
parent 0929b98cd3
commit 49e6eb5d94
3 changed files with 5 additions and 5 deletions

View File

@@ -23,6 +23,6 @@ void main()
vec3 N = normal_view_to_world(vN);
vec3 lN = transform_direction(world_to_grid, N);
vec3 irradiance = spherical_harmonics_evaluate_lambert_non_linear(lN, sh);
vec3 irradiance = spherical_harmonics_evaluate_lambert(lN, sh);
out_color = vec4(irradiance, 0.0);
}

View File

@@ -75,5 +75,5 @@ void lightprobe_eval(ClosureDiffuse diffuse,
{
SphericalHarmonicL1 irradiance = lightprobe_irradiance_sample(irradiance_atlas_tx, P);
out_diffuse += spherical_harmonics_evaluate_lambert_non_linear(diffuse.N, irradiance);
out_diffuse += spherical_harmonics_evaluate_lambert(diffuse.N, irradiance);
}

View File

@@ -237,20 +237,20 @@ void spherical_harmonics_L2_rotate(mat3x3 rotation, inout SphericalHarmonicBandL
vec3 spherical_harmonics_evaluate_lambert(vec3 N, SphericalHarmonicL0 sh)
{
vec3 radiance = spherical_harmonics_L0_evaluate(N, sh.L0).rgb;
return radiance;
return max(vec3(0.0), radiance);
}
vec3 spherical_harmonics_evaluate_lambert(vec3 N, SphericalHarmonicL1 sh)
{
vec3 radiance = spherical_harmonics_L0_evaluate(N, sh.L0).rgb +
spherical_harmonics_L1_evaluate(N, sh.L1).rgb * (2.0 / 3.0);
return radiance;
return max(vec3(0.0), radiance);
}
vec3 spherical_harmonics_evaluate_lambert(vec3 N, SphericalHarmonicL2 sh)
{
vec3 radiance = spherical_harmonics_L0_evaluate(N, sh.L0).rgb +
spherical_harmonics_L1_evaluate(N, sh.L1).rgb * (2.0 / 3.0) +
spherical_harmonics_L2_evaluate(N, sh.L2).rgb * (1.0 / 4.0);
return radiance;
return max(vec3(0.0), radiance);
}
/**