fps: :
<script id='frag' type='x-shader/x-fragment'> #ifdef GL_ES precision highp float; #endif varying vec3 vnormal; varying vec3 vtan; varying vec3 vbitan; varying vec2 tc; varying vec4 color; uniform sampler2D diffuseTexture; uniform sampler2D specularTexture; uniform sampler2D normalsTexture; uniform vec3 lightPos; void main () { vec4 ntex = texture2D(normalsTexture,tc); float i = dot(normalize(lightPos), normalize(mat3(vnormal,vtan,vbitan)* ntex.xyz)); float t = 1.0; if (i < 0.25) t = 0.1; else if (i < 0.45) t = 0.4; else if (i < 0.5) t = 0.0; else if (i < 0.94) t = 0.6; else if (i < 0.95) t = 0.0; vec4 tex0 = texture2D(diffuseTexture,tc); vec4 stex = texture2D(specularTexture,tc); gl_FragColor = tex0; gl_FragColor.w = 1.0; } </script> <script id='vert' type='x-shader/x-vertex'> attribute vec4 vertex; attribute vec3 normal; attribute vec3 tangent; attribute vec3 bitangent; attribute vec2 uv0; /// todo: colors, more UV... attribute vec4 boneWeights; attribute vec4 boneIndices; uniform mat4 mvp; //uniform mat4 proj; uniform mat4 normalmatrix; // uniform vec4 bones[32*3]; uniform mat4 boneMatrices[32]; varying vec3 vnormal; varying vec3 vtan; varying vec3 vbitan; //varying vec3 vlight; varying vec2 tc; varying vec4 color; void main () { ivec4 ibi = ivec4(boneIndices * 256.0); // can we do ivec varyings in gles? vec4 pos = boneMatrices[ibi.x] * vertex * boneWeights.x + boneMatrices[ibi.y] * vertex * boneWeights.y + boneMatrices[ibi.z] * vertex * boneWeights.z + boneMatrices[ibi.w] * vertex * boneWeights.w ; gl_Position = mvp * pos; vnormal = normalize(normal); vtan = normalize(tangent); vbitan = normalize(bitangent); color = boneIndices / 255.0; tc = vec2(uv0.x,1.0-uv0.y); } </script>