Tuesday, April 23, 2013

How to UV unwrap in Blender

Alright, hopefully this will be helpful for those new to UV unwrapping in Blender.  This is my first time writing something like this up, so bear with me, and I am only brushing across the top of UV mapping since I'm not an expert myself yet.


As you can see, we're going to be unwrapping this greco column I made for a project of mine.  There are a lot of different ways we can do this, and since Blender is refusing to bake and the 'matcap' I was trying to use isn't going over the model in a way that looks good, we're going to try mapping so that a seamless texture will look good on it.



Let's go into edit mode, and you can see I already subdivided the base [and the crown] of the object, so that it will be easier to mark a seam.  Marking a seam just tells the unwrapper where we want it to split the mesh to spread it flat.  You can do all sorts of seams, or you can do minimal ones -  a lot depends on what you are trying to do.  The one tip I've gotten is that if you have a -face-, like on a lizard or cthulu, you don't want the seam on the face.  Instead put it down the back of the model, whereit is less likely to be seen [or, for a quad type creature, down the belly.


For this, I marked it down the back of the column, which will be against the wall, and so less visible. All you need to do here is switch select line [Hilighted in green], select the lines you want to use as your seam, then click mark seam.


Once you have your seam, just hit A until everything is selected, and we're going to try a few different UV unwrapping methods to see how it comes out.  Each one is useful in different circumstances. Also, with UV unwrapping, you can make a map like SL has for the avie or system clothing, and even combine different mesh materials onto the same map - this is what I did with my mesh wings.


So, we're going to the UV/image window, which I've made bigger for this.  When you first click on add new image, it will default to a 1024, but I try and remember to shrink it down to 512 at this stage, so I don't forget to later.  For this, so we can see how the mapping looks, we're going to select the UV grid.  Usually I use a blank, but this actually is a useful tool.


I deselected the mesh here to show how the UV Grid looks flat - rather like the grids found in SL, with colours to show where things are.


Back to the selected, and as you can see, the default it define every quad face of the mesh as the whole texture.  This works sometimes, but for this not so well, since the body of the column is super stretched - maybe this is why the matcap didn't look good.  But I try for minimalism, and we can easily fix this.  LEt's see what out uv options are.


If you hit U, you'll get a list of options.  The first one is Unwrap, so let's see what we get.  Hrm, not very efficient use of the texture - sometimes this will work though, if you're baking the texture, which we're not really covering today, or if you are working with something that doesn't need a lot of detail and you are going to be adding other maps for other objects.


But if you look at the mesh in this next window, the unwrapping is very untidy.  So let's see what the next option is; Smart UV Project.  This one, again, sometimes works wonderfully.  So, we click it and it looks lovely on the flat, very neat and tidy.


Until we look over at our 3d model.  And yes, we could still go with this, but its obvious we'd have to squish up some the texturing we did, and its not optimal for this.  So, I'm going to the next choice I tend to go with; Cube Projection.


At first glance on our texture, this is NOT optimal, the uv map goes off the grid and its all an overlapping mess - but wait, look over at our model, this might not be so bad after all, after we do a few more things.


Under the UV/Image window, you'll see the UVs tab. Let's take a look and see what options we have.


If you look up, you'll see Pack Islands, let's do this and see what happens.


Oh, that's much nicer - no more overlap, and everything is on the texture now.  And look over at our 3d model; its still cleanly wrapping, but with a bigger grid, so it still looks nice.


My next step when mapping is to use several textures that are seamless and just see how it looks.  The wood looks a little odd, but then its green and we're used to expecting it to have a stone look, not wood.


But we can use it to make sure it looks right.  Make a material and then go to texture.  Add a texture, then set it to image or movie, and go down to image [ignore the sudden change in actual texture.]


Now, go down to Mapping and select UV so it will use the unwrapping you've done.  At this point, by the way, you are mapped - you do NOT have to do this part, this just lets you look at it before importng this into SL, and it doesn't matter what texture you use at this point, since this is mapped to be optimal for normal textures.  But, if we were working with textures specifically for the mesh, like a lizard or something, this is a good place to test them, before using local textures in SL.


For my own sanity, I switched to a marble texture I had on my computer from some lamps I'd made.  if you look at our model in object mode, it looks pretty good.



Here is where the Bake area is, but I've been having trouble with it,which is another reason I'm using this method for unwrapping.  It is unreliable for me, it doesn't like me.  But when it -does- work, its wonderful for catching at least some of the qualities of blender's materials, if not all of them.


To my knowledge, the main ones of use for SL are Texture and Ambient Occlusion baking.  But with the new materials coming down the pike, the specular and normals are likely to be useful too.


And let me snag one more image of a UV tool.  When you are doing something where you need a body map, like a shoulder lizard, Export UV Layout.  Do your map, and then you can export it and work on textures in photoshop or gimp, then bring it back in and assign it, like we did with the marble texture.


Other useful UV tools - let's say you have the model mapped and set up, but want to tweak the shape.  The mapping is done, you're happy with that.  If you use Pin, it locks down the points on the map, so that doesn't get messed up.

Also, and I have no images for this, you can move the points around on that 2d map.  If you have an image, like for an eye, and the points aren't where you need them, you can shift them a little until it looks right.  I can do a more detailed tut on that if this one was useful, adjusting the UV map.

Hope this helped!