F_Schlick.js 549 B

12345678910111213141516
  1. import { tslFn } from '../../shadernode/ShaderNode.js';
  2. const F_Schlick = tslFn( ( { f0, f90, dotVH } ) => {
  3. // Original approximation by Christophe Schlick '94
  4. // float fresnel = pow( 1.0 - dotVH, 5.0 );
  5. // Optimized variant (presented by Epic at SIGGRAPH '13)
  6. // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
  7. const fresnel = dotVH.mul( - 5.55473 ).sub( 6.98316 ).mul( dotVH ).exp2();
  8. return f0.mul( fresnel.oneMinus() ).add( f90.mul( fresnel ) );
  9. } ); // validated
  10. export default F_Schlick;