Blender 3D: Noob to Pro/UV Map Basics
In case you're wondering, UV mapping stands for the technique used to "wrap" a 2D image texture onto a 3D mesh. "U" and "V" are the name of the axes of a plane, since "X", "Y" and "Z" are used for the coordinates in the 3D space. For example: increasing your "V" on a sphere might move you along a longitude line (north or south), while increasing your "U" might move you along a line of latitude (east or west).
Another explanation can be gleaned from the Blender manual. Imagine a paper 3D model of an object, e.g. a sphere, that is to be laid flat on a table. Each of the 3D coordinates of the sphere can be mapped to the 2D coordinate on the flat piece of paper. Blender provides another view of the vertices (coordinates) in the UV/Image Editor. You can select and edit these 2D vertices just like in the 3D Editor window. The purpose of this unwrapping of the coordinates is just to map these coordinates to images/pictures so that the 3D image can have a realistic looking surface with textures derived from these images.
The Basics of UV Mapping
Add a sphere
We'll use a sphere for this demonstration. Delete the initial cube (x). Then, create a new model, a sphere (→ Add → Mesh → UV Sphere). Leave the settings at default for now.
Mark a UV seam
In edit mode, select a ring of vertices around the widest part of the sphere (the equator, if you like). This can be done easily by holding downand right-clicking on the 'equator'.
Pressand select Mark Seam, or select Mesh → Edges → Mark Seam. This tells the UV unwrapper to cut the mesh along these edges.
Unwrap the mesh
Next, create a window for the UV mapping: click and drag left the small lined area in the top right corner of the 3D window, a new window will be created. Set its window type to "UV/Image Editor" with the drop down box at the bottom left corner of the new window or with.
In the 3D View window, select all your vertices, and press U → Unwrap. In the UV/Image editor you should see all the vertices/faces/edges of the model represented, or 'mapped', in 2D space.
Apply an image
Now we're going to actually use this UV map. Save the following image (click to view in full high resolution (4,096 × 2,048 pixels)):
Load it in the UV/Image Editor window by clicking Image → Open Image or by pressing. Then with the grab, rotate and scale tools, adjust the UV islands (the UV groups that aren't connected to each other) so that it fits nicely on top of the image as shown. To select a UV island, hover the mouse over the island and press .
Note: Since the aspect ratio of the image will warp the UV's, it may be easier to simply re-unwrap the mesh exactly the same way you did before. You can then adjust the UV's as needed.
Admire your new creation
Back in the 3D View window, go into Object mode. The next drop-down menu to the right is the Draw Type menu; use it to set the Draw Type to Textured. Note that parts of the model will be shadowed and other parts illuminated based on the location of the lights in your scene. Try adding more lights and moving them around so you see the model more clearly, and try to use this lighting preview to 'previs' your render.
To make the texture visible in renderings, you also need to add the texture to the sphere as a new material. In the Properties window, switch to the Shading context by clicking the small shaded-sphere button. Create a new material by pressing the New button, leave the settings as they are for now; then switch to the Texture context. Create a new texture and select the type to be 'Image or Movie'. Select the globe texture from the dropdown menu.
Then go to the mapping menu and set the Coordinates to 'UV' and the 'Map' to 'UVMap', leave the projection at 'Flat'. This will make use of the the UV's we unwrapped earlier. To make the globe bit smoother, switch to the Modifier context in the Properties window and add a subsurf modifier; set the number of subdivisions to 2. Then pressin the 3D viewport and select 'Smooth' under the shading options. This will make the globe far smoother and more realistic.
Now, simply pressto render your scene!
Note that in the above render I've changed the lighting and the camera position to make the image more interesting. I also added a star background, you can find the settings for this the in the World context in the Properties window. Enable 'Stars', 'Paper Sky' and 'Blend Sky'. Play around with the settings for them until you reach a result you're pleased with.
Noob Note: The 'Stars' option has been removed in Blender 2.70.
If you looked around the textured globe we just made, you would have noticed that around the 'equator' there were lines, or 'seams', where the two UV islands met. This is a common problem with UV mapping and there are a couple of ways to avoid it. In our case, since we're using a sphere, the best way to remove the seams is to use spherical mapping.
First download one of the textures from this link: http://earthobservatory.nasa.gov/Features/BlueMarble/BlueMarble_2002.php. Then use this texture for your globe instead of the one we first downloaded.
Go into edit mode, and select all the vertices of sphere. Press→ Sphere Projection. If you've got the UV/Image editor open you should see a very different UV map, as shown below. Note that only the 'Unwrap' option will use the seams we just made, all of the other options completely ignore it.
Now lets make the UVs fit more evenly over the texture. In the UV/Image editor, press UVs → Constrain to Image Bounds. This will make sure that during editing none of the UVs will go over the bounds of the texture; if they did, it would cause the texture to repeat itself in the area of the UVs outside the bounds.
Now select all the UVs withand scale them up till it is stopped by the image bounds. In my case, there is one vertice in the top-right corner, and a few in the bottom-right corner that is quite distant from the rest of the UVs; to fix this, I simply selected those vertices and moved them closer to the rest of the UVs.
Now simply scale all the UVs by the X axis until the UVs stretch over all of the image. Doing this is exactly the same as scaling in the 3D viewport, pressand , then drag the mouse.
Now rerender your model, and you will see that there are no seams!
In this tutorial we have barely scratched the surface of what is possible with UV mapping. Below are some more tutorials that will help you learn more about Blender's UV tools:
- Introduction to UV unwrapping in Blender: http://cgcookie.com/blender/2011/01/21/intro_uvmapping/
- How to use multiple UV maps: http://cgcookie.com/blender/2011/09/14/tip-using-multiple-uv-coordinates/