EEVEE: Change cubemap roughness fit

This changes the roughness mapping to better utilize the mip chain resolution.
This improves glossy reflections with small roughness.

Lightcache version bumped because old data does not have the same roughness
mapping and cannot be used.
This commit is contained in:
2021-02-13 18:54:54 +01:00
parent e7f61685ed
commit aaf1650b09
3 changed files with 10 additions and 6 deletions

View File

@@ -167,7 +167,7 @@ vec3 probe_evaluate_cube(int pd_id, vec3 W, vec3 R, float roughness)
* http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
*/
float original_roughness = roughness;
float linear_roughness = sqrt(roughness);
float linear_roughness = fast_sqrt(roughness);
float distance_roughness = saturate(dist * linear_roughness / length(intersection));
linear_roughness = mix(distance_roughness, linear_roughness, linear_roughness);
roughness = linear_roughness * linear_roughness;
@@ -175,12 +175,14 @@ vec3 probe_evaluate_cube(int pd_id, vec3 W, vec3 R, float roughness)
float fac = saturate(original_roughness * 2.0 - 1.0);
R = mix(intersection, R, fac * fac);
return textureLod_cubemapArray(probeCubes, vec4(R, float(pd_id)), roughness * prbLodCubeMax).rgb;
float lod = linear_roughness * prbLodCubeMax;
return textureLod_cubemapArray(probeCubes, vec4(R, float(pd_id)), lod).rgb;
}
vec3 probe_evaluate_world_spec(vec3 R, float roughness)
{
return textureLod_cubemapArray(probeCubes, vec4(R, 0.0), roughness * prbLodCubeMax).rgb;
float lod = fast_sqrt(roughness) * prbLodCubeMax;
return textureLod_cubemapArray(probeCubes, vec4(R, 0.0), lod).rgb;
}
vec3 probe_evaluate_planar(int id, PlanarData pd, vec3 W, vec3 N, vec3 V, float roughness)