Skip to content

Commit

Permalink
Revert to disney fresnel
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Feb 13, 2024
1 parent 1aaaaa0 commit 8c8eedc
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/shader/common/fresnel.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,31 @@ export const fresnelGLSL = /* glsl */`
}
float evaluateFresnelWeight( float cosTheta, float eta, float f0 ) {
// TODO: disney fresnel was removed and replaced with this fresnel function to better align with
// the glTF but is causing blown out pixels. Should be revisited
// float evaluateFresnelWeight( float cosTheta, float eta, float f0 ) {
if ( totalInternalReflection( cosTheta, eta ) ) {
// if ( totalInternalReflection( cosTheta, eta ) ) {
return 1.0;
// return 1.0;
}
// }
return schlickFresnel( cosTheta, f0 );
// return schlickFresnel( cosTheta, f0 );
}
// }
// https://schuttejoe.github.io/post/disneybsdf/
float disneyFresnel( vec3 wo, vec3 wi, vec3 wh, float f0, float eta, float metalness ) {
float dotHV = dot( wo, wh );
float dotHL = dot( wi, wh );
if ( totalInternalReflection( dotHV, eta ) ) {
return 1.0;
}
float dotHL = dot( wi, wh );
float dielectricFresnel = dielectricFresnel( abs( dotHV ), eta );
float metallicFresnel = schlickFresnel( dotHL, f0 );
Expand Down

0 comments on commit 8c8eedc

Please sign in to comment.