Selaa lähdekoodia

Port aa to the epic shader

rexim 2 vuotta sitten
vanhempi
commit
a4f280878a
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      shaders/simple_epic.frag

+ 4 - 1
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);
 }