Skip to content

Commit

Permalink
Fix the limit for interpolation of R0 with respect to metallic and SSR
Browse files Browse the repository at this point in the history
Shlick term
  • Loading branch information
n0tank3sh committed Apr 6, 2023
1 parent 0291fcd commit 2c000cb
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2c000cb

Please sign in to comment.