Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
3ds Max 6 Bible (2004).pdf
Скачиваний:
55
Добавлен:
17.08.2013
Размер:
50.02 Mб
Скачать

Chapter 21 Creating Advanced Multi-Layer Materials

597

Figure 21-9: Cartooning made easy with the Ink ‘n’ Paint material

Using the DirectX 9 Shader

The Material Editor includes support for DirectX 9 shaders using the DirectX 9 Shader material. These shaders are saved as .fx files and will be available only if the Direct3D display driver is enabled.

New

Support for DirectX 9 shaders in new in 3ds max 6.

Feature

 

In the 3dsmax6/maps/fx directory are several example DirectX 9 shaders. You can load these example shaders using the button in the DirectX 9 Shader rollout. The available parameters are different for each shader.

Applying Multiple Materials

Most complex models are divided into multiple parts, each distinguished by the material type that is applied to it. For example, a car model would be separated into windows, tires, and the body, so that each part could have a unique material applied to it.

598 Part IV Materials and Maps

Using material IDs

You may sometimes want to apply multiple materials to a single part. Selecting subobject areas and using material IDs can help you accomplish this task.

Many of the standard primitives have material IDs automatically assigned — spheres get a single material ID, whereas boxes get six (one for each side) and cylinders get three (one for the cylinder and one for each end cap). In addition to the standard primitives, you can assign material IDs to Editable Mesh objects. You can also assign these material IDs to any object or subobject using the Material modifier. These material IDs correspond to the various materials specified in the Multi/Sub-Object material.

Note Don’t confuse these material IDs with the material effect IDs, which are selected using the Material Effect flyout buttons under the sample slots. Material IDs are used only with the Multi/Sub-Object material type, whereas the effect IDs are used with the Render Effects and Video Post dialog boxes for adding effects such as glows to a material.

Tutorial: Mapping die faces

As an example of mapping multiple materials to a single object, consider a die. Splitting the cube object that makes up the die into several different parts wouldn’t make sense, so we’ll use the Multi/Sub-Object material instead.

To create a die model, follow these steps:

1.Open the Pair of dice.max file from the Chap 21 directory on the CD-ROM.

This file contains two simple cube primitives that represent a pair of dice. I also used Adobe Photoshop and created six images with the dots of a die on them. All of these images are the same size.

2.Open the Material Editor, and select the first sample slot. Name the material Die Faces, and click the Type button. Select the Multi/Sub-Object material from the Material/Map Browser. In the dialog box that opens, select to discard the current map and click OK.

3.In the Multi/Sub-Object Basic Parameters rollout, click the Set Number button and enter a value of 6.

4.Name the first material face 1, and click the material button to open the parameter rollouts for the first material. Then click the map button to the right of the Diffuse color swatch to open the Material/Map Browser, and double-click the Bitmap map. In the Select Bitmap Image File dialog box, choose the dieface1.tif image from the Chap 21 directory on the CD-ROM and click Open.

5.Back in the Material Editor, click the Go to Parent button twice to return to the Multi/Sub-Object Basic Parameters rollout and repeat Step 4 for each of the die faces.

6.When the Multi/Sub-Object material is defined, select the cube object and click the Assign Material to Selection button.

Note

Because the cube object used in this example is a box primitive, we didn’t need to assign the

 

material IDs to different subobject selections. The box primitive automatically assigned a dif-

 

ferent material ID to each face of the cube. When material IDs do need to be assigned, you

 

can specify them in the Surface Properties rollout for editable meshes.

Chapter 21 Creating Advanced Multi-Layer Materials

599

Figure 21-10 shows a rendered image of two dice being rolled.

Caution

The Multi/Sub-Object material is not visible in the viewport and can be seen only in the ren-

 

 

dered image. You can use the ActiveShade window to view the results before rendering the

 

 

final image.

 

 

 

 

 

 

 

 

Figure 21-10: These dice have different bitmaps applied to each face.

Using the Clean MultiMaterial utility

All compound materials have submaterials that are used to add layers of detail to the material, but if these submaterials aren’t used they can take up memory and disk space. You can locate and eliminate unused submaterials in the scene using the Clean MultiMaterial utility. This utility can be accessed from the Utility panel or from the Utilities menu in the Material Editor. For example, if you create a Multi/Sub-Object material with seven submaterials, but later as you are modeling find that you need only five, two submaterials are not needed and can be cleaned.

Clicking the Find All button finds all submaterials that aren’t used and presents them in a list where you can select the ones to clean.

600 Part IV Materials and Maps

Material Modifiers

Of the many available modifiers, most modifiers change the geometry of an object, but several work specifically with materials and maps, including the Material, MaterialByElement, UVW Map, UVW XForm, Unwrap UVW, and Vertex Paint modifiers. In this section, you get a chance to use several material-specific modifiers in a variety of tutorials. The Surface modifiers set includes several modifiers for working with materials.

Cross-

Find out more about the modifiers that apply to maps in Chapter 22, “Adding Material Details

Reference

with Maps.” Another common texture-applying technique uses the Vertex Paint modifier,

 

 

which is covered in Chapter 50, “Max and Games.”

Material modifier

The Material modifier lets you change the material ID of an object. The only parameter for this modifier is the Material ID. When you select a subobject and apply this modifier, the material ID is applied only to the subobject selection. This modifier is used in conjunction with the Multi/Sub-Object Material type to create a single object with multiple materials.

Material By Element modifier

The Material By Element modifier enables you to change material IDs randomly. You can apply this modifier to an object with several elements, such as a group of spheres attached as a single mesh object. The object needs to have the Multi/Sub-Object material applied to it.

The parameters for this modifier can be set to assign material IDs randomly with the Random Distribution option, or according to a desired Frequency. The ID Count is the minimum number of material IDs to use. You can specify the percentage of each ID to use in the fields under the List Frequency option. The Seed option alters the randomness of the materials.

Tutorial: Creating random marquee lights with the MaterialByElement modifier

The MaterialByElement modifier enables you to change material IDs randomly. In this tutorial, we reproduce the effect of lights randomly turning a marquee on and off by using the Multi/Sub-Object material together with the MaterialByElement modifier.

To create a randomly lighted marquee, follow these steps:

1.Open the Marquee Lights.max file from the Chap 21 directory on the CD-ROM.

This file includes some text displayed on a rectangular object surrounded by spheres that represent lights.

2.Open the Material Editor, and select the first sample slot. Then click the Type button, and select the Multi/Sub-Object material from the Material/Map Browser. Select to discard the current material, and click OK. Give the material the name Random Lights.

Chapter 21 Creating Advanced Multi-Layer Materials

601

3.In the Multi/Sub-Object Basic Parameters rollout, click the Set Number button and change its value to 2. Then click the Material 1 button, and in the Material name field, give the material the name Light On. Set the Diffuse color to yellow and SelfIllumination to yellow. Then click the Go Forward to Sibling button to access the second material.

4.Name the second material Light Off, and select a gray Diffuse color. Then click the Go to Parent button to return to the Multi/Sub-Object material.

5.Select all the spheres, and click the Assign Material to Selection button to assign the material to the spheres.

6.With all the spheres selected, open the Modify panel and select the MaterialByElement modifier from the Modifier List drop-down list. In the Parameters rollout, select the Random Distribution option and set the ID Count to 2.

Figure 21-11 shows the marquee with its random lights. (I’ve always wanted to see my name in lights!)

Figure 21-11: This marquee is randomly lighted, thanks to the MaterialByElement modifier.