mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
31 lines
668 B
Text
31 lines
668 B
Text
![]() |
#version 330
|
||
|
|
||
|
uniform vec3 light_source_position;
|
||
|
uniform float gloss;
|
||
|
uniform float shadow;
|
||
|
uniform float anti_alias_width;
|
||
|
|
||
|
in vec4 color;
|
||
|
in float radius;
|
||
|
in vec2 center;
|
||
|
in vec2 point;
|
||
|
|
||
|
out vec4 frag_color;
|
||
|
|
||
|
#INSERT add_light.glsl
|
||
|
|
||
|
void main() {
|
||
|
vec2 diff = point - center;
|
||
|
float dist = length(diff);
|
||
|
vec3 normal = vec3(diff / radius, sqrt(1 - (dist * dist) / (radius * radius)));
|
||
|
float signed_dist = dist - radius;
|
||
|
frag_color = add_light(
|
||
|
color,
|
||
|
vec3(point.xy, 0.0),
|
||
|
normal,
|
||
|
light_source_position,
|
||
|
gloss,
|
||
|
shadow
|
||
|
);
|
||
|
frag_color.a *= smoothstep(0.5, -0.5, signed_dist / anti_alias_width);
|
||
|
}
|