Evaluate specular reflections using specular dominant direction instead of assuming mirror reflections

This commit is contained in:
clayjohn 2022-06-29 23:36:18 -07:00
parent ce6c4ab86a
commit 93c82ab4b9
4 changed files with 38 additions and 23 deletions

View file

@ -1049,6 +1049,7 @@ void main() {
#else
vec3 ref_vec = reflect(-view, normal);
#endif
ref_vec = mix(ref_vec, normal, roughness * roughness);
float horizon = min(1.0 + dot(ref_vec, normal), 1.0);
ref_vec = scene_data.radiance_inverse_xform * ref_vec;
specular_light = textureLod(radiance_map, ref_vec, roughness * RADIANCE_MAX_LOD).rgb;