Shadow2D.glsl 611 B

1234567891011121314151617181920212223242526
  1. #include "Uniforms.glsl"
  2. #include "Samplers.glsl"
  3. #include "Transform.glsl"
  4. #include "ScreenPos.glsl"
  5. varying vec2 vScreenPos;
  6. #ifdef COMPILEPS
  7. uniform vec4 cShadowAmbient;
  8. #endif
  9. void VS()
  10. {
  11. mat4 modelMatrix = iModelMatrix;
  12. vec3 worldPos = GetWorldPos(modelMatrix);
  13. gl_Position = GetClipPos(worldPos);
  14. vScreenPos = GetScreenPosPreDiv(gl_Position);
  15. }
  16. void PS()
  17. {
  18. vec4 diffInput = texture2D(sDiffMap, vScreenPos);
  19. vec4 lightInput = texture2D(sEmissiveMap, vScreenPos);
  20. gl_FragColor.rgb = (diffInput.rgb * (lightInput.rgb + cShadowAmbient.rgb) * (lightInput.a + cShadowAmbient.a));
  21. }