diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-13 10:12:00 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-13 10:12:00 +0100 |
commit | 83281e7a42d9ab9f5cc0687c8944da01c0318916 (patch) | |
tree | 3f00792f1e33da6f881539fa920f31c1c6742391 /servers/rendering/renderer_rd/shaders | |
parent | e01acc46e13b154fbc4426873541c3ca8e5e7487 (diff) | |
parent | a062798b76ae5134cd2c7e10b8c2632d335ea299 (diff) |
Merge pull request #69985 from clayjohn/mobile-rim
Ensure that rim lighting uses an exponent base greater than zero
Diffstat (limited to 'servers/rendering/renderer_rd/shaders')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl index ba31b9c6dd..b30b0c8169 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl @@ -134,7 +134,8 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, float atte #endif #if defined(LIGHT_RIM_USED) - float rim_light = pow(max(0.0, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0)); + // Epsilon min to prevent pow(0, 0) singularity which results in undefined behavior. + float rim_light = pow(max(1e-4, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0)); diffuse_light += rim_light * rim * mix(vec3(1.0), albedo, rim_tint) * light_color; #endif |