I was going to write a tutorial about Photoshop's new 3D Layers, but I realized UV mapping was a pretty important part of using that feature. Therefore, I decided to first write a tutorial about basic UV mapping using Blender. Don't worry though, a tutorial about 3D Layers will come shortly after this one.
The version of Blender I used for this tutorial is 2.45. If you've never used Blender before, I'd recommend grabbing a copy and playing with it. I don't think it's the best 3D modeling tool in the world, but it's definitely the best free modeling tool in the world.
The object we're going to UV map today is the cube that comes with every new Blender project. If you simply open Blender, it automatically creates this cube for you.
The first thing we need to do is bring up the UV Image Editor. Usually we want this displayed at the same time as our cube. We can accomplish this by splitting the display area. To do this, right-mouse click on the top of the display area (where the resize cursor is visible) and selecting "Split Area".
Once you split the display, you'll want to set one of them to display the UV Image Editor. I like the right side, but you can choose whatever side best works for you.
Once you've got the UV Image Editor displayed, it should look something like this:
The first map we're going to create is the simplest - one image for all sides of the cube. To set this up we first need to switch the cube's display to the "UV Face Select" mode.
When you enter UV Face Select mode, you'll notice the display on the left turn blue. This represents all the faces on your UV map. You'll want to make sure all your faces are selected. You can do this by hitting the 'a' key on the cube display a couple of times. 'a' will select and deselect all items on your current display. When the faces are selected, the UV map will be blue, if nothing is selected, the display will be black.
Now that our UV map is set up, we can give it an image. I simply created a 512x512 square in Photoshop with a nice symmetrical design.
Once your image is created (or you can use the one above), you simply open it using the UV Image Editor
When the image is opened, you'll immediately see the texture applied to your cube. I zoomed in a little and rotated the display (middle-mouse drag) to show it a little better.
If you render this scene, you might notice your texture doesn't show up yet. That's because the material hasn't been told to use it. This is configured in the materials menu. The menu can be entered by pushing F5 or clicking the button pictured below.
Once you're in the menu, all you have to do is click the texface button.
If you render the scene now (F12), you'll see the texture in all its glory.
One image for all the sides of the cube is good and all, but usually I want a different image on each side. To do this, we're going to have to "unwrap" the sides of the cube onto our UV map. Unfortunately, Blender has no idea how to unwrap an object - even one as simple as a cube. We have to give it a little help by defining some seams.
Fortunately, seams are pretty easy to create. The first thing you'll want to do is switch to Edit Mode.
By default when you enter edit mode you're placed in vertex selection mode. You'll want to switch to edge selection mode since seams are created on edges. You can enter edge select mode by simply clicking the edge select mode button. Depending on how small your window is you might have to make it a little wider to see the button (like I did).
All of the edges will be selected when you enter edge select mode. Click 'a' to clear the selection. Now you'll want to select a set of edges and mark a seam. Edges can be selected by right-mouse clicking on the edge. Multiple edges can be selected by holding down shift and right-mouse clicking. Shift-right-mouse click all the edges that I've highlighted below.
Once you have the edges selected, click ctrl-e to bring up the edge menu and mark the selected edges as a seam.
You might be wondering why I chose those specific edges to mark as a seam. All I can say is that it's a pretty standard way to unwrap a cube (pictured below). If you stare at the edges long enough, you might be able to see how it unfolds into that shape.
After the seam has been created, switch back to face select mode and select all the faces on the cube. Then, on the UV Image Editor, unwrap the cube using the unwrap menu item.
After the cube is unwrapped, the UV Image Editor should look something like this:
Now you can draw a new texture and whatever is placed in each square will show up on each side of the cube. In order to draw in the correct spots, you'll probably want to save the UV layout and open it in another editor (like Photoshop). The layout can be saved by running the "Save UV Face Layout" script.
When you run the script, you'll be prompted for some options. Usually I'll only change the size depending on how high I want the quality (bigger size for higher quality).
When you save the layout, it will generate a black and white Targa that contains the outline of your UV map. Below is one I filled in with letters for each side of the cube.
To use it, just open it into the UV Image Editor like we did for the first image. Now you've got a cube that looks like this:
And when it's rendered, it will look something like this:
That should do it for UV maps in Blender. The concepts introduced here can be expanded for any number of complex objects. I always thought Blender's learning curve was a bit steep, but hopefully this, and future tutorials, will help the climb. Keep an eye out for a tutorial about Photoshop's 3D layers, which makes drawing your textures easier than ever before.