getRoughness.js 522 B

123456789101112131415161718
  1. import getGeometryRoughness from './getGeometryRoughness.js';
  2. import { tslFn } from '../../shadernode/ShaderNode.js';
  3. const getRoughness = tslFn( ( inputs ) => {
  4. const { roughness } = inputs;
  5. const geometryRoughness = getGeometryRoughness();
  6. let roughnessFactor = roughness.max( 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.
  7. roughnessFactor = roughnessFactor.add( geometryRoughness );
  8. roughnessFactor = roughnessFactor.min( 1.0 );
  9. return roughnessFactor;
  10. } );
  11. export default getRoughness;