aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/assets/minecraft/shaders/program
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-03 14:42:49 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-03 14:42:49 +0700
commite5ef86b9b3fd0f5e687416acc667f368444e4459 (patch)
tree8aebde9eebf5e4fdc633f607b59dda84ad312969 /src/main/resources/assets/minecraft/shaders/program
parent28227742d7ec116cf616fde0689ffdc8062a9f68 (diff)
downloadOneConfig-e5ef86b9b3fd0f5e687416acc667f368444e4459.tar.gz
OneConfig-e5ef86b9b3fd0f5e687416acc667f368444e4459.tar.bz2
OneConfig-e5ef86b9b3fd0f5e687416acc667f368444e4459.zip
stolen blur
Diffstat (limited to 'src/main/resources/assets/minecraft/shaders/program')
-rw-r--r--src/main/resources/assets/minecraft/shaders/program/fade_in_blur.fsh33
-rw-r--r--src/main/resources/assets/minecraft/shaders/program/fade_in_blur.json21
2 files changed, 54 insertions, 0 deletions
diff --git a/src/main/resources/assets/minecraft/shaders/program/fade_in_blur.fsh b/src/main/resources/assets/minecraft/shaders/program/fade_in_blur.fsh
new file mode 100644
index 0000000..5539f39
--- /dev/null
+++ b/src/main/resources/assets/minecraft/shaders/program/fade_in_blur.fsh
@@ -0,0 +1,33 @@
+#version 120
+
+uniform sampler2D DiffuseSampler;
+
+varying vec2 texCoord;
+varying vec2 oneTexel;
+
+uniform vec2 InSize;
+
+uniform vec2 BlurDir;
+uniform float Radius;
+uniform float Progress;
+
+void main() {
+ vec4 blurred = vec4(0.0);
+ float totalStrength = 0.0;
+ float totalAlpha = 0.0;
+ float totalSamples = 0.0;
+ float progRadius = floor(Radius * Progress);
+ for(float r = -progRadius; r <= progRadius; r += 1.0) {
+ vec4 sample = texture2D(DiffuseSampler, texCoord + oneTexel * r * BlurDir);
+
+ // Accumulate average alpha
+ totalAlpha = totalAlpha + sample.a;
+ totalSamples = totalSamples + 1.0;
+
+ // Accumulate smoothed blur
+ float strength = 1.0 - abs(r / progRadius);
+ totalStrength = totalStrength + strength;
+ blurred = blurred + sample;
+ }
+ gl_FragColor = vec4(blurred.rgb / (progRadius * 2.0 + 1.0), totalAlpha);
+}
diff --git a/src/main/resources/assets/minecraft/shaders/program/fade_in_blur.json b/src/main/resources/assets/minecraft/shaders/program/fade_in_blur.json
new file mode 100644
index 0000000..3d09d02
--- /dev/null
+++ b/src/main/resources/assets/minecraft/shaders/program/fade_in_blur.json
@@ -0,0 +1,21 @@
+{
+ "blend": {
+ "func": "add",
+ "srcrgb": "one",
+ "dstrgb": "zero"
+ },
+ "vertex": "sobel",
+ "fragment": "fade_in_blur",
+ "attributes": [ "Position" ],
+ "samplers": [
+ { "name": "DiffuseSampler" }
+ ],
+ "uniforms": [
+ { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
+ { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
+ { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
+ { "name": "BlurDir", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
+ { "name": "Radius", "type": "float", "count": 1, "values": [ 5.0 ] },
+ { "name": "Progress", "type": "float", "count": 1, "values": [ 0.0 ] }
+ ]
+}