#version 100 precision highp int; precision highp float; /* Cel shading fragment program for single-pass rendering */ uniform vec4 diffuse; uniform vec4 specular; uniform sampler2D diffuseMap; uniform sampler2D diffuseRamp; uniform sampler2D specularRamp; uniform sampler2D edgeRamp; varying vec2 uvIn; varying float diffuseIn; varying float specularIn; varying float edge; void main() { // Step functions from textures vec4 diffuseTex = texture2D(diffuseMap, uvIn); vec4 diffuseStep = texture2D(diffuseRamp, vec2(diffuseIn, 0.0)); vec4 specularStep = texture2D(specularRamp, vec2(specularIn, 0.0)); vec4 edgeStep = texture2D(edgeRamp, vec2(edge, 0.0)); gl_FragColor = diffuseTex * edgeStep.x * ((diffuse * diffuseStep.x) + (specular * specularStep.x)); }