36 lines
825 B
GLSL
36 lines
825 B
GLSL
#version 450
|
|
|
|
layout(set = 3, binding = 0) uniform sampler2D camTexture;
|
|
|
|
#ifdef ENABLE_DEPTH_WRITE
|
|
layout(set = 2, binding = 1) uniform sampler2D depthMap;
|
|
#endif
|
|
|
|
layout(location = 0) in vec2 texCoords;
|
|
layout(location = 1) in float scale;
|
|
layout(location = 0) out vec4 fragColor;
|
|
|
|
layout(set = 1, binding = 0) uniform CameraData
|
|
{
|
|
mat4 viewProjection;
|
|
mat4 view;
|
|
mat4 projection;
|
|
vec4 camPos;
|
|
float near;
|
|
float far;
|
|
} cam;
|
|
|
|
void main()
|
|
{
|
|
vec2 rm = (texCoords - 0.5) * 2;
|
|
float intensity = rm.x * rm.x + rm.y * rm.y;
|
|
intensity = (intensity / 1.4) * scale / 2;
|
|
|
|
fragColor = texture(camTexture, texCoords);
|
|
fragColor.rgb = fragColor.rgb - intensity;
|
|
|
|
#ifdef ENABLE_DEPTH_WRITE
|
|
gl_FragDepth = (texture(depthMap, texCoords).r - cam.near) / (cam.far - cam.near);
|
|
#endif
|
|
}
|