mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
18 lines
No EOL
485 B
GLSL
18 lines
No EOL
485 B
GLSL
#version 330
|
|
|
|
in float signed_dist_to_curve;
|
|
in float uv_stroke_width;
|
|
in float uv_anti_alias_width;
|
|
in vec4 color;
|
|
|
|
out vec4 frag_color;
|
|
|
|
void main() {
|
|
if (uv_stroke_width == 0) discard;
|
|
frag_color = color;
|
|
|
|
// sdf for the region around the curve we wish to color.
|
|
float signed_dist_to_region = abs(signed_dist_to_curve) - 0.5 * uv_stroke_width;
|
|
frag_color.a *= smoothstep(1.0, 0.0, signed_dist_to_region / uv_anti_alias_width);
|
|
frag_color.a += 0.2; // undo
|
|
} |