gradientmap_pars_fragment.glsl.js 427 B

1234567891011121314151617181920212223242526
  1. export default `
  2. #ifdef TOON
  3. uniform sampler2D gradientMap;
  4. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  5. // dotNL will be from -1.0 to 1.0
  6. float dotNL = dot( normal, lightDirection );
  7. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  8. #ifdef USE_GRADIENTMAP
  9. return texture2D( gradientMap, coord ).rgb;
  10. #else
  11. return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
  12. #endif
  13. }
  14. #endif
  15. `;