background.fs 344 B

1234567891011121314
  1. #version 430
  2. layout (binding = 0) uniform sampler2D depthSamp;
  3. in vec4 varShadowPosition;
  4. out vec4 color;
  5. void main(void) {
  6. vec3 pos = varShadowPosition.xyz / varShadowPosition.w;
  7. float shadow = float(texture(depthSamp, pos.xy).r + 0.000001 > pos.z);
  8. shadow = shadow * 0.6 + 0.4;
  9. color = vec4(0.8, 0.8, 0.8, 1.0) * shadow;
  10. }