summaryrefslogtreecommitdiffstats
path: root/cwd/assets
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-12-05 00:26:50 +0100
committerLaG1924 <lag1924@gmail.com>2021-12-05 00:26:50 +0100
commit93a5385cb03482d09108edef1433a9f470bf1e4a (patch)
treeb2b3a92b847e2539b0ff5df13e54a030e524dedc /cwd/assets
parentAdded SSAO (diff)
downloadAltCraft-93a5385cb03482d09108edef1433a9f470bf1e4a.tar
AltCraft-93a5385cb03482d09108edef1433a9f470bf1e4a.tar.gz
AltCraft-93a5385cb03482d09108edef1433a9f470bf1e4a.tar.bz2
AltCraft-93a5385cb03482d09108edef1433a9f470bf1e4a.tar.lz
AltCraft-93a5385cb03482d09108edef1433a9f470bf1e4a.tar.xz
AltCraft-93a5385cb03482d09108edef1433a9f470bf1e4a.tar.zst
AltCraft-93a5385cb03482d09108edef1433a9f470bf1e4a.zip
Diffstat (limited to 'cwd/assets')
-rw-r--r--cwd/assets/altcraft/shaders/frag/blur.fs22
-rw-r--r--cwd/assets/altcraft/shaders/frag/light.fs3
2 files changed, 24 insertions, 1 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/blur.fs b/cwd/assets/altcraft/shaders/frag/blur.fs
new file mode 100644
index 0000000..b49032f
--- /dev/null
+++ b/cwd/assets/altcraft/shaders/frag/blur.fs
@@ -0,0 +1,22 @@
+#version 330 core
+
+out vec4 fragColor;
+
+in vec2 uv;
+
+uniform sampler2D blurInput;
+uniform int blurScale;
+
+void main() {
+ vec2 texelSize = 1.0f / vec2(textureSize(blurInput, 0));
+ vec4 result = vec4(0.0f);
+ for (int x = -blurScale; x < blurScale; x++)
+ {
+ for (int y = -blurScale; y < blurScale; y++)
+ {
+ vec2 offset = vec2(float(x), float(y)) * texelSize;
+ result += texture(blurInput, uv + offset);
+ }
+ }
+ fragColor = result / pow(blurScale, 3);
+}
diff --git a/cwd/assets/altcraft/shaders/frag/light.fs b/cwd/assets/altcraft/shaders/frag/light.fs
index fd7aa4e..8556770 100644
--- a/cwd/assets/altcraft/shaders/frag/light.fs
+++ b/cwd/assets/altcraft/shaders/frag/light.fs
@@ -41,10 +41,11 @@ void main() {
float skyLight = l.g;
float lightLevel = clamp(faceLight + skyLight * dayTime, 0.01f, 1.0f);
lightLevel = pow(lightLevel, 3);
+ lightLevel *= (1.0f - s.r);
lightLevel = clamp(lightLevel, 0.005f, 1.0f);
vec3 faceColor = mix(ac.rgb * lightLevel, vec3(1,1,1) * lightLevel, float(ac.rgb == vec3(0,0,0)));
- vec4 finalColor = vec4(c.rgb * faceColor * (1.0f - s.r), 1.0f);
+ vec4 finalColor = vec4(c.rgb * faceColor, 1.0f);
finalColor.rgb = pow(finalColor.rgb, vec3(1.0f / gamma));