3b1b-manim/manimlib/shaders/surface/vert.glsl
Grant Sanderson 045e1f6b8a Instead of tracking du and dv points on surface, track points off the surface in the normal direction
This means that surface shading will not necessarily work well for arbitrary transformations of the surface. But the existing solution was flimsy anyway, and caused annoying issues with singularity points.
2025-01-17 11:47:10 -06:00

19 lines
No EOL
362 B
GLSL

#version 330
in vec3 point;
in vec3 d_normal_point;
in vec4 rgba;
out vec4 v_color;
#INSERT emit_gl_Position.glsl
#INSERT get_unit_normal.glsl
#INSERT finalize_color.glsl
const float EPSILON = 1e-10;
void main(){
emit_gl_Position(point);
vec3 unit_normal = normalize(d_normal_point - point);
v_color = finalize_color(rgba, point, unit_normal);
}