shadowOnly.fragment.fx 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. precision highp float;
  2. // Constants
  3. uniform vec3 vEyePosition;
  4. uniform float alpha;
  5. uniform vec3 shadowColor;
  6. // Input
  7. varying vec3 vPositionW;
  8. #ifdef NORMAL
  9. varying vec3 vNormalW;
  10. #endif
  11. // Helper functions
  12. #include<helperFunctions>
  13. // Lights
  14. #include<__decl__lightFragment>[0..maxSimultaneousLights]
  15. #include<lightsFragmentFunctions>
  16. #include<shadowsFragmentFunctions>
  17. #include<clipPlaneFragmentDeclaration>
  18. // Fog
  19. #include<fogFragmentDeclaration>
  20. void main(void) {
  21. #include<clipPlaneFragment>
  22. vec3 viewDirectionW = normalize(vEyePosition - vPositionW);
  23. // Normal
  24. #ifdef NORMAL
  25. vec3 normalW = normalize(vNormalW);
  26. #else
  27. vec3 normalW = vec3(1.0, 1.0, 1.0);
  28. #endif
  29. // Lighting
  30. vec3 diffuseBase = vec3(0., 0., 0.);
  31. lightingInfo info;
  32. float shadow = 1.;
  33. float glossiness = 0.;
  34. #include<lightFragment>[0..1]
  35. // Composition
  36. vec4 color = vec4(shadowColor, (1.0 - clamp(shadow, 0., 1.)) * alpha);
  37. #include<fogFragment>
  38. gl_FragColor = color;
  39. }