mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Temporary band-aide for degenerate normal vector calculations
This solution is a bit too specific to the case of spheres.
This commit is contained in:
parent
dd51b696e5
commit
fbce0b132c
1 changed files with 8 additions and 2 deletions
|
@ -11,8 +11,14 @@ out vec4 v_color;
|
|||
#INSERT get_unit_normal.glsl
|
||||
#INSERT finalize_color.glsl
|
||||
|
||||
const float EPSILON = 1e-10;
|
||||
|
||||
void main(){
|
||||
emit_gl_Position(point);
|
||||
vec3 normal = cross(normalize(du_point - point), normalize(dv_point - point));
|
||||
v_color = finalize_color(rgba, point, normalize(normal));
|
||||
vec3 du = (du_point - point);
|
||||
vec3 dv = (dv_point - point);
|
||||
vec3 normal = cross(du, dv);
|
||||
float mag = length(normal);
|
||||
vec3 unit_normal = (mag < EPSILON) ? vec3(0, 0, sign(point.z)) : normal / mag;
|
||||
v_color = finalize_color(rgba, point, unit_normal);
|
||||
}
|
Loading…
Add table
Reference in a new issue