diff options
author | mightygoat <alpha5and5official@gmail.com> | 2023-04-07 17:44:40 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-07 17:44:40 +0200 |
commit | 66633d19a1092e883b82edba071d7af22e333817 (patch) | |
tree | 4664bb63aab1662c6283974cee6f57a56787ab84 /servers | |
parent | 675547845ed26c2b74f029b64f38d585c3934f1f (diff) |
Fix the limit for interpolation of R0 with respect to metallic and SSR
Shlick term
(cherry picked from commit 2c000cb72fc04fd76c5d3b6bc53955f83bf50c71)
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl b/servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl index 631d1968b0..1626244b0a 100644 --- a/servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl +++ b/servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl @@ -263,9 +263,8 @@ void main() { // Schlick term. float metallic = texelFetch(source_metallic, ssC << 1, 0).w; - float f0 = mix(0.04, 1.0, metallic); // Assume a "specular" amount of 0.5 - normal.y = -normal.y; - float m = clamp(1.0 - dot(normalize(normal), -view_dir), 0.0, 1.0); + float f0 = mix(0.04, 0.37, metallic); // The default value of R0 is 0.04 and the maximum value is considered to be Germanium with R0 value of 0.37 + float m = clamp(1.0 - dot(normal, -view_dir), 0.0, 1.0); float m2 = m * m; m = m2 * m2 * m; // pow(m,5) final_color.a *= f0 + (1.0 - f0) * m; // Fresnel Schlick term. |