Calculate a tangent per loop, apply the transformation in multiple spaces and accumulate the result weighting by the loop-angle.
Note that previously only the tangents Z axis (normal)
was properly accumulated, the X and Y axes only contained the values
from a single loop (the last one written to), meaning only two edges
contributed to the result. Now the transformation from all loops are
taken into account.
Note
- In my own tests this resolves T95649 and gives more stable, less erratic results, although if geometry is deformed to flip faces ~180degrees in a small region - there is still the effect of "popping", which we can only do so much to resolve using this method of smoothing (as far as I can see).
- Using polygons normal instead of the cross product of the two edge-vectors might be worth investigating further. The polygon normals are more stable avoiding popping when the corner of a face becomes concave (which was flipping the tangents direction).
Some examples don't look so good though, so I'll keep that change out of the patch.