URL: http://glslsandbox.com/e#23880.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// Procedural Toon Shader Ramp Texture // By: Brandon Fogerty // bfogerty@gmail.com // xdpixel.com #ifdef GL_ES precision mediump float; #endif uniform vec2 resolution; #define StripeCount 5 #define StartColor vec3( 0.0, 0.0, 0.0 ) #define EndColor vec3( 1.0, 1.0, 1.0 ) void main( void ) { float widthOfEachStripe = resolution.x / float(StripeCount); float t = mod( floor( gl_FragCoord.x / widthOfEachStripe ), float(StripeCount) ); vec3 finalColor = mix( StartColor, EndColor, t / (float(StripeCount)-1.0) ); gl_FragColor = vec4( finalColor, 1.0 ); } |