Jump to content


Planar mapping script for Blender

scripting uv

1 reply to this topic

#1 TheNut

    Senior Member

  • Moderators
  • 1701 posts
  • LocationCyberspace

Posted 04 September 2012 - 09:49 PM

The Story
I am modelling some game content in Blender and the standard unwrapping modes were getting on my nerves. I am creating high polygonal models and baking their procedural materials to textures, which I then map to lower polygonal models. Blender's unwrapping algorithms often create difficult UV mapping coordinates, but in this particular case it was also creating discontinuities in UVs between the high and low polygonal models, so I was running into all sorts of display problems. Now this of course is not unexpected since there are fewer UVs to cover the curvature in a low polygon model, but Blender's complex UV unwrapping algorithms make it incredibly difficult to work with this problem. So instead I wrote a python script that will generate a nice, easy to use planar map for the currently selected object. Why Blender does not already support such an unwrapping mode is beyond me.

The Results
Posted Image

The detailed basketball is on the left. Grooves are imprinted on the ball and procedural textures added to give it the look and feel. This render demonstrates using the planar mapping script. Without it, the ball on the right would have smears and blind spots along the middle.

Posted Image
And here's a comparison of the UV wrapping algos. The left side shows the XY planar map created by the script and the right side shows the spherical UV map created by Blender. As you can see in the spherical map, there is discontinuity along top and bottom areas.

The Script
You can download the script here. I wasn't able to find out how to hook this into Blender's UV mapping menu to make the process seamless. You need to open the script using the text editor, select the object you want to UV planar wrap, and then run the script. As a side effect, this also makes the model game friendly if you export using OBJ or some such since UV coordinates are shared per vertex rather than per face, which is Blender's default UV method.
http://www.nutty.ca - Being a nut has its advantages.

#2 fireside

    Senior Member

  • Members
  • PipPipPipPip
  • 1590 posts

Posted 04 September 2012 - 10:53 PM

Pretty cool. I'll have to check it out when I get back into gaming. Summer is kind of hectic for me, which means I actually have to do a few things at my extremely relaxed pace rather than nothing at all in the winter. You may be able to submit it somewhere also or get a little help with the UI system they are using, or just get it listed so other people know about it.
Currently using Blender and Unity.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users