fireball/lib/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl

25 lines
407 B
Plaintext
Raw Normal View History

2018-12-25 13:59:22 +00:00
#ifdef TOON
uniform sampler2D gradientMap;
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
// dotNL will be from -1.0 to 1.0
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return texture2D( gradientMap, coord ).rgb;
#else
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
#endif
}
#endif