// Cartoon shader I (class C)
// by guest(r)
// license: GNU-GPL

uniform sampler2D OGL2Texture;

void main()
{
 vec3 uy = texture2D(OGL2Texture, gl_TexCoord[1].xy).xyz; 
 vec3 lx = texture2D(OGL2Texture, gl_TexCoord[4].xy).xyz; 
 vec3 ct = texture2D(OGL2Texture, gl_TexCoord[0].xy).xyz; 
 vec3 rx = texture2D(OGL2Texture, gl_TexCoord[5].xy).xyz; 
 vec3 dy = texture2D(OGL2Texture, gl_TexCoord[2].xy).xyz; 

 vec3 dt = vec3(1.0,1.0,1.0);

 float d = dot(abs(rx-lx),dt) + dot(abs(uy-dy),dt); d/=dot(ct,dt) + 0.15;
 
 gl_FragColor.xyz = (1.1-pow(d,1.5))*ct;
}
