mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 08:47:44 +00:00
Fix how stroke is scaled for perspective
This commit is contained in:
parent
ac4755459a
commit
a429a146c7
1 changed files with 2 additions and 1 deletions
|
|
@ -216,7 +216,8 @@ void main() {
|
||||||
for(int i = 0; i < 3; i++){
|
for(int i = 0; i < 3; i++){
|
||||||
float sf = perspective_scale_factor(controls[i].z, focal_distance);
|
float sf = perspective_scale_factor(controls[i].z, focal_distance);
|
||||||
if(bool(flat_stroke)){
|
if(bool(flat_stroke)){
|
||||||
sf *= abs(dot(v_global_unit_normal[i], vec3(0.0, 0.0, 1.0)));
|
vec3 to_cam = normalize(vec3(0.0, 0.0, focal_distance) - controls[i]);
|
||||||
|
sf *= abs(dot(v_global_unit_normal[i], to_cam));
|
||||||
}
|
}
|
||||||
scaled_strokes[i] = v_stroke_width[i] * sf;
|
scaled_strokes[i] = v_stroke_width[i] * sf;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue