Adding Basic Materials to Your House
In Chapters 5, "NURBS Modeling Basics," and 6, "More NURBS Modeling," you created a house with NURBS modeling techniques. In this section, you'll texture the house by following the tutorials to add materials for the doors, windows, and so forth.
Setting Up Default Lights
Before you start adding textures, you need to add some lights to the scene from various angles so that your test renderings while working on materials give you an accurate view of the fully lit house. To ease the process, we've created a MELscript that adds three Spot lights to your scene:
Start by opening the Script Editor (hotkey: Shift+S).
On the CD
In the Chapter_08 folder on the Maya Fundamentals CD-ROM, you'll find the script file ch08Lights.mel. Open this file in the Script Editor (File | Open Script).
At the bottom of the Script Editor, you'll see some text, which is the command set you want to run. Click to get a cursor at the bottom of this command set. To run this script, press Ctrl+Enter.
On the CD
Open the Outliner (hotkey: Shift+O). You'll see three Spot lights listed. With some lights in the scene, now you're ready to begin creating and applying materials to the house.
Tutorial: Materials for Your House
You should load the file noted below the CD icon from the Maya 4.5 Fundamentals CD-ROM. If you use your own ending scene file from the previous chapter, the results might vary.
On the CD
To work more efficiently in this tutorial, switch to the saved layout corresponding to materials and rendering (Panels | Saved Layouts | Hypershade/Render/Persp). The viewports should now be replaced with Hypershade, the Render View window, and Perspective view. If you had one of the views open as a floating window, the viewport ignores that particular window in the layout and leaves the floating window available.
For the doorknob's texture, you'll create a brushed metal with a worn look. First, hide all the layers in the scene, except for the DoorL layer, by clicking the "V" (for visibility) next to the layer names. If there are other objects, such as cameras or deformers, you can hide them by disabling them in the view (Hotbox | Show | Cameras, Deformers). Orbit and zoom to the DoorKnob object in the Perspective view; this is the doorknob on the outside of the house.
The preliminary material for the doorknob is identical to the metal you created earlier in this chapter in the "Creating Solid Materials" tutorial, so follow Steps 810 to create a gold metal material and change the material name to DoorKnob-Blinn.
When you use a hyphen (-) between words in filenames, Maya converts it to an underscore ( _ ).
Make sure the doorknob is still selected, and assign the DoorKnob_Blinn material by right-clicking the new material and choosing Assign Material to Selection. IPR render the scene in the Render View window; when it's finished, marquee-select a rectangle that surrounds the doorknob. After a few seconds, this area will render again, and IPR is now set to respond instantly to your material (see Figure 8.11).
Figure 8.11 Adjusting the texture of the doorknob, using IPR rendering for quick feedback.
The doorknob currently has an ugly bright yellow spot, which doesn't look realistic. To fix that, select DoorKnob_Blinn again and open the Attribute Editor. Click on the swatch for Specular Color, and in the Color Chooser, change the Value setting to 0.45. The specular color looks a little duller now.
- Save the scene as ch08TexturedHouse. It's a good idea to save
your work frequently.
The door is already visible, so even though you won't finish the texture right now, you can go ahead and add a material for it.
For the door, you'll create another Blinn material by MMB-dragging a new Blinn material type from the Create Bar to the bottom tab panel. Name the new material Door-Blinn.
Select the door object in the Perspective view. Remember that it's a NURBS cube, so after selecting one side, press the up arrow once to select the entire door.
In the top tab in Hypershade, RMB-click on Door_Blinn and choose Assign Material to Selection. IPR rendering will update in the Render View window.
Next, set up the material's attributes in the Attribute Editor. You're creating a wood material for the door, so select a light brown color (HSV: 40, 0.8, 0.3). Set Eccentricity to 0.5, thus increasing the size of the specular highlight, and set Specular Color to a lighter brown than the door in the Color Chooser (HSV 40, 0.4, and 0.5). Last, set Reflectivity to 0, and save your scene again. You'll see the updates in the Render View window after each change.
The next step is setting up a material for the windows in your scene:
You're through with the door, so hide the DoorL layer in the Layer Editor, and then display the WindowsL layer.
Create an Anisotropic material, name it Window_Anisotropic, and set its Diffuse attribute to 1. Set the color to black, the Transparency attribute to white, and under Raytrace options, check the Refractions box and set Refractive Index to 1.5.
Click on the window glass object and confirm that the Channel Box lists Window_Glass. Assign Window_Anisotropic to it. Repeat for the other window's glass, and save your scene again. Notice that because the material is transparent, you can no longer see the plane representing the glass for the window. You can still select it by clicking on the area where you would normally see the plane.
To surround the window, you can add a wood trim, similar to the material you used for the door. After you create the material for the trim, you can use it for other trim on the house, such as along the porch roof or around the door. Reusing a material in this way gives your house a more realistic lookafter all, the trim should match, right? This is a more efficient way to work than creating a completely new material for every element in a scene.
Instead of creating a new material for the trim, you'll use one you already have. In the top Materials tab in Hypershade, select Door_Blinn. Duplicate the material (hotkey: Ctrl+d), and change its name to Trim_Blinn.
Normally, you'd use the Attribute Editor to change values for the material, but this time try using the Channel Box. When a material is selected in Hypershade, its default attributes appear in the Channel Box (just as with any other object in Maya). Under Trim_Blinn in the Channel Box, change the material's color by entering values in the three text boxes for red, green, and blue: Set Color R to 0.4, Color G to 0.35, and Color B to 0.25, as shown in Figure 8.12. The material will become a darker brown, varying slightly from the original Door_Blinn.
Figure 8.12 The Channel Box is an alternative to the Attribute Editor when modifying materials.
Next you need to apply the material to the window's trim. Click on one of the window's Window_Frame trim that borders the window, and assign Trim_Blinn to the selection. The wood trim intersecting the window needs to have the material applied. In the Outliner, expand the Windows group. Under either window, select Window_CrossH and Window_CrossV, and assign the material to them. Do this for both windows.
Now that you've finished the base materials for the windows, hide the WindowsL layer, and save the scene.
Tutorial: Creating the Remaining Base Materials
So far you've been creating a material and then immediately applying it to a designated object. That workflow method is fine when you're trying to get materials tweaked and have the details and attributes ready for specification. In this tutorial, though, you'll see how to speed up your workflow to create the rest of the base materials and assign them to the house. You need to create base materials for the following portions of the house:
On the CD
Vertical porch rails
Horizontal porch rails
Chimney pipe at top
On the CD
Because you're just creating materials, you don't need to have the other viewports visible. With the Hypershade view active, tap the spacebar to maximize it. Increasing the workspace can help improve your productivity. You can start where you left off with the preceding tutorial or load the scene from the CD-ROM.
You can also hide the UI (user interface) to further increase the workspace (Display | UI Elements | Hide UI Elements). This removes everything from the Status Bar to the Help Line. You can turn the interface back on by selecting Restore UI Elements instead of Hide UI Elements.
The porch needs two separate materials for the vertical and horizontal beams on the porch. Select Trim_Blinn in the top Materials tab in Hypershade and duplicate it twice. Name Trim_Blinn1 as VertPorchRail_Blinn. Change the name of Trim_Blinn2 to HorizPorchRail_Blinn. That's all you need to do for the rails right now.
The house's walls are next. Create a PhongE surface material by selecting PhongE from the Create Materials Bar. Name the new material Foundation_PhongE. The foundation will have a wet look, so PhongE is a good material to start with. Next, create a new Blinn material and name it Walls_Blinn.
Open the Attribute Editor for Foundation_PhongE. Under the Common Material Attributes section, click the swatch next to Color to set the value in the Color Chooser (HSV: 65, 0.45, 0.35), and click Accept. Next, decrease Diffuse to 0.7. Continuing down to the Specular Shading section, increase Roughness to 0.810, decrease Highlight Size to 0.15, and set Reflectivity to 0. Finally, click the color swatch for Whiteness to set the value in the Color Chooser (HSV: 270, 0.010, 0.2), and click Accept.
Next, select Walls_Blinn in the top Materials tab in Hypershade. In the Channel Box (press Shift+C if it's not open), set Color R to 0.9, Color G to 0.68, and Color B to 0.4. You should have a brownish-orange color for the material.
Next, you'll create a Lambert material for the chimney. The chimney is made up of brick, which usually doesn't have any highlights, so Lambert is the perfect material candidate. With the new Lambert material selected (lambert2), change the name to ChimneyBase_Lambert. Then duplicate the material, naming the duplicate ChimneyPipe_Lambert. Select ChimneyBase_Lambert in the top Materials tab. Open the Attribute Editor, use the Color Chooser to set the material's color to dull red (HSV: 0, 0.6, 0.5), and click Accept. In the Attribute Editor, click on ChimneyPipe_Lambert in the Materials tab, set its Color attribute (HSV: 0, 0.4, 0.5), and click Accept.
The last base material you need to create is for the roof. You haven't used a Phong material yet, and the roof would look good with a mossy wet material, so create a Phong material and name it Roof_Phong. In the Channel Box, change the material's color by setting Color R to 0.34, Color G to 0.312, and Color B to 0.102, which results in a dark brownish-green color.
The Work Area bottom tab is cluttered with material nodes at this point and should be rearranged. RMB-click a blank space in the Work Area, and choose Graph | Rearrange Graph from Hypershade's menu to organize all visible materials in the Work Area.
You have now set the foundation for the materials in your scene, and can continue to apply these new materials to the corresponding objects in your scene. If you haven't saved your scene, now would be a good time because you have created quite a few materials. Your Hypershade should have all the materials shown in Figure 8.13.
Figure 8.13 The base materials you will build on for the scene.
Next, you'll assign the materials you've created to your scene objects. To make it easier, switch to a predefined saved layout (Hotbox | Panels | Saved Layouts | Hypershade/Outliner/Persp). The Outliner makes it easier to select specific components, and having it open in a viewport eliminates clutter. In Hypershade, click the Show Top Tabs Only button (refer back to Figure 8.1 to see where this button is) because you don't need to see the Work Area now. For more space, hide the Create Bar by clicking the Show/Hide Create Bar button. Last, hide the UI elements in the scene (Hotbox | Display | UI Elements | Hide UI Elements). Keep the Channel Box visible (hotkey: Shift+C) so that you can easily work with the layers in the house. Your interface should now be set up to efficiently assign the remaining materials to objects (see Figure 8.14).
In the Outliner, all the scene elements are grouped under Old_House. Display all the layers in the scene. To assign a material to the house's outer walls, in the Outliner, select OuterWall and assign Walls_Blinn. You should see the green wireframe of the outer walls, indicating that they're selected. In Hypershade, RMB-click on Walls_Blinn and choose Assign Material to Selection. With the Perspective view active, press 7 to make sure textures are hardware-rendered for viewing and lighting.
Select Foundation in the Outliner. RMB-click on Foundation_PhongE and choose Assign Material to Selection. The outer walls of the house now have their base material assigned.
Select Chimney, and assign ChimneyBase_Lambert to it. Under the Chimney group in the Outliner, select Chimney_Top and assign ChimneyPipe_Lambert. Even though the material for the chimney's base had been assigned to the pipe, it had no affect on new materials being applied, which immediately override the object's existing material.
Figure 8.14 By using Hypershade, the Outliner, and Perspective view, you can easily assign materials to objects in your scene.
Expand the Roof group in the Outliner. Under RoofSide, select RoofSlab, and assign Trim_Blinn to it. Shingles should also be located in this group. Assign Roof_Phong to Shingles. Next, assign Trim_Blinn to RoofSlab in RoofSide1 and Roof_Phong to the Shingles in RoofSide1.
Close the topmost Roof parent in the Outliner. Hide the RoofL layer and save your scene.
The final base materials need to be assigned to the porch before you're ready to move on to texture mapping. Using the Outliner, select the three box objects that make the trim of the porch floor and assign Trim_Blinn to them. Select the horizontal parts of the porch rails, along with the stairs and the porch floor, and assign HorizPorchRail_Blinn to these. Now select the vertical elements of the porch, including the poles, the porch legs, and rail bars, and assign VertPorchRail_Blinn to these.
You have finished applying base materials to objects in your scene; in the following section, you'll learn how to add more detail to your textures. Hide the PorchL layer, and save your scene as usual.
If you got stuck in this tutorial, load the file ch08tut03end.mb, which contains the finished scene for this tutorial.
On the CD