2016-08-09 23:51:40 +02:00
|
|
|
// Exclusive to SSR for now
|
2016-06-21 13:29:27 +02:00
|
|
|
#version 450
|
|
|
|
|
2017-12-13 14:21:42 +01:00
|
|
|
#include "compiled.glsl"
|
|
|
|
#include "std/gbuffer.glsl"
|
2016-08-09 23:51:40 +02:00
|
|
|
|
2016-06-21 13:29:27 +02:00
|
|
|
uniform sampler2D tex;
|
2016-08-07 01:43:21 +02:00
|
|
|
uniform sampler2D gbuffer0; // Roughness
|
2016-06-21 13:29:27 +02:00
|
|
|
|
2017-03-11 01:50:47 +01:00
|
|
|
uniform vec2 dirInv;
|
2016-06-21 13:29:27 +02:00
|
|
|
|
|
|
|
in vec2 texCoord;
|
2016-10-12 17:52:27 +02:00
|
|
|
out vec4 fragColor;
|
2016-06-21 13:29:27 +02:00
|
|
|
|
|
|
|
void main() {
|
2016-08-29 09:56:34 +02:00
|
|
|
float roughness = unpackFloat(texture(gbuffer0, texCoord).b).y;
|
2016-09-08 14:08:31 +02:00
|
|
|
// if (roughness == 0.0) { // Always blur for now, non blured output can produce noise
|
2017-03-14 20:43:54 +01:00
|
|
|
// fragColor.rgb = texture(tex, texCoord).rgb;
|
2016-09-08 14:08:31 +02:00
|
|
|
// return;
|
|
|
|
// }
|
2016-10-17 00:02:51 +02:00
|
|
|
if (roughness >= 0.8) { // No reflections
|
2017-03-14 20:43:54 +01:00
|
|
|
fragColor.rgb = texture(tex, texCoord).rgb;
|
2016-10-17 00:02:51 +02:00
|
|
|
return;
|
|
|
|
}
|
2016-06-21 13:29:27 +02:00
|
|
|
|
2017-03-14 20:43:54 +01:00
|
|
|
fragColor.rgb = texture(tex, texCoord + dirInv * 2.5).rgb;
|
|
|
|
fragColor.rgb += texture(tex, texCoord + dirInv * 1.5).rgb;
|
|
|
|
fragColor.rgb += texture(tex, texCoord).rgb;
|
|
|
|
fragColor.rgb += texture(tex, texCoord - dirInv * 1.5).rgb;
|
|
|
|
fragColor.rgb += texture(tex, texCoord - dirInv * 2.5).rgb;
|
2017-03-11 01:50:47 +01:00
|
|
|
fragColor.rgb /= vec3(5.0);
|
2016-06-21 13:29:27 +02:00
|
|
|
}
|