1 Tutorials LightWave 3D Texturing for Dummies Part 2 Standard Projection Techniques vs the Painstaking Art of UV Mapping Qua Jan 26, 2011 2:04 am
Admin
Admin
by Leigh van der Byl |
Ummm....Just What on earth is UV Mapping?? If you are going to be a successful texturing artist, sooner or later you are going to have to figure out how best to project your images onto your models. Often, you can just use any of the normal projection methods, tweak them slightly, and have a lovely textured model. However, sometimes, these projections just don't work the way you want them to. Especially when you have to texture models with extremely irregular shapes. You can try as you might, but your textures just won't go on properly! And yet, everywhere you look in films and on other peoples work, they don't seem to be having any problem getting their texture to work... Then, you see a picture somewhere of a strange, flattened template of polys that an artists has used to texture their model with. You see the term "UVs" being used.... You think to yourself "I want my textures to work like that too!"....but how do they do that??! Let's investigate... "UVs" is a way of saying u,v texture coordinates (as opposed to the X, Y, and Z axis that you construct your meshes on), which are points which define 1-by-1 positions within an image. These obviously connect to points in your 3D model, to position an image texture onto it's surface. Kind of like virtual "thumb tacks", what they do is pin an exact spot on an image, that you wish to use to texture your model, to a specific point on an object's surface. Between these points, your software will stretch the image smoothly. This is what is referred to as UV mapping. However, as I said before, you don't always need to actually use the UVs to texture. So before we dive headfirst into the world of unwrapping and editing UVs, let's first explore what the standard projection techniques are all about, so that we are completely clear with the ins and outs of using them.... Before we go on, let me just make a note that the focus of this tutorial is on the placement of image maps that are used for texturing, and not procedurals. This is because due to the fact that procedurals are mathematically calculated, they do not need projection settings. There are a few exceptions to this (such as Wood, and Cyclone), but generally they will place themselves onto your objects, and you do not need to fuss about UVs or projection techniques, unless you plan to bake your procedurals to a UV map, which I will discuss a bit later on. Now, back to the subject at hand... Well, once you have made your model, and are ready to texture it, the simplest way to apply your texture map is by using a standard planar, cylindrical, spherical or cubic projection. Here is a brief explanation of each of these, and how they are best used: Planar Projection Planar is a method whereby an image is projected straight through the object along either the x, y, or z axis. This method is especially useful for items such as sheets of paper, posters, book covers, etc - in other words, flat objects. The image below shows your options for planar projections. The Texture Axisdefines the axis along which the image will be projected. Planar projection options in the Surface Editor The problem with planar projections is that if the texture is projected along an uneven surface, or if the image reaches a side that curves away from the projection's plane, it results in unsightly lines such as inthe image below. Planar Projection in use - take note of the icky lines! When this happens, you then have to create lots of alpha-channel enabled images to cover up seams between adjacent planar projections and invariably ends up becoming a huge amount of annoying work. So never project a single image through an entire object if it has depth, like the box in the image, or if it has a very non-planar or irregular surface. Rather, as in the case of this box, create separate projections for the x and y axis as well, making sure that their edges will blend together properly. Alternatively, ensure the image to be used is tileable (seamless), and use a cubic projection (which I will discuss in a moment). LightWave® has an automatic sizing option that will stretch the image to fit the surface properly. Obviously, if your image is not the same shape as the surface onto which you are projecting it, this fit option will stretch it until it does. This usually doesn't look too fantastic, so ensure that you measure the size of your object before making your image map. Cylindrical Projection Cylindrical projection is pretty self-explanatory. Basically what happens is your image is wrapped in a cylindrical fashion around your model along one of it's axis. This is really useful for one kind of object only - cylindrical objects. Please don't try and use this for anything else, as it can cause a lot of stretching. . Cylindrical Projection options in the Surface Editor Above you can see the options for cylindrically projecting images onto your models. The Width Wrap amount determines the number of times that the image will be tiled around the width of the object. Cylindrically mapped cylinder. When making an image that will be used for cylindrical projection, ensure that it's sides will meet correctly - in other words, where the two sides of the image wrap around and come together, make sure that there is no visible seam, as in the example above. Tip A useful way of ensuring that the sides of an image will meet and merge properly is by using the Offset filter in Adobe Photoshop® (listed under Filters/Other/Offset), and offsetting the image by however many pixels you choose, and using the Wrap Around option. You can then use the Rubber Stamp (Clone) tool to blend the seams together. A cunning little trick! Spherical Projection Spherical projection is when the image is stretched from one pole to the other along the axis you choose, and then wrapped around the sides from the back meridian. Make sense? Basically what I mean, is that, say for instance, you do a spherical projection along the Y axis, then the image goes straight from the top point down to the bottom point, and wraps itself around so that the two sides of the image meet along a straight line down the side of the sphere - this line is known as a meridian. Below you can see the spherical projection options. The Width Wrap Amount sets the number of times that the image is tiled along the width (X-and-Z-axis) of the sphere. The Height Wrap Amount sets the number of times that the image tiles along the Y-axis of the sphere. You can also set the main axis along which the image should be projected. Spherical Mapping options in the Surface Editor Above is a sphere with the image wrapped only once around the width and the height, while the sphere below has the image wrapped 3 times around the width and the height. Images used for spherical maps must always be seamless. Once again, only ever use spherical projection for spheres, or objects that are mostly spherical in shape (like human heads). Use it on any other kind of shape, and, well, it's not going to look very nice. Also, be sure to use the Offset filter (described above) to check that your two end will meet properly along the meridian. Another useful way of checking whether a spherical map will work nicely is to use the Adobe Photoshop® Polar Coordinates filter (listed under Filters/Distort/Polar Coordinates) and use the Rectangular to Polar option. (However - ONLY USE THIS FILTER TO CHECK YOUR IMAGE. No NOT save your image that you want to use with this filter applied - it is not going to work!). This can give you an idea or whether there will be any seams when the image is wrapped around the sphere. This method is of course extremely popular for newbies to map their images onto the planets they make for those sci-fi scenes that just about everyone makes when they are starting out in 3D. Come on, admit it, you have all made sci-fi scenes, haven't you? Use the methods I've described here to ensure that your planet doesn't have any unsightly seams tearing across it's surface. Go on, make that planet you've always dreamed of! Cubic Projection Cubic projection just repeats a single image on each side of a box model it is applied to. Cubic mapping is basically a planar projection from 6 sides. Once again, ensure that the edges of the image will not form seams. Cubic projection is really only limited to perfectly square models, because if you try and use it on a rectangular shaped box, it will stretch the image on the long sides, and squash it on the shorter sides. Which looks pretty awful. Cubic Projection options in the Surface Editor. Note that there is no necessity to choose a projection axis. Above, cubic projection in action, on an even sided cube. Below, the nasty stretching that occurs when using cubic projection on rectangular objects. Front Projection The final projection option we have in LightWave® is the Front projection. What this projection basically does, is it screens the image over the entire object in such a way as it (the image) always faces the camera. The geometry of the object is not really taken into account - in other words, it's as if the image is placed like a screen over the camera. How could this be useful? Well, you can use it in a similar fashion to the Background Image option in compositing, although this method allows you to place the image onto planes so that the objects cast shadows onto the image. However, as this is an entire process in its itself, I will not be going into any more detail about it. You will find a whole section about it in Section 31.25 of the LightWave® manual. Okay, so we now understand all the standard projection techniques, right? Let's move on... So, back to the original question - why use UV mapping instead of these options? Well, as you have seen, these projection methods are very limited. It's pretty obvious that they are not going to suffice for extremely complex models. But here is something bizarre - these projection techniques are actually, technically speaking, more accurate than UV mapping. This is because texture images will be more accurately mapped using standard projections, which have exact, continuous values over the entire surface, whereas a UV map has accurate samples of the projection only at specific points (where the polygons join, basically), between which it then uses a linear interpolation on the surface between those points. For non-English speaking people, interpolation is, basically speaking, an estimation of values which go together to form a continuous series - this being a series of colour/tonal values being applied to your model, and the interpolation being the application of the parts of the image, which are not "tacked" down at those specific points, to the areas between them. The cool thing about this, however, is that once you have applied to UV coordinates to the model, pulling these points on your UV map around will pull the image with it. Pretty useful, hey? Basic UV Unwrapping Once your model is complete (and I cannot stress enough how important it is to only ever start texturing your model once it is completely finished. Never begin texturing until your modelling is 100% finished. This just makes the entire process run much smoother), you are ready to decide whether your model requires UV mapping or not. And seeing as this chapter is about UV mapping, I'm going to assume your model does need it. Before tackling the actual unwrapping process, something you need to consider is the poly count of your model. Some people prefer to unwrap the model once it is frozen, while others prefer to do it before freezing. Bearing in mind what I explained before about UVs pinning images to the points in the maps, it would make sense that the denser the mesh, the better the quality of the unwrap. While this is true, the problem with unwrapping models with exremely high polygon counts results in an absolute nightmare when it comes to editing the UVs (and you ALWAYS have to edit them, whether you like it or not). So I guess it's really up to you to decide how dense you want your mesh to be before unwrapping, depending not only on your computers ability to work easily with millions of points, but also your irritation threshold. Now, to the unwrapping process! Firstly, you need to decide what method of unwrapping you are going to use (unwrapping being the term most commonly used for the actual process whereby the X, Y and Z information is translated into the flat UV template). Yes, I know it can be so tiresome that everything has to have so many options, but it would all be pretty boring and not much fun at all if we didn't have all these different methods, now would it? Tip: When working with UVs, remember that the U-axis is the same as a 2D x-axis (it's the one that goes from left to right), while the V-axis is the same as a 2D Y-axis (the one that runs from top to bottom). Unwrapping UVs is done in Modeler. Start off by changing one of your viewports to display the UV template. To unwrap an object, go to the Map tab, and under the Texture heading, you will see the New UV Map button. Pressing this button will assign a new UV map to all the polygons you've currently selected, or to all polygons in the current layer if there are none selected. Note: Pressing the Make UVs button will add the new UVs you are assigning to any previously-made UV map that you have active in your UV viewport. You will now be presented with the following dialogue box: Enter a name for your UV map (this can be changed later by selecting the Rename Map option while the map is active). Choose your map type from the drop-down list, and if you wish to enter in your own initial settings for the placement and size of the map, simply uncheck the Initial Value option, and enter in your own values in the appropriate slots.Usually you can just leave these on default. Press OK. If you have set one of your viewports to display your UVs, the new map will now appear there. But wait a minute - what are the different map options??!! Before we proceed, let me introduce the new star for the show - George. You might recognise him from the Newtek September 2002 LightWave® Texturing Competition. I'm not sure if the guys at Newtek ever christened him, but for todays purposes, we shall call him George. George was absolutely thrilled to be starring in this tutorial! And here are the unwrap options: Planar Unwrap Once again, we have a planar option. Yes, it's basically the same as before. The resulting UV coordinates are basically a flattened out straight-on projection through the surface along the desired axis. One thing to note, however, is that UV templates are always perfectly square (remember what I said about 1-by-1 image proportions?), so what often happens is that your resulting UV map can look somewhat squashed. Don't worry about that, you can change it by polling your UV points with the UV map itself without actually altering the actual geometry of the object. But more about editing UV's later on. I personally use the Planar unwrapping more than any other method, as it generally produces the simplest maps with which to work. Here is what a planar unwrap of George (on the Z-axis) looks like: As you can see, planar unwrapping the entire head on the z-axis results in a lot of overlapping polygons - the entire back of the head is now tucked away behind the front, and will require a lot of editing to pull the polys out to the sides. The ears are also a complete mess. This is obviously not the most ideal method for this head. When planar unwrapping something such as this head, it's best to unwrap it in sections. For instance, it would be best to unwrap the front, sides and back seperately. Yes, this will create seams that you will have to hide, but that's something to worry about a bit later on. Cylindrical Unwrap Yes, it's the cylindrical option again. And yes it's also basically the same as before. This method splits your object along a line (depending on which axis you are unwapping it), and unwraps your object in a cylindrical fashion. Cylindrical unwrapping is very useful for human heads - unwrap a head along the Y-axis, and you are likely to end up with a fairly decent start for a template from which to work. Let's unwrap Georges head cylindrically, and see what happens... Aaaah, much better! As you can see, this is a cool starting point. Of course, some editing will be required here - especially with the ears, but it's pretty easy to see that this is a good method for a head. Note the way in which the unwrapping process created a new meridian along the back of the head, where it split it to spread it out. When painting onto this template, you will need to be aware that these two ends are going to be joining, and must ensure that they will come together with no visible seams. I will chat a bit more about seams a little later on Spherical Unwrap Ok, you guessed it. It's also the same as before. You are probably wondering why you should bother using UV unwrapping if what they do is basically the same as the standard projection types, but as I said, the power behind Uvs is in the way that they "stick" to the points of your model and can be edited without affecting your models geometry. As you can see in the image below, unwrapping Georges head spherically (also on the Y-axis), produces a very similar result to the cylindrical unwrap. The difference between the two is that this has slightly more squashing and stretching along the V-axis. There is also a stronger push and pull along the vertices nearer the poles of the spherical map. Obviously, in a case like this, spherical mapping would also do quite well as an unwrap for the model. As I mentioned before, the ears in both cases will need a significant amount of editing to eradicate overlapping polygons, and to place them in such a way as to facilitate easy and precise painting. Atlas Unwrap If you've ever selected this type of unwrap, you'll know it's the really messy one!. Basically, Atlas unwrapping produces a UV template that translates the surface information into a UV map that represents the models polygons in a projection whereby once it is painted onto, will produce an image that will remain constantly perpendicular to the face normals of the surface polygons. Simply speaking, it is like taking a ball of paper that you have bunched up into an extremely irregular ball, and flattening it out again. The problem with Atlas unwrapping is that the resulting map is often a terrifying and confusing mess of disjointed polygons all over the show. What happens to poor George when we subject him to this one? AAAAAAAARRRGGGHHH!!! This is certainly NOT an ideal method for unwrapping George. I'm sure he would be rather alarmed if he were to see what had happened to his polys in this case.... So, as we can see, this method is not really suited to a shape like this, as the editing that will be required to put this one together would be a nightmare. However, atlas unwrapping is very useful for things like simple buildings, and other non-organic objects. But be warned that a fair amount of tweaking is still usually required. Well, we've now discussed all the different unwrapping options! What now? So what do you do now that you have the unwrapped UV map? Firstly, if any editing of the UV map is required, then do so. I can assure you that 99.9% of the time, the UVs will HAVE to be edited, so here are some tips... LightWave® has a bunch of tools that you can use to edit the map, and as I said before, remember that moving the points around on this map is not going to affect your geometry in any way, provided you are working in your UV viewport. So feel free to push and pull those points to your hearts content! Just don't weld or merge points together in the UV viewport, as this will affect the geometry. Mostly, when editing UVs, it's best to unweld the points before you start moving them around. Moving points while they are welded often drags all the edges around, and causes stretching. So unweld your points by hitting ctrl+u, and then editing. Just don't forget to reweld them together afterwards, by pressing ctrl+m. Most UV unwraps will need some editing as fragmentation often occurs, resulting in polys that actually lie adjacent to each other being displayed on opposite ends of the template. If you've unwelded your points as I explained above, you should have no problems arranging your polys around in the UV viewport so that the bits lie adjacent to one another correctly. Edit your map until you are satisfied that you can work well with it, and then you are ready to paint and apply an image to it. Export this template to Adobe Photoshop® (or whatever painting program you use) for painting. There are two ways to do this - some Unwrap plugins will create an image for you, which you can then open up in Photoshop®, or you can just get a screengrab (using the PrintScrn button next to your Scroll Lock key), go to Photoshop®, go to New Image (the image size will already be there, defaulted to the resolution your OS is running in), and Paste. Then just trim the square UV template - make sure you do this!! Lots of people have come to me asking why their UV maps aren't working, and it often ends up that they didn't trim the image down to the square size. Another way of getting your UV template into your painting program is by using the Export option in Modeler - Go File>Export>Export Encapsulated PostScript, and just select the image file type, size and name, and Modeler will export the image for you. Having done this, you are now ready to begin painting your own image maps to use with your UVs! Let's see what we can do with George... Let's do a quick test using George, with the cylindrical unwrap. For the sake of this example, I'm going to leave the ears alone. Here is the slightly edited UV map, trimmed down to the correct square block: Ready for texturing! And now for a *very* quick test image map: Once you have painted your maps, simply load them into LightWave®s Image Editor. Then go to the Surface Editor, and choose the correct surface channel for your image (Colour, Diffuse, etc), load the image into a layer, and choose UV the Projection drop-down list. The just select your UV map from the new list that appears, and your UV image map is loaded and ready! However, you can't always expect everything to work perfectly as planned... What happens if the image has stretching or any other minor problem that you did not realise it had before? Often, small problems with the UV map can only really be spotted once there is an image applied to it... Look what happens to the LightWave® logo when this map is applied to George! Oh dear, look at that stretching! Luckily, there is an excellent method to do tweaking once the map has been painted. If you do indeed find that once you've already edited the map, and then painted all your images to go onto it, that there are still small tweaks to make to the actual UV map, there is a way to fix them. Of course, in a case like this, going and repainting all the images would be a major headache and annoyance. So, rather than explode in a fit of fury, just do what I do: Change your display settings to show only 2 viewports - Perspective and UV. Make sure that the Perspective viewport is set to display OpenGL textures, and place the image map into the background of the UV viewport. You can place an image into the background by hitting "d" to bring up your display options panel, and then clicking on the Backdrop tab, selecting the viewport into which you wish to place the image, and selecting the image from the drop-down list. See the example below: Placing the image map into the background of the UV viewport Now, just tweak the points in your UV map, and watch the effect it has on the texture! Just adjusting the points in this area slightly, allow us to properly fix the stretching and squashing without having to re-paint all the maps. What a lifesaver! And that pretty much sums up editing UVs! Baking Procedurals Another thing that UVs can be used for, is baking procedurals. If you have set up a great looking texture with procedurals, but wish to add detail to them in a painting program, then baking them is the thing to do. However, when baking procedurals, you have to have created UV maps for your object. LightWave® then bakes them to any UV map is assigned to the object whose surface is being baked. To bake a procedural to an image, simply add the Surface Baker shader to the shaders list in the Surface Editor. Double-clicking on the shader will bring up the following panel: LightWave®s Surface Baker panel Simply select the desired UV map to bake to, and choose a resolution for the image - remember, the bigger, the better! Then choose the format you want the image saved as. The rest of these options are covered in the manual, so I will not explain them here. Once you start the rendering process, the procedurals will be baked to the selected UV map, which you can then edit in your painting application. A Final Note About the Dreaded Seam Debacle The question that I find myself being asked most often by people needing help with texturing is - "How do I avoid seams in my textures?". I'm afraid that there is, unfortunately, no easy solution. Seams become a nightmare when texturing anything that requires multiple unwraps (which are probably most models). Take, for example, the Anubis character that I made a while back (it can be seen on my gallery here). Just the upper part of this character has 11 different planar UV maps applied to it. And because I make these all in separate files, what happened was that I ended up with visible seams where the polygons which were using the different UV maps join. These seams are obviously unsightly, and need to be eliminated. One way of covering them up is to make seam images which blend the different UV mapped surfaces into each other. There is another, easier method of avoiding this: When doing multiple unwraps for a single surface (as is the norm), choose a base colour that will be used as the base for all the different UV map images. Then, when painting onto the individual maps, just ensure that the detail you add lies a couple of pixels within the seam, that way, where all the UV maps meet, there is only that base colour between them so the seams will not be visible. The same goes for bump, spec, etc maps - make sure that no detail "breaks" the borders of the polygons within the UV map, that would then become noticeable when they do not continue on the polygons using different UV maps surrounding them. It's a bit of a cheat, but hey - it saves time! Apart from that, it's just a matter of painting carefully, and being aware of where the seams are from image to image. Yeah, it's a lot of work, but who said that texturing was an easy and quick process? And that's pretty much it! That's all for this round. I hope you have a good grasp now of what is involved in using the correct projections and unwrapping techniques for your models, and will start using them! As usual, if you have any problems or further queries, let me know. By Leigh van der Byl [Tens de ter uma conta e sessão iniciada para poderes visualizar este link] |