Quick Tip: UVing Deformed Pipes in Modo
Today's quick-tip tutorial takes a look at how to utilise the amazing UV tools in Luxology's Modo 401 to tackle a common problem - unwrapping deformed cylinders. And yes, that may just be more common than you might think! Let's take a look…
I recently spent the best part of 3 days unwrapping 2 models : one an intricately detailed model of a pirate, completely with weaponry, clothing and obligatory eyepatch; the second a robot killing-machine with more guns than is probably practical in a battle situation. During the course of this 3-day coffee-fueled extravaganza, I realised that I was unwrapping one type of object more often than any other - a deformed cylinder. And whether it was the sleeve/trouser-leg of the pirate, or the barrel of an inexplicably twisty gun, the following technique proved extremely useful time-and-time-again.
Load up the object you want to unwrap. If you're a premium subscriber you can download the object shown here, although it's really not too complicated if you wanted to put something together yourself (essentially it's just a deformed cylinder with the ends bevelled in!) This object has been deformed by rotating, translating and scaling several of the edge loops, and as such we know straight away that we're likely not going to end up with a perfectly square/rectangular UV map. But we're going to do everything we can to unwrap it in the cleanest way possible.
As ever, the first step is to make sure we have a UV map ready. If your object doesn't have one, Modo will go in and create one for you automatically, however for organisational reasons I always prefer to start off with a correctly named map - in this case I've added the PipeUVs map by clicking the new map button at the bottom of the UV Map list.
The two tools we'll be taking a look at for the job (we'll be skipping the Atlas unwrap here as it would split this object up into many sections - something we definitely want to avoid) both require us to start with an edge selection, which does require a little thought. Where DO you want the seam to lie on your model? I always try to tuck it away as best as possible, so let's imagine that the selected edge will be hidden by what will no doubt be yet another massive pulse-rifle!
The go-to tool for any form of pipe is usually the UV Peeler, and, having saved me literally hours of work in the past, it's the first one I'll go to. However, as you can see, we have a problem. The sharp-edges and jagged sections of this unwrap will NOT result in the texture map being nicely displayed on the surface. Whilst this tool is fantastic at cylinders that have been deformed to a lesser extent, here it's not doing quite what we want.
Even increasing the Uniformity value doesn't fix everything - whilst it smooths out the edges horizontally, it also spreads the vertical edge loops out out uniformly as well which will end up warping our texture. I think it's time to undo the UV Peeler and move onto tool number 2.
With the same edge loop selected, this time I've activated the Unwrap Tool and clicked once in the UV view to generate our result. Whilst less uniform than the result from the UV Peeler, it definitely looks a little smoother, which can only be a good thing!
However after rotating the map you can see yet another small problem - even though the object is symetrical the UV map is not, which suggests that we'll get some texture warping when it comes to adding image maps to the model. So what can we do?
Here I've activated the UV Relax tool. This is something that I've only really been making use of for the past few months, but it can really save you a lot of time when you need to straighten out any rogue UV maps. Note that the Iterations value is currently set to 1, meaning that the UV map isn't really being relaxed much at all. I've also activated the Interactive check-box as we're now going to go in and start adding pins (or Constraints) to our UV map.
Zoom in to the left hand side of your UV map, and click once on both the top and bottom corners to add a blue constraint to that vertex in UV space. This constraint is going to allow us to manioulate the UV map in real-time. Go ahead and add a constraight to the right-hand corners as well.
Once you've added in the 4 constraints, click and drag to move them, organising them into a uniform rectangular shape on the grid. As you can see, the rest of the UV map doesn't follow. This is because we set our Iterations to 1 up in step 8 - the tool isn't really working yet, we've just been given control over our constrained points. I work this way (with the Iterations set to 1) because if we kept it at our final, higher value, the tool would have to re-calculate every time we moved a constraint, and on more complex objects this can really start to slow down your workflow!
It's now time to crank up the Iterations value. Typically I start at something around 1000, so add that in and hit enter on your keyboard. You'll see the rest of the UVs immediately jump into new positions, fitting the map around the 4 pins you've added in. If you now grab one of the pins and move it, you'll see the map layout update in real-time, always trying to stay within the constraints you've set.
Now it's just a case of going in and manipulating the constraints to try and achieve the cleanest layout you can. Here I've shrunk the space between the pins slightly to achieve a more uniform edge on the left side of the map. Whilst the top and bottom sides are still curved at this point (something that was always inevitable due to the way it was deformed), they are now much more symmetrical than they were earlier!
Whilst you can often get most, if not all of the way with just these 4 pins, occasionally you may need to go in and add more to further tweak the layout of your map. Here I've added an extra pin into the exact middle of the left hand side, and, after some very careful manipulation of all 3 of the pins shown, I've now achieved an even straighter edge.
Doing the same thing on the right hand side however proves much more tricky due to the way the cylinder was deformed. I've had to add in 2 pins instead of 1 here (note however that they're still evenly spaced) and even after a large amount of manipulation the right hand side of our map isn't totally straight. Sometimes, this technique can only get you so far and with UVs it's often a good idea not to manipulate individual vertices all that much, especially if you'll be using higher-res texture maps. In fact, if this was for production I'd most likely delete these 2 extra pins!
When you're done manipulating, hit Space to drop the tool and make sure to press the Fit UVs button to expand your map uniformly to fill the UV space.
And that's it! An easy way to unwrap shirt sleeves, gun barrels, pipes, robot arms, chimney stacks, vases, tree trunks...the list goes on! If you have any questions, just let me know, and have a great new year!