getRoughness.js 571 B

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