Schlick_to_F0.js 500 B

123456789101112131415161718192021
  1. import { tslFn, vec3 } from '../../shadernode/ShaderNode.js';
  2. const Schlick_to_F0 = tslFn( ( { f, f90, dotVH } ) => {
  3. const x = dotVH.oneMinus().saturate();
  4. const x2 = x.mul( x );
  5. const x5 = x.mul( x2, x2 ).clamp( 0, .9999 );
  6. return f.sub( vec3( f90 ).mul( x5 ) ).div( x5.oneMinus() );
  7. } ).setLayout( {
  8. name: 'Schlick_to_F0',
  9. type: 'vec3',
  10. inputs: [
  11. { name: 'f', type: 'vec3' },
  12. { name: 'f90', type: 'float' },
  13. { name: 'dotVH', type: 'float' }
  14. ]
  15. } );
  16. export default Schlick_to_F0;