Thursday, October 15, 2009

2.49 UV Unwrapping



Hi. The purpose of this tutorial is to show how to unwrap a globe into two hemispheres. This tutorial is based on the UV Map Basics Tutorial, in the Blender 3D: Noob To Pro wikibook. The URL is in the Youtube notes, as well as at blender3dvideos.blogspot.com, the Web site for my tutorials.

Why do we need this tutorial? The reason: UV Mapping was introduced way back in Blender 2.34 and has been extensively rewritten since then. The user interface, and many terms, have changed over time. As examples, UV Face Select mode disappeared in Blender 2.46, and the term LSCM (Least Squares Conformal Mapping) was used up until then. Now LSCM is simply called Unwrap. Many unwrapping tutorials were based on earlier versions. If you try to follow along in the current version, 2.49b, you can get confused. Hopefully, this video will help to show the steps to successful UV Unwrapping in the version most of us use.

So let's get started. Here's the default scene in Blender 2.49b. Delete the default cube (right click, then press X and confirm the delete). Add an icosphere (Space-Add-Mesh-Icosphere), accepting the default of 2 subdivisions. Scale it 3 times (S 3) to make a large globe. Let's smooth the globe out. From the Editing buttons (F9), press Set Smooth. Then add a subsurf modifier at level 2.

Split the 3d viewport horizontally, by clicking on the border, right click, select Split, positioning the vertical line to where the split should be, and pressing Enter. Make the left window a UV /Image Editor window.

Click on the border of the User Preferences window and drag down to show the user preferences. Click View Name so we can see the view name (Top Ortho). Then click on the border and drag up to free up the area for the 3D view.

Tab into edit mode, and press the A key to deselect all vertices. We're going to make a seam for the UV editor to split the sphere in two parts. To do that, press Num3 to go into side view (right ortho). We're going to box select the vertices at the equator so that when the sphere is unwrapped, the UV unwrap program will know how to split the sphere. So box select (Bkey) the vertices at the equator and press Enter. Press Ctrl-E, which brings up the Edge Specials menu, and select Mark Seam.

Press the A key to deselect the seam and the A key again to select all vertices. Press the U key, which brings up the UV Calculation menu. Select Unwrap. This is actually LSCM Unwrap masquerading under a simpler name. There are many other ways to UV unwrap an object, as you can see. The sphere is unwrapped in the UV/Image Editor window.

The easiest way to actually place the image onto the sphere is to export the unwrapping map to an image editor, such as Photoshop or the Gimp. I use the Gimp, but Photoshop will work just as well. To do this, from the UVs menu item, select Scripts, and choose Save UV Face Layout. Accept the default of 512 x 512 pixel map, which is perfect both for non Game and Game use in Blender, and save the file (it's a Targa image file) in your project directory.

Now open up the Gimp. Here are the steps I found that seemed to work well. First, open up the saved file we just created. Then open up the image to apply to the sphere. You can download the globe hemisphere image, BlueMarble 2001-2002.jpg from the UV tutorial wiki page. Go to the targa file first and find the diameter of the spheres that we need to fit the image to. The diameter is 270 pixels.

Switch to the BlueMarble jpg, the one containing the two globes. Choose the Ellipse Select tool and turn on the Fixed Aspect Ratio check box to make sure that we will do a circle select. Select the left globe. Copy (Control-C) the globe to the clipboard. Switch to the reference file. From the Edit Menu, select Paste As, and choose New Layer. Press Enter to confirm. Click on the Move tool (the one with the cross hairs) and move the globe to the center of the top series of triangles.

From the Layer menu, select Scale. Enter 272. I like to go a pixel a two more than the actual diameter to make sure we don't get any background artifacts included. Press Scale and position the expanded globe over the layout if necessary.

Now go back to the bluemarble jpg and choose the Circle Select tool. First Select None, to deselect the left globe. This time, circle select the right globe. Copy (Control-C) the globe to the clipboard. Switch to the reference file. From the Edit Menu, select Paste As, and choose New Layer. Choose the Move tool and move the globe to the center of the bottom set of triangles. From the Layer Menu, choose Scale, and scale the globe to 272 pixels as well.

Press Control-L to bring up the Layers menu. There are 3 layers, the original reference image and the two globe layers. Deselect the original reference image by clicking on the eye. Close the Layers menu. We now can save our file - we'll make it a jpeg - which will be just the two hemispheres. We'll call it FinalGlobe.jpg. Accept the Flatten Image dialog because that's what we want. Click on Export and accept the defaults.

Now go back to Blender. From the Image menu, open the FinalGlobe jpg. You might need to make some last minute tweaks to eliminate some dark background artifacts. Press the Shading buttons (F5). Add a new material. Click the TexFace button to tell the renderer to use the Unwrapped UVs. Press F12 to render. From here, you might need to add a lamp. If you go into Texture mode you can see the image on the sphere.

That's it. I hope this gives you the basics of UV unwrapping a globe image and gives you some ideas for its use. If you want to create games and need images, this is essential because Blender's game engine requires UV textured images. Happy blending.