ded

Dramatic EDitor
Index Commits Files Refs README LICENSE
commit a4f280878aae1f2c0f5648697390314d259aa082
parent 0a9c74525a5b9b2df2f90f7730e458a4e6094929
Author: rexim <reximkut@gmail.com>
Date:   Sat, 11 Feb 2023 00:00:39 +0700

Port aa to the epic shader

Diffstat:
Mshaders/simple_epic.frag | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/shaders/simple_epic.frag b/shaders/simple_epic.frag
@@ -13,7 +13,10 @@ vec3 hsl2rgb(vec3 c) {
 
 void main() {
     vec4 tc = texture(image, out_uv);
+    float d = tc.r;
+    float aaf = fwidth(d);
+    float alpha = smoothstep(0.5 - aaf, 0.5 + aaf, d);
     vec2 frag_uv = gl_FragCoord.xy / resolution;
     vec4 rainbow = vec4(hsl2rgb(vec3((time + frag_uv.x + frag_uv.y), 0.5, 0.5)), 1.0);
-    gl_FragColor = tc.x * rainbow;
+    gl_FragColor = vec4(rainbow.rgb, alpha);
 }