treesummaryrefslogcommitdiff
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/fbo_frag.glsl28
1 files changed, 24 insertions, 4 deletions
diff --git a/shaders/fbo_frag.glsl b/shaders/fbo_frag.glsl
index cf1fafa..f6f12cd 100644
--- a/shaders/fbo_frag.glsl
+++ b/shaders/fbo_frag.glsl
@@ -4,10 +4,30 @@ out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D screenTexture;
+uniform int applySSSSS;
+uniform int N;
void main()
-{
- FragColor = vec4(
- texture(screenTexture, TexCoords).rgb,
- 1.0);
+{
+ if (applySSSSS == 1) {
+ float x = 1.0/1600.0;
+ float y = 1.0/900.0;
+
+ float maxDist = N*N + N*N;
+
+ vec4 color = vec4(0, 0, 0, 1);
+ for (int i = -N; i <= N; i++) {
+ for (int j = -N; j <= N; j++) {
+ float dist = i*i + j*j;
+ vec4 newC = texture(screenTexture, TexCoords + vec2(i*x, j*y)) / (2*N*N);
+ float factor = 1 - (dist / maxDist);
+ factor = pow(factor, 2);
+ color += newC * factor;
+ }
+ }
+ FragColor = color;
+ }
+ else {
+ FragColor = texture(screenTexture, TexCoords);
+ }
}