Unwrapping Your Eye and Painting a Detailed Texture

In preceding tutorial, I show you how to add basic materials to an eyeball model (created in the eye modeling tutorial). While the model looks pretty good, you can provide an additional splash of realism to it. In particular, you can get a much more detailed iris, and you can add some of the fine blood vessels around the white section of the eye. Those kinds of details are difficult to pull off with just material shaders and vertex colors.

Start this example by opening your eye .blend file and switch to the UV Editing screen layout as shown in the following figure.

Private Eyeball, reporting for unwrap, sir!

Marking seams and unwrapping

This example starts with marking your seams. With this model, you don’t really need to be concerned with texturing the faces on the cornea/sclera. Because you don’t have to worry about texturing those faces, you also don’t need to be overly concerned with unwrapping them, so it’s best to hide them. Use the following steps:

  1. Select your eye object and Tab into Edit mode.

  2. If the faces for the cornea/sclera of your eye mesh are visible, make sure that no faces are selected and then select the faces that form the cornea by hovering your mouse over one of them and pressing L.

  3. Hide your selected faces (H).

Now you can focus on the part of the eye that really needs the detailed texture.

Tip

To make selection easier, you may want to enable the Limit Selection to Visible button in the 3D View’s header. This button is disabled by default in the UV Editing screen layout’s 3D View.

To start marking your seams, set up your work environment in the following way (from Edit mode):

  1. Switch to Edge Select mode (Ctrl+Tab).

  2. Make sure that you’re in Solid viewport shading (toggle with Z).

  3. Toggle the 3D View to an orthographic view (Numpad 5) of the rear of your eye model (Ctrl+Numpad 1).

Now, using Blender’s selection tools, select edges around the pole on the back side of the eye, as shown on the right of the figure down below. The idea here is that you’re only really concerned with how the front of the eye looks. Because the back of the eye is probably going to be all red anyway, stretched textures back there are much less of a concern.

Mark your selected edges as seams by using the UV Mapping→Mark Seam button in the Shading/UVs tab of the Tool Shelf or by pressing Ctrl+E→Mark Seam in the 3D View. When you deselect all your edges by pressing A, your seams are clearly marked in red. Now, press A again to select all edges and then unwrap your eye mesh by either clicking the UV Mapping→Unwrap button in the Shading/UVs tab of the Tool Shelf or by pressing U. In either case, choose the first item, Unwrap, from the menu that appears. Congratulations! You’ve unwrapped an eyeball. You result should look similar to this image. On the right, selecting seams for unwrapping your eyeball. On the left, your initial unwrap.

Reducing texture stretching

After you unwrap your eye, it still looks pretty nasty. The UV layout is a kind of ugly star shape, and the edges are all uneven. Worse, the part that you want to detail the most — the iris and the area around it — takes up the least amount of space in your unwrap, so adding any real detail is difficult. You can see just how bad the situation is by generating a UV test grid image using the following steps:

  1. In the 3D View, change into Texture Paint mode.

Use the Modes drop-down in the 3D View’s header or, if you have the Pie Menus add-on enabled, you can choose Texture Paint from the pie that appears when you press Tab. In the Tools tab of the Tool Shelf, you should see a warning about having no paint slots.

  1. In Tools tab of the Tool Shelf, left-click the Add Paint Slot button.

Choose Diffuse Color and from the floating panel that appears, choose UV Grid as your Generated Type. Leave all other settings at their default values.

  1. Return to Object mode.

Again, this can be done from the Modes drop-down menu in the 3D View or from the Tab pie if you have the Pie Menus add-on enabled.

  1. In the 3D View, switch to Textured viewport shading (Alt+Z).

If you don’t see the test grid and you’re rendering with BI, you may still be using GLSL display in the 3D View. If this is the case, switch back to Multitexture by going to the Shading drop-down menu in the Display panel of the 3D View’s Properties region (N).

The stretching in your UV layout is even more apparent if you go back to the UV/Image Editor in its Properties region and change your test grid type from UV Grid to Color Grid in the Image panel. Don’t worry, though! All is not lost. You just have to spend a few minutes in the UV/Image Editor.

First things first: Orienting your UVs so that they match the orientation of your eye is a good idea. Just looking at the unwrap, it’s hard to tell which way is up. An easy way to take care of this problem is to go back to the 3D View and use the following steps:

  1. Switch to Face Select mode (Ctrl+Tab) and deselect all faces (A).

All the edges and faces in the UV/Image Editor disappear. Don’t panic! The edges and faces are still there; it’s just that what’s visible in the UV/Image Editor corresponds to the selected faces in the 3D View.

  1. Around the rear pole of the eye, select the four triangular faces around the vertical meridian.

Your selection looks a bit like an hour glass. In the UV/Image Editor, the corresponding faces appear as two pairs of triangles pointing away from each other. The following figures shows an example of what this selection might look like.

Select an hour-glass-shaped set of faces on your mesh to help with properly orienting the UV map.

  1. In the UV/Image Editor, select the corner vertices where each pair of triangles connect and pin them by pressing P.

Those vertices (there should be two of them) are now marked in red.

  1. Enable Live Unwrap in the UV/Image Editor (UVs→Live Unwrap).

  2. Return to the 3D View and select all faces (AA).

  3. In the UV/Image Editor, select your two pinned vertices and align them vertically.

You can do this step in two ways. Technically, the more correct way is to use weld/align operators (W→Align X), but you could also scale the two vertices along the X-axis down to zero (SX0). Either way, the result is the same.

  1. Enable Constrain to Image Bounds (UVs→Constrain to Image Bounds), disable proportional editing (O), and select all vertices in the UV/Image Editor (AA).

These setup steps are all so that you can quickly maximize the amount of space your UV layout takes in its square.

  1. Scale your UVs so that they’re as large as they can be without exceeding the size of the square that they’re in.

If you enabled Constrain to Image Bounds in the last step, Blender automatically stops scaling when your UVs first hit the border of the square. You may have to grab (G) the UVs and move them around if they’re not well centered.

  1. Unpin your vertices (Alt+P) and deselect all vertices (A).

  2. Select the outermost loop of edges (Alt+right-click) and scale (S) that loop out so that it’s as large as possible without overrunning the vertices at the tips of the outer triangles.

The next step is where the magic happens.

  1. Select all vertices (AA)and use Blender’s Minimize Stretch feature (UVs→Minimize Stretch or Ctrl+V).

When you activate the Minimize Stretch feature, the vertices start moving out on their own in an effort to reduce the amount of stretching in the UVs. Eventually, your UV layout in the UV/Image Editor will start looking like the vertices aren’t moving at all, which means that Blender has found the best solution that it can based on your initial layout. If you scroll your mouse wheel you can tweak these adjustments to taste.

  1. Press Enter to complete the operation.

The following figures shows the results you should have at this point.

UV coordinates with reduced stretching thanks to the Minimize Stretch feature.

You still have a bit of noticeable stretching around the iris area. However, by going to the UV/Image Editor and enabling proportional editing (O), you can loop select (Alt+right-click) vertices around the iris and scale (S) them until you’re satisfied. Don’t worry so much about stretching as you get farther away from the iris. That part of the eyeball is rarely seen and generally has the same flat color anyway.

Baking vertex colors

After you have your eye unwrapped, you can get rolling with painting your textures. But why do by hand what Blender can do for you? Some people may call this part being lazy. I call it being efficient.

In the preceding tutorial in this chapter, Blender’s Vertex Paint mode is used to paint in rough colors for your iris and the back of the eye. Why do the same work twice? You can use those vertex colors as the starting point for your more detailed image texture, thanks to render baking.

Baking vertex colors is a bit different in Cycles compared to BI. Use the following steps to bake vertex colors if you’re using Cycles (I’m assuming that you’re using the Default screen layout):

  1. Change the 3D View into a Node Editor (Shift+F3).

  2. For your eye material, add an Image Texture node (Shift+A→Texture→Image Texture).

There’s no need to connect this node to anything else at the moment. As long as it’s in the Node Editor, you’re good to go.

  1. In your newly added Image Texture node, left-click the image datablock and choose the test grid image you created in the preceding section.

  2. Repeat Steps 2 and 3 for each of the materials in your eye mesh.

You only need to bake the texture for the eye material, but because of a quirk in the way baking works in Cycles, you need to have an Image Texture node in each node network, otherwise baking will fail.

  1. In Render Properties, expand the Bake panel and set the Bake Type drop-down to Diffuse Color.

  2. Left-click the Bake button in the Bake panel of Render Properties.

A progress bar at the top of the Blender window shows your bake process.

  1. When the bake is complete, change the Node Editor into a UV/Image Editor (Shift+F10) to see your baked texture.

  2. Save your baked texture as an image (F3).

You’re saving for two reasons. First, saving your work is always a good idea. Second, now you can take your image texture and open it in any image editor, such as GIMP or Photoshop, and start painting details on top of your rough color.

To bake your vertex colors to an image texture while using BI, use the following steps (I’m assuming you’re working from the UV Editing layout):

  1. While still in Edit mode, go to the UV/Image Editor and create a new image (Alt+N), named eye.

All the default settings should work just fine. Alternatively, you could also use the UV test grid image that you created in the preceding section.

  1. Tab into Object mode and split your 3D View vertically.

  2. Change the newly added area to a Properties editor (Shift+F7).

  3. In Render Properties, expand the Bake panel at the bottom and set the Bake Mode drop-down menu to Vertex Colors.

  4. Left-click the Bake button in the Bake panel of Render Properties.

You soon see image in the UV/Image Editor update with the vertex colors that were applied to your eye model.

  1. Save your newly created image (F3).

You’re saving for two reasons. First, saving your work is always a good idea. Second, now you can take your image texture and open it in any image editor, such as GIMP or Photoshop, and start painting details on top of your rough color.

The next image shows the result of baking vertex colors to a texture.

After you bake your vertex colors to a texture, you can paint details on your eye in any painting program.

Assigning textures to your material

Before you get all crazy with painting your texture (whether within Blender’s Texture Paint mode or in an external paint program), it would be wise to disable the vertex colors on your eye mesh and apply your newly created image texture. The steps are a bit different, depending on whether you’re rendering with Cycles or BI.

Assigning textures with Cycles

If you baked your vertex colors to a texture using Cycles, most of the work is already done for you. Assuming you’re still in the Default screen layout and your eye object is selected, use the following steps:

  1. Change the main area into a Node Editor (Shift+F3).

  2. From Material Properties, choose the eye material from the list box at the top.

Looking at the node network in the Node Editor, you should have an unconnected Image Texture node.

  1. Wire the Color socket of your Image Texture node to the Color input socket of the Diffuse BSDF shader node.

Optionally, you can also delete the Attribute node from the network. I’d suggest leaving it in, though. Perhaps you may need to use those vertex colors later.

Your node network should look something like the one shown.

The node network for making your baked image texture part of your eye material.

Assigning textures with BI

To assign your baked image texture to your material in BI, switch back to the custom Materials layout created earlier in the materials tutorial. In the 3D View of this screen, make sure that you’re using Textured viewport shading (Alt+Z) and go to the 3D View’s Properties region and confirm that the Display panel has GLSL as your active Shading method. At this point you have an image texture that you need to apply now.

First, though, you need to disable your vertex colors by going to Material Properties and disabling the Vertex Color Paint check box in the Options panel. Now you’re back to a boring gray interior for your eyeball. To apply your image texture, switch the right side Properties editor to Texture Properties and use the following steps:

  1. Create a new texture in the topmost texture slot and name it eyeball.

Create the new texture by left-clicking the New button in the texture datablock.

  1. Change the texture Type drop-down menu to the Image or Movie option.

  2. In the Mapping panel, choose UV from the Coordinates drop-down menu.

  3. In the Image panel, left-click the datablock button on the left and choose your baked eye image.

  4. (Optional) In the Image Mapping panel at the bottom, change the Extension drop-down menu to Clip.

Although this step is optional, it’s generally a good idea to avoid unnecessary tiling. Now your image texture is applied to your eye.

If you did these steps correctly right, your 3D View should look nearly identical to the vertex color results you had before disabling vertex colors on your model. The difference now, however, is that you can add even more detail. Woohoo!

Painting textures

You can paint your texture in an image-editing program like Krita or Photoshop, but you may not have to. You can add a lot of detail within Blender using a combination of the UV/Image Editor and Texture Paint mode in the 3D View.

If you haven’t already, switch back to the UV Editing screen layout (if you’re rendering with BI, get rid of the Properties editor that you split in the previous section on baking).

Image painting in the UV/Image Editor

Probably the quickest and easiest way to start painting is to hop right into the UV/Image Editor and enable Painting mode from the Editing Context drop-down menu in the UV/Image Editor’s header. The Tool Shelf (T) of the UV/Image Editor updates with a set of paint tools you can use.

Tip

For any kind of texture painting, I highly recommend that you use a pen-based, pressure-sensitive drawing tablet like those made by Wacom. These tablets takes a little bit of time to get used to, but it’s a much more natural drawing and digital painting experience.

After you enter Paint mode in the UV/Image Editor, you can start painting directly on your image texture. The really cool thing is that, as you paint, your model in the 3D View updates in real time. With this feature, you can start cleaning up your vertex colors, add little blood vessels to the eye, and produce a more detailed iris texture.

Using Texture Paint mode

On some models, however, the disconnect between painting on the image and seeing the result on the mesh is too disorienting. Predicting how the texture will ultimately lay on the mesh is sometimes too difficult. In these cases, painting directly in the 3D View is often easier. For painting in the 3D View with BI, I prefer to use the Multitexture Shading style, which you can set from the 3D View’s Properties region in the Display panel. Although you don’t see the lighting results that you get when using GLSL, the texture colors are more vibrant and close to what you’re actually painting. If you’re rendering with Cycles, all you have is the Multitexture appearance.

When you switch into Texture Paint mode using the Modes drop-down menu in the 3D View’s header, you may notice that, like when vertex painting, your interior eye is obscured by the cornea/sclera faces. You need to hide those faces and use the Face Selection Masking feature. Fortunately, because this model has been vertex painted, those faces should still be hidden. If not, you can hide them in exactly the same way you would when vertex painting. You can quickly tell by enabling the Face Selection Masking button. If you’re able to see the interior eye parts, then you’re good to go. If not, press L with your mouse cursor over the cornea/sclera mesh and then press H to hide them. Then, press A a couple times to make sure that all the faces in the eye mesh are selected. Now you can paint directly on the eye, using the brush and paint tools available in the Tool Shelf. In fact, something I like to do is leave Painting mode active in the UV/Image Editor and Texture Paint active in the 3D View at the same time. Then you can switch between painting on the image and painting on the mesh, depending on what your specific needs are.

With a little bit of work, you can get a texture on your mesh like the shown (on the left, it’s rendered in Cycles; on the right, it’s rendered in BI).

A completed, detailed eye texture, painted completely in Blender.

Like this tutorial? It pairs really nicely with my book, Blender For Dummies, 3rd edition. It’s available anywhere books are sold. Thanks!