UDIMs by axis

1 vote
Version: 
0.8
Date Updated: 
02/12/2023

This script will separate UV shells to different UDIMs by average normal of shell faces. Result - all shells with average normal closest to +Z is in one UDIM, everything facing -Z is in the other and so on.

Intended use is separating "less important" faces when unwrapping a mesh for lightmap. Like everything facing downwards, for example, since most of the time those surfaces won't be directly lit and won't receive any shadows.
Another use is preparing packing groups for UVPackmaster or similar software.

Additional Info: 

  1. if checked, will prevent operations on any UV channel except chosen one
  2. UV channel to check
  3. starting point for UDIM shift
  4. step for UDIM shift (use -1 to shift to the left side or other integer if you want to have gaps, 0 will do nothing)
  5. calculate axis from world
  6. calculate axis from target
  7. pick target
  8. BEGIN HERE, button that starts the whole process
  9. memo with requirements

NOTE:

  • !!! Calculation speed heavily depends on number of UV shells. You can have 400k tris separated in 4 shells and script will finish in couple seconds, but if each face is a shell you gonna have a bad time. Very rough estimation is 1k shells per second. Keep this in mind if system marks it as "not responding" after 10 seconds when processing objects with high amount of UV shells.

  • Undo is disabled while processing. Save your work first.

  • Object should be unwrapped and packed into 0-1 space. Script will do it's best, but it doesn't make much sense if all your shells are collapsed to single point and all over the place.
    It was made for architecture-type objects. Works best when faces are broken into shells at 90 degree angles. Again, no sense in trying to find closest normal if a cube is unwrapped into single shell.

  • Object should have Unwrap modifier at the top of the stack and be an EditablePoly or PolyMeshObject.

HOW TO USE:

Just drag-n-drop to viewport. Select an object with Unwrap and press "move UV shells"

VERSION CHANGE:

0.8
- added buttons for each axis to quickly select elements moved to UDIMs
- speed increase
v0.7   4608 elements   16 seconds
v0.8   4608 elements   11 seconds

0.7
- initial release

 

Get it for free or pay what you want if you find it useful.

AttachmentSize
chart.png9.91 KB
udims.png93.46 KB
target.png199.73 KB