Page MenuHome

Curves: Make tangent computation more robust against duplicate points.
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on May 24 2022, 11:35 AM.

Details

Summary

Previously, when there were multiple curve points at the same or almost same position, the computed tangent was unpredictable.
Part of the issue was that normalize_and_get_length has a very low epsilon (it should probably use a relative epsilon instead of an absolute one for the case described there, but that's a separate topic).

Now, the handling of this case is more explicit, making it more predictable. In general, when there are duplicate points, it will just use tangents from neighboring points now.

Old:


New:

Obviously, there are still some shading artifacts when there are overlapping elements, but at least the tangents are more predictable now.

Diff Detail

Repository
rB Blender
Branch
improve-curve-tangent-robustness (branched from master)
Build Status
Buildable 22238
Build 22238: arc lint + arc unit

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.May 24 2022, 11:35 AM
Jacques Lucke (JacquesLucke) created this revision.

Though the problem isn't technically a "problem" we have to solve, this looks like a reasonable way to make the system friendlier.
I only wonder if it will feel weird when the points are close but not close enough to get the fallback, and making it "more wrong" gives better results. But overall I think it's still an improvement.
It would be good if the behavior was documented somewhere though, since it's not obvious. Maybe in the curve tangent node manual page for now.

The file in the patch should become a test file.

source/blender/blenkernel/intern/curve_poly.cc
91

I'd replace "close-by" with "previous" which is a bit more accurate IMO.

This revision is now accepted and ready to land.May 29 2022, 11:42 AM