Page MenuHome

Workaround T81065: Merge UV's when applying modifiers
ClosedPublic

Authored by Campbell Barton (campbellbarton) on May 4 2022, 12:29 PM.

Details

Summary

Support merging UV's that share the same vertex and are very close when applying modifiers.

This is needed to prevent UV's becoming "detached" which can happen when applying the subdivision surface modifier.

This regression was caused by [0] which removed selection threshold for nearby coordinates.
While restoring the UV selection threshold could be done - some selection operations that walk around connected UV fans wouldn't behave in a deterministic way (such as select shortest path). There are also other cases where UV's may be compared without a threshold such as tangent calculation and exporters which have their own logic to handling UV's.

Also resolves T86896, T89903.

[0]: b88dd3b8e7b9c02ae08d4679bb427963c5d21250

Diff Detail

Repository
rB Blender
Branch
TEMP-UV-FIXUP (branched from master)
Build Status
Buildable 21958
Build 21958: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.May 4 2022, 12:29 PM
Campbell Barton (campbellbarton) created this revision.
Campbell Barton (campbellbarton) retitled this revision from Workaround T81065: Applying Subdivision/Multires Modifier De-merges UV's to Workaround T81065: Merge UV's when applying modifiers.
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Correct flag check & early exit for meshes with no mloop's

Just reading this patch out of curiosity, noticed a couple small things.

source/blender/blenkernel/intern/mesh_merge_customdata.cc
116

Usually parallel_for is better unless the lambda is quite expensive. I've noticed that "for each" has more noticeable overhead for every element.

117

Doesn't really matter, but I usually see this written a bit more simply

Campbell Barton (campbellbarton) marked 2 inline comments as done.May 5 2022, 3:25 AM
  • Increase ULP tolerance from 6 to 12 for merging vertices to account for inprecision in the bevel modifier, add comment noting the thresholds for subdivision surface and for bevel.
  • Add a note about the threshold used in older Blender versions.

Tested duplicate reports, those mentioning subdivision-surface are practically exact duplicates of this report.
T86896#1135635 mentions bevel but doesn't give any steps to redo. The file mentioned in a reply is resolved by this patch (F9908073), both scaled up 100x and down 100x.

As far as I can see the threshold in this patch is reasonable, they could always be increased if needed.

This revision is now accepted and ready to land.May 5 2022, 12:34 PM