summaryrefslogtreecommitdiff
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2022-12-02 15:39:20 -0800
committerclayjohn <claynjohn@gmail.com>2022-12-02 15:39:20 -0800
commitb2b89d7294ebb0824ce85b8bad59357caf5ec14f (patch)
tree2425bf04162163488441a0975837e0ab924229b5 /drivers/gles3/shaders
parentcdd99e9bec16db60efd894a06826f6fea139d00d (diff)
Properly remap roughness when reading from radiance map
This ensures that we consistently use perceptual roughness which matches the behaviour of most other PBR renderers like Blender, Ue4 and Godot 3
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r--drivers/gles3/shaders/scene.glsl2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 04dba602dd..75b28dbf2b 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1100,7 +1100,7 @@ void main() {
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;
+ specular_light = textureLod(radiance_map, ref_vec, sqrt(roughness) * RADIANCE_MAX_LOD).rgb;
specular_light = srgb_to_linear(specular_light);
specular_light *= horizon * horizon;
specular_light *= scene_data.ambient_light_color_energy.a;