2016-09-02 03:45:00 +00:00
|
|
|
|
2019-03-05 17:55:31 +00:00
|
|
|
layout(location=0) in vec2 TexCoord;
|
2018-06-12 21:52:33 +00:00
|
|
|
layout(location=0) out vec4 FragColor;
|
2016-09-02 03:45:00 +00:00
|
|
|
|
2018-06-13 13:53:56 +00:00
|
|
|
layout(binding=0) uniform sampler2D AODepthTexture;
|
2016-09-02 03:45:00 +00:00
|
|
|
|
2016-09-21 00:04:56 +00:00
|
|
|
#if defined(MULTISAMPLE)
|
2018-06-13 13:53:56 +00:00
|
|
|
layout(binding=1) uniform sampler2DMS SceneFogTexture;
|
2016-09-21 00:04:56 +00:00
|
|
|
#else
|
2018-06-13 13:53:56 +00:00
|
|
|
layout(binding=1) uniform sampler2D SceneFogTexture;
|
2016-09-21 00:04:56 +00:00
|
|
|
#endif
|
|
|
|
|
2016-09-02 03:45:00 +00:00
|
|
|
void main()
|
|
|
|
{
|
2016-09-21 00:04:56 +00:00
|
|
|
vec2 uv = Offset + TexCoord * Scale;
|
2016-10-09 04:17:48 +00:00
|
|
|
|
2016-09-21 00:04:56 +00:00
|
|
|
#if defined(MULTISAMPLE)
|
2016-10-05 05:57:27 +00:00
|
|
|
ivec2 texSize = textureSize(SceneFogTexture);
|
2016-09-21 00:04:56 +00:00
|
|
|
#else
|
2016-10-05 05:57:27 +00:00
|
|
|
ivec2 texSize = textureSize(SceneFogTexture, 0);
|
2016-09-21 00:04:56 +00:00
|
|
|
#endif
|
2016-10-09 04:17:48 +00:00
|
|
|
ivec2 ipos = ivec2(uv * vec2(texSize));
|
2016-09-21 00:04:56 +00:00
|
|
|
|
|
|
|
#if defined(MULTISAMPLE)
|
|
|
|
vec3 fogColor = vec3(0.0);
|
|
|
|
for (int i = 0; i < SampleCount; i++)
|
2016-10-05 05:57:27 +00:00
|
|
|
fogColor += texelFetch(SceneFogTexture, ipos, i).rgb;
|
2016-09-21 00:04:56 +00:00
|
|
|
fogColor /= float(SampleCount);
|
|
|
|
#else
|
2016-10-05 05:57:27 +00:00
|
|
|
vec3 fogColor = texelFetch(SceneFogTexture, ipos, 0).rgb;
|
2016-09-21 00:04:56 +00:00
|
|
|
#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);
|
2019-04-16 03:29:32 +00:00
|
|
|
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
|
|
|
}
|