lights_physical_fragment.glsl.js 633 B

1234567891011121314151617181920
  1. export default /* glsl */`
  2. PhysicalMaterial material;
  3. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  4. material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );
  5. #ifdef REFLECTIVITY
  6. material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
  7. #else
  8. material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
  9. #endif
  10. #ifdef CLEARCOAT
  11. material.clearCoat = saturate( clearCoat ); // Burley clearcoat model
  12. material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );
  13. #endif
  14. `;