Aaaaa988

depth_tex_f_with_simple_shadow.glsl

Dec 11th, 2020
452
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. precision mediump float;
  2.  
  3. uniform vec3 uLightPos;
  4. uniform float uxPixelOffset;
  5. uniform float uyPixelOffset;
  6. varying vec3 vPosition;
  7. varying vec4 vColor;
  8. varying vec3 vNormal;
  9.  
  10. void main() {
  11.     vec3 lightVec = uLightPos - vPosition;
  12.     lightVec = normalize(lightVec);
  13.     float specular = pow(max(dot(vNormal, lightVec), 0.0), 5.0);
  14.     float diffuse = max(dot(vNormal, lightVec), 0.1);
  15.     float ambient = 0.3;
  16.  
  17.     gl_FragColor = (vColor * (diffuse + ambient + specular));
  18. }                                                                      
  19.  
RAW Paste Data