Smart-UV and UV-Welder Scripts

7/29/2006
Updated - Smart-UV 1.2 Released, requiring blender 2.42
http://members.cox.net/vexgames/smartuv12.zip
Changes:

  • Optimized checking for redundant angles. You might notice a huge speed boost in square/mechnical models. You’ll notice no difference in organic models, but thats really not what smart-uv is for…

7/29/2006
Updated - Smart-UV 1.1 released, requiring blender 2.42

SmartUV 1.1:
http://members.cox.net/vexgames/smartuv11.zip
Changes:

  • Uses the new mesh, so updates in realtime while you watch it
  • Cleaned up mouse handling and updates
  • Shows progress on individual islands, because the algorithm can take a very long time to run (Sorry)
  • You can now abort by clicking anytime!
  • It now is tweakable - you can edit the top of the script to change your preferred alignments / weights
  • Horizontal tiebreaking added - and vertical weights added for even more accurate results.

Old version smartuv 1.0: (works with blender 2.41)
http://members.cox.net/vexgames/smartuv.zip

Two scripts used while developing mesh UV maps for the game ThreadSpace: Hyperbol.
http://www.hyperbol.com

Both are designed to use when uv-mapping mostly mechanical models - things with angular edges, things with mirrored parts, spaceships, buildings, technical stuff. Not human faces, for example.

Smart-UV works as follows - it works hand-in-hand with “UV Unwrap” or other unwrappers. It tries to intellegently rotate islands in your UV map such that they always are in the same direction, with the longest lines horizontal, vertical being second choice.

Create some mesh you’d like Smart-UV’ed. Unwrap and select the parts however you want them unwrapped. In this example I use lscm on the parts. There are four parts that I want to use the same UV’s - two on each side of the model.
http://members.cox.net/vexgames/smartuv02.jpg
http://members.cox.net/vexgames/smartuv03.jpg
http://members.cox.net/vexgames/smartuv04.jpg
Now thats fine, but I want all four pieces to overlap perfectly. Two are on the back side of the model and are thus mirror images of the others. So I select them, mirror them and run smart-uv again. (I could have mirrored beforehand).

Before mirroring
http://members.cox.net/vexgames/smartuv05.jpg

After mirroring and rerunning smart-uv
http://members.cox.net/vexgames/smartuv06.jpg

And now I just select the parts and hold down the snap to grid button (ctrl?) and drag them on top of each other. Smart-UV pre-aligns the island’s centroids with the grid, so they will snap exactly on top of each other if they are exact copies of each other.
http://members.cox.net/vexgames/smartuv07.jpg

Also included in the zip is uv-welder, which will weld all uv’s within a given threshold.

Both scripts are psyco friendly, for speed.

Any comments on this? Or is nobody else out there doing mechanical modelling? :slight_smile:

Hi Vek

That looks very good, can’t try it right now but I will soon. I am doing building and other mech UVs, and have major headaches about how the UVs are deformed, and placed. Keep up the good work.

Ps
Is there a way to automate making seams at sharp edges or something like that? maybe that could be a good addition.

Cheers Smitje

hey, a nice one!
really good for game models…

Making seams at sharp edges is already all automated if you use, for example, some of the unwrappers already in existence
However, its an unsolvable problem.
For example, think of a cube. theres probably hundreds of ways to unwrap even just a cube with no distortion to the UVs, depending on where you put the seams. How is the computer supposed to choose between them? The only one good so far is the human.

This looks great! I’ve wanted a better way to unwrap UVs for mechanical, regular objects for some time.

While the standard way to fit the map on a texture any-which-way may be a “best use of materials” if you’re cutting out of an actual material like wood or cloth, it makes no sense for “regular” meshes and makes it worse for mapping photos and artwork. Who wants degrade the image by rotating it for the texture when its going to rotate and degrade again for the render? Not to mention, its more work.

I may finally make the effort to graduate to UV :slight_smile: Thanks!

For our game, all of our textures are hand-crafted, mechanical, often with regular shapes on them (air vents, grates, rows of lights, series of rivets). Using standard ‘random rotation’ uv-unwrap is an artist’s nightmare when trying to make straight lines out of everything… this is why the Smart-UV mapper exists :slight_smile:

Ah, Necessity, the mother of invention! Can’t wait to run it through the paces.

well i’ll just tune in to say great work/efford, can’t try it now but I definately will later - I mostly do mechanical modelling so its perfect for me :slight_smile:

i’ve tried them out, you should definitely try to get them into the cvs, so that they don’t get lost somewhere in this forum, since they are really great, just today i mapped a mechanical part and used both of your scripts with succes.:slight_smile:

How would I get them in CVS? Thought that wasnt possible except for a few selected scripts.

Here is a guideline, which the scripts must follow to be accepted:
http://mediawiki.blender.org/index.php/ScriptDev

If compliant you have to submit them to the patch tracker:
http://projects.blender.org/tracker/index.php?group_id=9&atid=127

And someone with CVS access commits them.

funnily, I do mechanical low poly all the time. And just recently started to run into the mirror -overlapping problem. I might give this a try.

Wow, this just saved me a lot of time. Thanks a million. It works seamlessly.

Good to hear it. I’m still refining it. I’m going to add some tweaks to the scoring to resolve some further ‘tie’ conditions, due to vertical lines lining up, in rare cases.

Good work! :smiley:
Nice to see some scripts like this for blender.

very nice… perhaps in the future you could have it auto align all the seperate parts. Dragging one on top of the other takes lots of time. Thanks for the cool script!

Looks interesting and worthwhile, please do consider submitting it, you might point cambo to it, it might be worthwhile to merge this functionality with the existing UV tools.

LetterRip

Updated - Smart-UV 1.1 released, requiring blender 2.42

SmartUV 1.1:
http://members.cox.net/vexgames/smartuv11.zip
Changes:

  • Uses the new mesh, so updates in realtime while you watch it
  • Cleaned up mouse handling and updates
  • Shows progress on individual islands, because the algorithm can take a very long time to run (Sorry)
  • You can now abort by clicking anytime!
  • It now is tweakable - you can edit the top of the script to change your preferred alignments / weights
  • Horizontal tiebreaking added - and vertical weights added for even more accurate results.

HINT: You’re really going to want psyco installed for this to run fast. Theres a lot of crunching involved :stuck_out_tongue:

Still todo:

  • smart island detection and lining up of islands that are identical, atop each other
  • Smart rotation of square islands such that they are all lined up identically.