### CAP 202 - Computer Animation II

#### Lesson 3 - Chapter 5

##### Objectives:

This lesson describes the creation of objects to use in an urban environment game. Objectives important to this lesson:

1. Planning required objects
2. Approaches to creating the environment
3. Game grid
4. Size of the character, the props, and motion
5. Common measurements
6. Modeling a street
7. Modeling a repeating building
8. Landmarks
9. Props
##### Concepts:

We continue with Chapter 5 of the text (page 105) to get back into using 3DS Max. The objective stated on page 105 is to create an urban environment that can be customized for most games in this kind of setting.

The author begins with a list of categories of objects that you need to create for this project:

• base streets (a set of objects to construct various streets)
• repeating buildings (to be reused as needed)
• landmark structures (unique buildings)
• props and decorations (things to make the scene look more real)

The author reviews three approaches to creating an environment:

• modular - creating objects that will fit on a grid
• free-form - creating objects to be placed anywhere you like
• hybrid - combining both concepts, such as using a grid for the basic city and placing bridges, ramps, and other pieces as desired to enhance game play

On page 109, the author discusses blocking the game level you are designing. He means this in the sense of blocking a theatrical scene: establishing what must go where on our stage. He also means that he wants to throw up the basic structures that the level requires to test them before you dress them in textures. To set up for this, he tells you to start with the modular approach above, establishing a grid for the streets, buildings, and other objects in the level.

To understand the grid system the author proposes, consider the illustration on page 112. He shows us a cube that is 512 units on each side, as seen in his 3D modeling program (on the left side of the illustration) and in his 3D game editor (on the right). He is also showing us that he made a 512 by 512 2D art asset to be mapped onto the cube (indicated in the middle of the illustration). His point is that we should be working with the same units in all our applications from the start, so we do not have objects that need to be scaled, and art that becomes deformed and unusable. This becomes clearer if you skip ahead to the chart at the top of page 118. Here, the author has assigned consistent measurements to the game grid, based on powers of 2:

• 16 grid units (gu) = 1 foot
• 32 gu = 2 feet
• 64 gu = 4 feet
• 128 gu = 8 feet
• 256 gu = 16 feet
• 512 gu = 32 feet
• 1024 gu = 64 feet
• 2048 gu = 128 feet

This scale table is more useful to consider before considering the ideas on pages 114 and 115. The author tells us that we must determine the distances that apply to character movement, to the space taken up in different poses, to the effective range of weapons (if any), and to the size of props and stage dressing in a scene. It will be easier to assign the real world size to our game events and objects if we already know the equivalent game grid units to use in construction.

His list of common measurements to know (some of which are illustrated on page 117):

• character height (standing, crouching, crawling) - may vary for each character
• step height - can mean two things: how high are risers on stairs, or how high does the character lift a foot when walking
• walk speed - distance covered per time unit
• run speed - distance covered per time unit
• standing and running jump height - may vary for each character
• ledge height - how high can a ledge be, if we want the character to be able to climb onto it? How high must it be to prevent the character attaining it? What happens if the player gets there anyway?
• weapon ranges - this includes distance based weapons and explosives (How far can you shoot a gun or throw a grenade?)
• weapon collision effective radius - How accurate do we have to be to hit a target? How far away from an exploding grenade must we be to be safe?
• effective radius for sounds - What can we hear, at what volume level, at what distance?

The author advises us that, contrary to ideas just presented, you will want to create some things that are not to real world scale. Doorways, for example, are usually made taller than in real life. In the illustration on page 117, the character is shown as about 6 feet tall, but the doorway next to her may be eight and a half feet tall. This is often done in games because it looks better. You can learn a lot from looking at existing games.

Exercise 3: Measurements
Part 1: Look for videos of game play online. Pause as needed to examine the size of various structural things: doorways, stairs, windows, and ceilings. (Assume that the character in each case is about six feet tall.) Write down your estimate of how high each of those things were made, in what game, and whether you would make them a different size if you were working on that game.
Part 2: Look at the list of common measurements above. Has it occurred to you that it addresses a first person shooter better than the driving game the author wants to make? Think about what you might need to know the measurements for in a driving game, and give me three new ones that are not discussed in this chapter, along with your proposal for the measurements we should use. Stay consistent with the measurements that are given in the text.

The author starts warming up to using his 3D modeling tool in the following pages. Stay with him, as he will give you lots to do shortly. He provides dimensions for some of his street modules on page 118. The street module shown on page 119 is actually one side of a city street, with a sidewalk attached. Note that he uses a mesh that is a foot thick at the street portion, and two feet thick at the sidewalk portion. The thickness for the street is so that he can put holes in the street as needed. The height of the sidewalk is another exaggeration, which he believes will look good in the game. The overall length and width of the street module are 4096 and 2048 grid units.

This begs a question: how do you set up the grid in 3DS Max to match his powers of 2 scheme? (The information below was found at the site linked in the question.)

1. Choose the Units Setup item on the Customize menu and select Generic Units.
2. Choose the Grid and Snap Settings item on the Tools menu, or right-click on any of the Snap buttons on the toolbar, and on the Grid and Snap Settings dialog, choose the Home Grid tab and set the Grid Spacing to 16 and the Major Line to 8.

This will give you a Max viewport and grid setup that is effectively the same as UnrealEd. So anything you create in Max will be the identical sizing when imported into UnrealEd. You can save this as your Max default or save it to a custom .max file as a template that you load before creating any meshes for UT.

As the author quoted above states, you should save this file as a template, a scene that you open each time you want to work on objects that you will be using in Unreal Tournament. (Let's call it Unreal.max.) This will avoid the problem of overwriting your Max default file, which you are unlikely to be able to do in the Baker classroom/lab environment. The next thing to realize is that you should save with a new name as soon as you open your template scene, so you don't lose it.

Back to the text, why did Mr. Ahearn use a mesh for the street? Take a look at his discussion of making an intersection, illustrated on page 121. If it were not a mesh, he could not have moved the vertices and edges as shown in figure 5-11 to make a street module that ends in a street corner. Note that he has made the corner of the sidewalk rounded in this example. He could just as well have squared the corner of the sidewalk, as he did for the example on page 126. The square method may be easier to texture.

Exercise 4: The First Street Module

1. Begin by opening the unreal.max file. Start with this step for every model you make from this text.
2. The next thing you will want to make is the standard street module shown on page 119. I recommend making a box first: 2048 wide by 4096 long by 16 high. Once it is in the scene, zoom out in the Perspective viewport so you can see it.
3. Turn on the Angle Snap Toggle, and rotate the box to match the orientation on page 119.
4. Take a hint from the illustration and modify the box to have 8 width segments, 16 length segments, and 1 height segment.
5. Right click the box and convert it to an Editable Poly.
6. Switch to Polygon subobject mode. Turn on the switch for Ignore Backfacing.
Select the 32 polygons that represent the sidewalk area. Click the Extrude Settings button, and extrude the group of polygons 16 units. The object should more closely resemble the shape of the illustration on page 119. Check the object in all viewports at this time. If you selected too many or too few polygons, the extrusion will have gone wrong. If so Undo a couple of times and try again.
7. The last change to this basic module is to chamfer the edge of the sidewalk. Use the illustration as reference. The problem with this step is that you can't get a real bullnose corner with a chamfer.
Chamfer the edges to lop off a piece at about 45 degrees.
Make a cylinder to overlap that new surface such that it will act like a rounded edge.
Make sure the cylinder is the right length, the right diameter, and has the right number of sections.
Place it in the right location, and change the diameter as necessary.
Finally, create a Boolean union with the Editable Poly and the new cylinder to create a single Editable Poly out of them. (Why a union instead of attaching them? Look carefully, and you should see the answer.)
8. If you have not done so yet, save this scene with a new name.

Exercise 5: A Street Module with a Corner

There are two ways you may use to create corners for your streets. Choose one.

• Follow the directions in the book, or

Alternate directions:

1. Open the file you saved above. Follow the directions here, for a slightly easier way than the text provided.
2. Copy the standard street module created in the exercise above.
3. Select only the polygons that represent one end of the module, as indicated in the illustration on page 121.
4. Click the Hinge From Edge Settings button.
5. In the dialog box that appears, set the angle to 90.0 and the segments to 8. Click the Pick Hinge button, and select the edge indicated in red on page 121. You should see an extrusion shaped like the second image on page 121. Note: If you followed the instructions above, your extrusion will have more polygons than the author's. If the operation goes badly, click the Cancel button, Undo as necessary and try again. If it goes well, click OK.
6. This is a good time for an incremental save. Do it.
7. Turn off the switch for Ignore Backfacing.
I suggest switching to the Top view, then move vertices as needed to square off the module.
After you have done this, switch to the Bottom view, and do it again with the vertices on the bottom side of the module, if you did not turn off Ignore Backfacing, or if the bottom ones just didn't move.
8. Save this scene with a new name.
9. Repeat the steps above, this time making a corner that curves from the other end of the standard street module.

If you use the method above, you will want to make a left and right corner, which can then be copied, moved, and rotated to create a street that is intersected by another street. (The crossing street will use street modules without the corner adaptation.) This makes three kinds of street modules you will need, so far. Why not four? The standard street module can be used on either side of a street by copying and rotating it.

If you use the method from the book, you will need only one kind of corner and one kind of street segment, but there will be more alignment work with more pieces.

In the illustration on page 122, the author copied just the polygons that would connect one street segment to another, and he pasted them to make a new 2D (so far) object. He then extruded those polygons to a distance of 2048, with 16 length segments. (He could have done this with 16 extrusions.) You will want to save this kind of simplified module (the fourth street module type) for future use. He then applied a bend modifier to the module to create a curve in the street. Think about how you would apply that modifier to make the matching lanes in another simplified street module.

For a couple of pages, the author ponders starting a UV map for the objects so far. He proposes making a UV map guide, as shown on page 123, to apply to objects in our environment. It serves a purpose in this chapter to show that a texture will be deformed if it is stretched, and should be made to tile effectively if it is to be tiled. The author notes that you will use planar mapping for street modules. He leaves this topic to continue modeling.

##### Building modeling

On page 124, the author turns to constructing models of buildings. He calls this section repeated buildings because he plans to make them modular (meshes) and variable, and will also vary their appearance with different textures. Our street segments fit within our grid, and they include sidewalks, so we can make our buildings fill grid squares adjacent to the streets. The author proposes making these buildings from meshes that are 4096 on a side, and slicing the meshes as needed to apply textures to make them look different. This makes a "building" as wide as the length of a street module. This is a bit hard to see on pages 126 and 127, because the grid units have been deformed to show perspective. The author explains that this building module may actually be shown as four buildings on a city block. We can differentiate the sub-structures by slicing the meshes and applying different textures. Lower parts of the meshes will represent the lower floors of the buildings, where the most detail will appear. In the street racing game, the upper parts of the buildings can have less detail with no loss to the player. The author notes that you will use box mapping for these objects. On page 128, there are suggested modeling details to provide variation from one building to another.

The author's next topic is landmarks. He uses this word to mean buildings that are different from all the others because of different structure, texture, or lighting. These are objects that we want to player to notice. On page 129, the author begins a tutorial for making a parking garage. Reference art for this structure is shown on page 130. Illustrations supporting this model continue through page 135.

Exercise 6: The Parking Structure
Part 1: If you have not yet done so, create the basic street modules described in the chapter so far. Use them to lay out a series of streets in a 3DS Max scene.
Part 2: Create the parking garage in the scene, as described in the text, starting on page 129. Use your 3DS Max text as a reference to the techniques to use. Save the scene and show it to me. Do not worry about applying textures to the 3D objects at this time.

Exercise 7: Props
On the street by the parking garage, create and arrange the props shown in the text, starting on page 137 and continuing to page 154.

• Newspaper machine 1
• Bus stop
• Phone booth
• Dumpster
• Trash can
• Mail drop box

This assignment will continue for a couple of weeks, giving you a chance to create the other objects at the end of the chapter. Concentrate on the six objects above for this assignment.