Skip to content

Commit cbb2e17

Browse files
authoredApr 7, 2023
Merge pull request #75368 from MightiestGoat/fix-limit-interpolation-R0
Fix the limit for interpolation of R0 with respect to metallic and the calculation of the cos theata in the Fresnel Shlick term in SSR
2 parents 08c1b55 + 2c000cb commit cbb2e17

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed
 

‎servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl

+2-3
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,8 @@ void main() {
263263

264264
// Schlick term.
265265
float metallic = texelFetch(source_metallic, ssC << 1, 0).w;
266-
float f0 = mix(0.04, 1.0, metallic); // Assume a "specular" amount of 0.5
267-
normal.y = -normal.y;
268-
float m = clamp(1.0 - dot(normalize(normal), -view_dir), 0.0, 1.0);
266+
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
267+
float m = clamp(1.0 - dot(normal, -view_dir), 0.0, 1.0);
269268
float m2 = m * m;
270269
m = m2 * m2 * m; // pow(m,5)
271270
final_color.a *= f0 + (1.0 - f0) * m; // Fresnel Schlick term.

0 commit comments

Comments
 (0)
Please sign in to comment.