gzdoom/wadsrc/static/shaders/pp/ssaocombine.fp

42 lines
1,020 B
Text
Raw Normal View History

2016-09-02 03:45:00 +00:00
layout(location=0) in vec2 TexCoord;
layout(location=0) out vec4 FragColor;
2016-09-02 03:45:00 +00:00
layout(binding=0) uniform sampler2D AODepthTexture;
2016-09-02 03:45:00 +00:00
#if defined(MULTISAMPLE)
layout(binding=1) uniform sampler2DMS SceneFogTexture;
#else
layout(binding=1) uniform sampler2D SceneFogTexture;
#endif
2016-09-02 03:45:00 +00:00
void main()
{
vec2 uv = Offset + TexCoord * Scale;
#if defined(MULTISAMPLE)
ivec2 texSize = textureSize(SceneFogTexture);
#else
ivec2 texSize = textureSize(SceneFogTexture, 0);
#endif
ivec2 ipos = ivec2(uv * vec2(texSize));
#if defined(MULTISAMPLE)
vec3 fogColor = texelFetch(SceneFogTexture, ipos, 0).rgb;
#else
vec3 fogColor = texelFetch(SceneFogTexture, ipos, 0).rgb;
#endif
2019-04-16 01:32:54 +00:00
vec4 ssao = texture(AODepthTexture, TexCoord);
float attenutation = ssao.x;
if (DebugMode == 0)
FragColor = vec4(fogColor, 1.0 - attenutation);
else if (DebugMode < 3)
FragColor = vec4(attenutation, attenutation, attenutation, 1.0);
else if (DebugMode == 3)
FragColor = vec4(ssao.yyy / 1000.0, 1.0);
2019-04-16 01:32:54 +00:00
else
FragColor = vec4(ssao.xyz, 1.0);
2016-09-02 03:45:00 +00:00
}