aomap_fragment.glsl.js 528 B

123456789101112131415161718
  1. export default /* glsl */`
  2. #ifdef USE_AOMAP
  3. // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
  4. float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
  5. reflectedLight.indirectDiffuse *= ambientOcclusion;
  6. #if defined( USE_ENVMAP ) && defined( STANDARD )
  7. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  8. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  9. #endif
  10. #endif
  11. `;