mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Only apply non-flat-stroke correction in non-zero joint angle vertices
This commit is contained in:
parent
9cd6a87ff8
commit
dd51b696e5
1 changed files with 7 additions and 5 deletions
|
@ -78,11 +78,13 @@ vec3 step_to_corner(vec3 point, vec3 tangent, vec3 unit_normal, float joint_angl
|
||||||
// lines up very closely with the direction to the camera, treated here
|
// lines up very closely with the direction to the camera, treated here
|
||||||
// as the unit normal. To avoid those, this smoothly transitions to a step
|
// as the unit normal. To avoid those, this smoothly transitions to a step
|
||||||
// direction perpendicular to the true curve normal.
|
// direction perpendicular to the true curve normal.
|
||||||
float alignment = abs(dot(normalize(tangent), unit_normal));
|
if(joint_angle != 0){
|
||||||
float alignment_threshold = 0.97; // This could maybe be chosen in a more principled way based on stroke width
|
float alignment = abs(dot(normalize(tangent), unit_normal));
|
||||||
if (alignment > alignment_threshold) {
|
float alignment_threshold = 0.97; // This could maybe be chosen in a more principled way based on stroke width
|
||||||
vec3 perp = normalize(cross(v_unit_normal[1], tangent));
|
if (alignment > alignment_threshold) {
|
||||||
step = mix(step, project(step, perp), smoothstep(alignment_threshold, 1.0, alignment));
|
vec3 perp = normalize(cross(v_unit_normal[1], tangent));
|
||||||
|
step = mix(step, project(step, perp), smoothstep(alignment_threshold, 1.0, alignment));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inside_curve || int(joint_type) == NO_JOINT) return step;
|
if (inside_curve || int(joint_type) == NO_JOINT) return step;
|
||||||
|
|
Loading…
Add table
Reference in a new issue