From 12bc7ebf5b30917eaf282b2612da666ba2b35b4a Mon Sep 17 00:00:00 2001 From: Chris Carmichael Date: Wed, 6 Mar 2024 11:18:43 -0400 Subject: [PATCH] add back in antialiasing --- src/graph/nodes/ring/Ring.fs.glsl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/graph/nodes/ring/Ring.fs.glsl b/src/graph/nodes/ring/Ring.fs.glsl index 89100f6..7e82fda 100755 --- a/src/graph/nodes/ring/Ring.fs.glsl +++ b/src/graph/nodes/ring/Ring.fs.glsl @@ -19,10 +19,18 @@ void main() { float thickness = uOutline / 2.0; float innerRadius = 1.0 - thickness; float ring = opOnion(sdCircle(vFromCenter, innerRadius), thickness); + float antialias = fPixelLength * 1.5; if (ring > 0.0) { discard; } - fragColor = outputColor(vec4(fColor.rgb, 1.0)); + if (uRenderMode == MODE_HIGH_PASS_2) { + if (ring < -antialias) { + discard; + } + fragColor = outputColor(vec4(fColor.rgb, smoothstep(0.0, antialias, abs(ring)))); + } else { + fragColor = outputColor(vec4(fColor.rgb, 1.0)); + } }