If you follow the practical example in Chapter 5, you should have a model of an eye that has the boring, plastic default gray material. If you haven't modeled that eye, don't worry; it's on the companion DVD for this book as well as the companion Web site. The purpose of this practical example is to make that eye look more like an actual eye and less like a gray ball.
When working with materials in Blender, you find out very quickly that you often have to scroll the Properties editor or you frequently have to switch between different sections of the Properties editor. This fact is even more apparent when you start working with textures (see Chapter 8). What it comes down to is that the default screen layout is inadequate for working with materials. The best way to alleviate that problem is to create your own screen layout that shows you all the information you need all at once.
To start, I recommend that you set up this new screen from a fresh Blender scene, so either open Blender now or reload the startup file by pressing Ctrl+N. This way, after you set up this new screen, you can include it with your startup file and it will be available for you in all your future Blender sessions.
With your new scene loaded, go to the header at the top of the Blender window and use the Plus (+) button on the right of the screen datablock to add a new screen. When you do so, not much will appear to change, aside from the screen name now showing as Default.001. Left-click the text field in the screen datablock and change the name of this new screen to"Materials. Now you can actually edit the screen layout to suit your needs. I tend to like the layout shown in Figure 7-14.
To get this screen layout, use the following steps:
If you're not sure how to split and join areas in Blender, see Chapter 2.
To do so, hover your mouse over the header and press F5 or right-click the header and choose Flip to Top.
This way, you can always see what your materials look like as you make adjustments in the lower Properties editor.
This step isn't really necessary at this point, but it will be useful down the road.
Now, whenever you start Blender, you have a Materials screen that you can jump to for editing materials on a model.
At this point, you can load the eye .blend file (F1) and begin working on its materials. One note: Because the eye model was created before you made your custom Materials screen, if you simply double-click the .blend file and load it outright, you won't see your Materials screen in the screens datablock. To get around this issue, look to the left region on the side of Blender's File Browser. Disable the Load UI check box near the bottom of that region. After you do that, you can double-click the eye .blend file you want to load. Now you should be able to look in the screens datablock and choose your custom Materials screen. Your Blender window should now appear something like the window shown in Figure 7-15.
Now to play with materials! Specifically speaking, you need to create two materials for the eye: one for the cornea/sclera around the eye and another for the eye interior.
To create the cornea material:
The cornea and sclera wrap around the eye, so the layer is transparent.
The material preview updates, but the 3D View has no apparent effect.
I like doing this in the right-hand Properties editor in the custom Materials screen created in the preceding section. Figure 7-16 highlights the controls for enabling transparency in the 3D View.
The last two settings are particularly useful because by disabling them, you prevent your cornea from casting a shadow upon the interior of the eye. If later, when you render a character with these eyes, the eyes render in all black, chances are good that you forgot to disable these material settings.
After the cornea material is complete, you can work on the interior elements. Currently, the entire eye is the same transparent material as the cornea; that's not likely what you want. In that case, you need to create a new material:
This step creates a duplicate of your cornea material, named cornea.001.
Your new material still has the same settings as the cornea material.
At this point, you've created a base texture for the interior of the eye that looks something like the preview image shown in Figure 7-17.
Of course, although you created a new material for the eye's interior, that material has not yet been assigned to any faces of your model.
You can do so by pressing A until nothing is selected.
Your results should appear like the image in Figure 7-18.
Now you need to create a material slot for the eye's pupil. Using the same basic steps described in the earlier section, “Building a base material for the eye interior,” create a new material slot for your pupil.
When you finish, your result should appear like Figure 7-19.
From here, you have two options. The easiest thing would be to create another material slot for the eye's iris. And if you're not too worried about detail, that could very easily be enough. However, if you want a bit more detail, you may want to use Blender's Vertex Paint feature to give you colors with more subtle variations than just straight material slots can get you.
In this section, you can get more detailed and subtle color results for the main body of the eye. Before you bolt face-first into Vertex Paint mode, you should first make sure that your painting gets rendered:
Now you're ready to start painting.
If you go to Vertex Paint mode (V) right now, the eye model changes into a solid white blob. This setup isn't a particularly nice way to paint your vertices. Not only can you not determine what parts of the eye you're looking at, you also only have access to painting the exterior cornea/sclera of the eye. The interior parts of the eye model are completely obscured and inaccessible. Fortunately, there's a way around this issue. Left-click the Face Selection for Masking button in the 3D View's header. Upon doing so, you see a shaded version of your interior eye model with light wireframe lines drawn over the surface.
You may be wondering why the exterior faces of the eye model disappeared. Well, earlier in this practical example, you went into Edit mode, selected the external faces (L), and hid them (H). When you're in Vertex Paint mode and you enable the Face Selection Masking button, Blender shows only the faces that are visible in Edit mode. It's a pretty handy trick for Blender's various paint modes in the 3D View.
Another handy tip to keep in mind is that any faces you selected in Edit mode persist in Vertex Paint mode when you have the Face Selection Masking button enabled. Although most of Blender's selection tools (right-click, border select, circle select, lasso select) work in Vertex Paint mode with Face Selection Masking, some of the useful selection operations, like loop select (Alt+right-click), don't work. If you need to select a loop, you can quickly tab into Edit mode, do your loop selection, and tab back out to Vertex Paint mode.
In fact, to select the faces that make up the eye's iris, loop selecting is exactly what I recommend you do:
When you do your vertex painting, it affects only the currently selected faces.
You should have everything other than the iris selected. You may also want to deselect the faces of the pupil, but because they're assigned to another material, that's really not necessary.
When you finish, the result should look something like Figure 7-20.
If you pop back into Object mode, your freshly painted vertex colors may not appear on your model. Don't worry, though, they're definitely there. To see your colors in the 3D View, you need to adjust your display settings. The first thing you need to do is switch your 3D View to the Textured Viewport Shading mode (Alt+Z). By default, the results aren't particularly pleasant. The transparency of your cornea is no longer apparent, and the front of the eye is probably completely darkened.
This ugliness is actually caused by two things: your display settings for the 3D View and your light placement in your scene. To deal with the former, bring up the Properties region of the 3D View (N) and go down to the Display panel. This panel contains a drop-down menu labeled Shading. By default, this menu is set to Multitexture. Left-click the menu and choose GLSL. Assuming that you have a suitably modern video card, the results in your 3D View should already be improved. Of course, the front of the eye is still dark.
To deal with the darkness at the front of the eye, simply select the lamp in your scene, grab it (G), and move it so that it's in front of the eye. Moving the lamp should illuminate the iris and pupil of the eye model. If the eye is still too dark for you, you can duplicate the lamp (Shift+D) a couple times and move those duplicated lamps around your scene to more clearly light the scene. Chapter 9 has more detailed information about lighting in Blender. When you're satisfied, you can hit F12 and kick out a quick render to see what it looks like. Figure 7-21 shows an example of what the eye might look like in the 3D View.