Closed eulertour closed 1 year ago
Looking at bit more, this change actually needs some more work to handle the miter around the joints, otherwise they can stretch into infinity. This is probably why it was done this way in the first place, but neither solution is ideal.
https://github.com/lume/three-meshline/assets/43117506/2076a869-6d64-4e41-8782-b150a3505508
@eulertour thanks for trying this out!
Shader Change
The old shaders don’t handle sharp curves well.
The problem is that the vertices that determine the sides of the line are always extruded by half of the line’s width, regardless of curvature.
This is an approximation that becomes worse and worse the more the line curves.
The exact length of the normal vector is
0.5 * w / dot(perp, miter)
, where miter is the unit vector with the same direction as the normal vector.And the result looks much more natural.