aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-10-19 01:58:51 +0000
committernathan <nathansmith@disroot.org>2025-10-19 01:58:51 +0000
commit7f77f57971263f5c3da73920652474e8413bf61f (patch)
treee239a0da0fe02701920ecdbc6f949dca0ce34a56
parent6b6b37dfed2ae3278c8d2322e48443410b26d87f (diff)
downloadFindThings-7f77f57971263f5c3da73920652474e8413bf61f.tar.gz
FindThings-7f77f57971263f5c3da73920652474e8413bf61f.tar.bz2
FindThings-7f77f57971263f5c3da73920652474e8413bf61f.zip
Edge shit
-rw-r--r--assets/shaders/glsl330/postprocessing.fs32
-rw-r--r--design.org3
2 files changed, 33 insertions, 2 deletions
diff --git a/assets/shaders/glsl330/postprocessing.fs b/assets/shaders/glsl330/postprocessing.fs
index a2dcb17..cdf23a2 100644
--- a/assets/shaders/glsl330/postprocessing.fs
+++ b/assets/shaders/glsl330/postprocessing.fs
@@ -8,6 +8,11 @@ uniform vec4 colDiffuse;
out vec4 finalColor;
+// Edge dection.
+uniform vec2 resolution = vec2(596, 447);
+float edgeFactor = 0.15;
+
+// Color depth.
float gamma = 0.6;
float numColors = 11.0;
@@ -16,11 +21,36 @@ void main()
// Texel color fetching from texture sampler
vec3 texelColor = texture(texture0, fragTexCoord.xy).rgb;
+ // Color depth
texelColor = pow(texelColor, vec3(gamma, gamma, gamma));
texelColor = texelColor*numColors;
texelColor = floor(texelColor);
texelColor = texelColor/numColors;
texelColor = pow(texelColor, vec3(1.0/gamma));
- finalColor = vec4(texelColor, 1.0);
+ // Edges.
+ float x = 1.0/resolution.x;
+ float y = 1.0/resolution.y;
+
+ vec4 horizEdge = vec4(0.0);
+ horizEdge -= texture(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
+ horizEdge -= texture(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0;
+ horizEdge -= texture(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
+ horizEdge += texture(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
+ horizEdge += texture(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0;
+ horizEdge += texture(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
+
+ vec4 vertEdge = vec4(0.0);
+ vertEdge -= texture(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
+ vertEdge -= texture(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0;
+ vertEdge -= texture(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
+ vertEdge += texture(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
+ vertEdge += texture(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0;
+ vertEdge += texture(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
+
+ vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb));
+ float edgeGray = (edge.r + edge.g + edge.b) / 3.0;
+ edge = vec3(edgeGray, 0.0, edgeGray);
+
+ finalColor = vec4(texelColor + (edge * edgeFactor), 1.0);
}
diff --git a/design.org b/design.org
index d2bcecc..e884d4e 100644
--- a/design.org
+++ b/design.org
@@ -74,7 +74,7 @@ said you will have your neck snapped no matter what you do.
19. Laptop running Haiku OS.
20. Nuclear Ninja Tortoise.
-* Rest of the items [2/42]
+* Rest of the items [2/43]
+ [X] Old mint.
+ [X] Sticky nickel.
+ [ ] Dollaridoo.
@@ -121,6 +121,7 @@ said you will have your neck snapped no matter what you do.
+ [ ] Blood covered hammer.
+ [ ] Duck tape. No, duck tape should not be used as a permanent fix!
+ [ ] Infrared goggles.
++ [ ] Night vision goggles.
* Design and programming
+ It will have a open world making heavy use of height maps.