aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/assets/notenoughupdates/shaders/negative.frag
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2020-12-31 01:26:26 +0800
committerBuildTools <james.jenour@protonmail.com>2020-12-31 01:26:26 +0800
commit9ae63509ab33c4d3f0ee19bc618ef4e4c654ef46 (patch)
treeb5d9120c9211ec989c05f0fb7d02d6497e49f8d0 /src/main/resources/assets/notenoughupdates/shaders/negative.frag
parent38bfc81ad013925463cd382bf99807d15b4fc53e (diff)
downloadNotEnoughUpdates-9ae63509ab33c4d3f0ee19bc618ef4e4c654ef46.tar.gz
NotEnoughUpdates-9ae63509ab33c4d3f0ee19bc618ef4e4c654ef46.tar.bz2
NotEnoughUpdates-9ae63509ab33c4d3f0ee19bc618ef4e4c654ef46.zip
1.8-PRE1
Diffstat (limited to 'src/main/resources/assets/notenoughupdates/shaders/negative.frag')
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/negative.frag33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main/resources/assets/notenoughupdates/shaders/negative.frag b/src/main/resources/assets/notenoughupdates/shaders/negative.frag
new file mode 100644
index 00000000..a601bd0c
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/negative.frag
@@ -0,0 +1,33 @@
+#version 130
+
+varying vec4 passColour;
+varying vec3 passNormal;
+uniform sampler2D textureIn;
+varying vec4 passPosition;
+uniform vec2 screensize;
+
+int a(float f) {
+ return int(round(f*1999));
+}
+
+void main() {
+ vec2 viewportCoord = gl_FragCoord.xy/screensize.xy;
+ vec4 texture = texture2D(textureIn, viewportCoord);
+
+ int offsetFactor = a(viewportCoord.x)^a(viewportCoord.y);
+ float dist = 1+mod(offsetFactor/4, 2);
+ float xOffset = dist*mod(offsetFactor-1, 2);
+ float yOffset = dist*mod(offsetFactor-2, 2);
+
+ texture = texture2D(textureIn, vec2(viewportCoord.x+xOffset/screensize.x, viewportCoord.y+yOffset/screensize.y));
+ texture = vec4(texture.rgb*texture.a, 1);
+ texture.rgb = 1 - texture.rgb;
+
+ gl_FragColor = texture * passColour;
+
+ vec3 fakeSunNormal = normalize(vec3(0.2f,1.0f,-0.2f));
+ vec3 normNormal = normalize(passNormal);
+ float shading = max(0.6f, dot(fakeSunNormal, normNormal));
+
+ gl_FragColor = vec4(gl_FragColor.rgb*shading, 1);
+} \ No newline at end of file