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

Max and Games

Games and max are like bread and butter. Sure, you can put lots of different things on bread, but butter is the most common. A

large majority of games developed nowadays are done with Max. This includes PC games as well as console games for the XBox, Playstation, and Nintendo’s Game Cube.

Discreet is well aware of Max’s position is the game industry and has made several additions to Max specifically for game developers, such as modifiers that can reduce the size of a mesh, the ability to paint vertices, and direct control over channel information.

Low-Res Modeling

Many 3D games require fast real-time scene updates. For these types of games, low-resolution models are necessary. Another common use of 3D models that is growing quickly is on the Web. The bandwidth for objects on the Web also requires that objects are small and simple. Max includes several tools that aid in developing low-res versions of complex models.

Enabling a polygon count

Another way to count the number of polygons used in a single object is with the Polygon Count feature. This feature can be enabled for the active viewport using the keyboard shortcut, 7. The number of faces is displayed directly under the viewport name in the upper-left corner. Pressing the 7 key again makes this count disappear.

The Polygon Counter utility

For game worlds and models intended for the Web, the polygon count is important when figuring out how quickly a scene will load. For example, a model with 2000 polygons takes roughly twice the amount of time to download and display as a model with 1000 polygons.

To accurately determine the number of polygons in a scene, use the Polygon Counter utility. This simple utility, displayed in Figure 50-1, enables you to set a Budget value for the Selected Objects and for All Objects. It also displays the number of polygons and a graph for each. This utility is located in the Utilities panel, and you can open it by clicking the More button and selecting the Polygon Counter utility.

50C H A P T E R

In This Chapter

Modeling for games

Using channels

Using Vertex Paint

Baking textures

1162 Part XIII Max in Action

Figure 50-1: The Polygon Counter utility helps you understand how complex an object or scene is.

The Level of Detail utility

As a scene is animated, some objects are close to the camera and others are far from it. It doesn’t make much sense to render a complex object that is far from the camera. Using the Level of Detail (LOD) utility, you can have Max render a simpler version of a model when it is farther from the camera and a more complex version when it is close to the camera.

Cross- The MultiRes modifier can also create real-time level of detail updates. You can also create Reference characters in low-res and high-res versions. Both these features are covered in Chapter 36,

“Animating Characters.”

To open the utility, click the More button in the Utility panel and select the Level of Detail utility. A single rollout is loaded into the Utility panel, as shown in Figure 50-2. To use this utility, you need to create several versions of an object and group them together. The Create New Set button lets you pick an object group from the viewports. The objects within the group are individually listed in the rollout pane.

If you select a listed object, you can specify the Thresholds in Pixels or as a percentage of the target image. For each listed item, you can specify a minimum and maximum threshold. The Image Output Size values are used to specify the size of the output image, and the different models that will be used are based on the size of the object in the final image. The Display in Viewports option causes the appropriate LOD model to appear in the viewport.

Figure 50-2: The Level of Detail utility (split into two parts) can specify how objects are viewed based on given thresholds.

Chapter 50 Max and Games 1163

Using the MultiRes Modifier

You can use the MultiRes modifier to create lower resolution versions of a mesh object. This modifier (found in the Modifiers Mesh Editing MultiRes menu) is especially useful for creating real-time updated meshes for the gaming market. After it is applied to a mesh object using the Modifier List in the Modify panel, you can set the desired options in the Generation Parameters section of the MultiRes Parameters rollout and click the Generate button to apply the MultiRes solution to the selected object.

The Vertex Merging option maintains continuity between vertices within the mesh. When enabled, vertices within the Threshold value are welded as the mesh is reduced. The Within Mesh option collapses the boundaries of adjacent elements. The Boundary Metric option looks for boundaries where different materials are applied and tries to maintain these boundaries.

Cross-

The MultiRes modifier is similar in function to the Optimize modifier, covered in Chapter 14,

Reference

“Working with Meshes and Polys.”

 

The MultiRes modifier includes a single subobject: Vertex. Using this subobject mode, you can select vertices that you don’t want to change. These selected subobject vertices are not altered if the Maintain Base Vertices option is enabled. The Crease Angle value can be used to maintain sharp edges. If any of the options are changed, you can update the solution by clicking the Generation button again.

After it is generated, you can use the Vertex Percent and Vertex Count spinners to control the mesh complexity. The viewport displays the updated mesh as you change its complexity. The rollout displays the number of vertices and faces. The Max Vertex and Max Face fields are the number of vertices and faces in the original mesh; the Face Count is the current number of faces.

Tutorial: Creating a MultiRes battleship

You can use the Optimize modifier to quickly create the lower resolution models, but the MultiRes modifier offers more functionality and enables you to dynamically dial down the resolution to exactly what you want. In this example, we use the MultiRes modifier on a battleship model created by Viewpoint Datalabs.

To create a MultiRes turtle, follow these steps:

1.Open the Kirov battleship.max file from the Chap 50 directory on the CD-ROM. This file contains a battleship model.

2.With the battleship selected, choose Modifiers Mesh Editing MultiRes from the Modifier List to apply the modifier to the battleship model.

3.In the MultiRes Parameters rollout, enable the Vertex Merging option and set the Threshold to 0.05. Also enable the Boundary Metric and Multiple Vertex Normals options, and set the Crease Angle to 75. Then click the Generate button.

4.Create a copy of the battleship by holding down the Shift key and dragging the battleship to the right. In the Clone Options dialog box that appears, select the Copy option and click OK.

1164 Part XIII Max in Action

5.With the cloned battleship selected, set the Vert Percent to 15.

6.Open the Utilities panel, click the More button, and then double-click the Polygon Counter utility. Select the high-resolution version of the battleship on the left, and note the polygon count at 26,176. Then select the battleship on the right, and notice that the number of faces has dropped to 3,817.

Figure 50-3 shows the results of the MultiRes modifier. If you look close, you can see that the battleship on the right isn’t as smooth, but it still looks pretty good.

Figure 50-3: You can use the MultiRes modifier to dynamically dial back the complexity of a mesh.

Using Channels

When 3D models are used in games, the data for the model is stored in channels. The game engine then knows if it wants to change the color of a group of vertices due to an explosion that has happened, it just looks in the preset channel, finds the vertices it needs, changes the color, and then goes on with the game.

Working with channels is a very efficient way to interface with the gaming engine, but a sloppy game developer can introduce a model to the game engine with all sorts of unneeded or exaggerated channels. If this happens, the game engine could ignore the extra channels and get the wrong information, which could cause your hero to march off into battle without a weapon or worst yet, it could crash the system.

Chapter 50 Max and Games 1165

To prevent problems and to streamline the number of channels that are included with game models, Max includes a Map Channel Info editor that you can use to manipulate the various channel data. This editor, shown in Figure 50-4, can be opened using the Tools Channel Info menu command.

Figure 50-4: The Map Channel Info dialog box lets you edit channel data.

Using the Channel Info dialog box

The Map Channel Info dialog box shows lots of information including the Object Name; its ID; its Channel Name; the number of Vertices, Faces, and Dead Vertices; and its Size. With this information, you can quickly determine which channels are taking up the most space and eliminate them.

New

The Channel Info dialog box is new to 3ds max 6.

Feature

 

All objects include some default channels for mesh, which holds the geometry; vsel, which holds the selected vertices; -2:Alpha, which holds the alpha channel information; -1:Illum, which holds illumination values, and channel 0:vc, which holds vertex color information. Objects also include at least one default map channel (even if it is empty). These channels cannot be deleted.

The interface lets you Copy and Paste selected channels. You can give each channel a name with the Name button. Beneath the Copy button, text appears that lists the information currently copied in the Copy Buffer. Channels can be copied only between channels that have the same number of vertices.

The Clear button clears out the selected channels, but you cannot clear a map channel if there is another map channel above it. The Add button adds a new map channel to the object. Objects can hold as many as 99 map channels. The Clear and Add buttons also apply UVW Mapping Clear or UVW Mapping Add modifiers to the Modifier Stack. The Paste command also adds a modifier. These modifiers are convenient because they can easily be removed or reordered in the Stack. If changes have been made in the Modifier Stack, the Update button reflects these changes in the Map Channel Info dialog box.

The SubComp button shows the channel components if they exist. For example, map channels can be broken into X, Y, and Z components, and other channels like Alpha have R, G, and B components. The Lock button holds the current channels even if another object is selected.