1 #version 300 es 2 precision mediump float; 3 4 uniform mediump vec4 vMaterialSpecular; 5 uniform highp vec3 vLight0; 6 7 in lowp vec4 colorDiffuse; 8 in vec3 position; 9 in vec3 normal; 10 out vec4 outColor; 11 12 void main() 13 { 14 mediump vec3 halfVector = normalize(-vLight0 + position); 15 mediump float NdotH = max(dot(normalize(normal), halfVector), 0.0); 16 mediump float fPower = vMaterialSpecular.w; 17 mediump float specular = pow(NdotH, fPower); 18 19 lowp vec4 colorSpecular = vec4( vMaterialSpecular.xyz * specular, 1 ); 20 outColor = colorDiffuse + colorSpecular; 21 } 22