CAP 211 - Interactive Design and Game Development

Mastering Unreal Technology, Chapter 5


This lesson discusses meshes, and returns to 3DS Max to create them. Objectives important to this lesson:

  1. Static meshes
  2. UV mapping
  3. Textures
  4. Importing meshes
  5. Collision meshes
  6. Shadow map channel

Chapter 5 contains exercises for creating a mesh in 3DS Max that will be used in an Unreal level. Note that the instructions were written for a previous version of 3DS Max. Some of the steps in the text will need to be modified for our current version of the software.

The chapter begins with a discussion that comes down to deciding how detailed the meshes you create need to be. Two methods are described, one beginning with a high polygon count mesh and the other beginning with a low polygon count mesh.

  • In the first method, you can begin with lots of detail on your mesh object, create a normal map from it, and use that map on a low polygon mesh to make it look more detailed.
  • In the second method, you can begin with a low polygon mesh, and create the detail as a texture in Photoshop (or other program), then apply the texture to the model.

Both methods continue with importing the mesh into Unreal Editor, then creating a material and applying it. If needed, a collision hull is created. Finally, the mesh is added to a level.

Tutorial 5.1: Create the box/poly

This tutorial begins on page 172. It should be easy for you now.

  1. Create a box with the Keyboard Entry method, as described in the first two steps: 256 long, 16 wide, and 256 high. You will not see the box clearly in any of the viewports, so make it easy on yourself by clicking the Zoom Extents All button, which will center the selected object in all viewports. The button is indicated by the mouse pointer in the image on the right.
  2. Convert the box to an Editable Poly.
  3. Name the box and save the scene.

Tutorial 5.2: Shaping the poly

This tutorial begins on page 176. The pictures are a little hard to follow.

  1. Begin with the file saved above. Select the object, then select Polygon subobject mode.
  2. Select the "large polys" on both sides of the object. In the image on the right, I have created a yellow box, converted it to an Editable Poly, and selected the two largest polygons in the figure. (I had to orbit the scene to select the one on the back side of the object.)
  3. Inset the two selected polygons by 32, as instructed. Mouse over the image on the right to see what it should look like.
  4. The text tells you to select the two inset polygons. They should still be selected from the step above, but select them if you have clicked off the object
    You are also told to ctrl-click three more polygons: the one below the inset square on each side of the figure, and the one on the very bottom of the figure.
    Use the View Cube (the scene rotation gizmo in the corner of the viewport) to make selecting the these polygons possible. (In the next image, all five of those polygons have been deleted. Look at that image to make sure you pick the right ones.)
    The last instruction in this step is to delete the selected polygons.

  5. Change to Vertex subobject mode. Use the Left viewport to marquee-select the vertices indicated in the image on the right. Selecting them with the marquee method will select the indicated vertices on both the front and the back of the figure. You should be able to see three of them turn red in the Perspective viewport.
  6. The text says to press W to select the move tool. (You can just as well click the icon for the Select and Move tool. That would be my preference.)
    The text suggests that you will see values for these vertices in the x, y, and z boxes at the bottom of the interface. Once the Move tool is selected, they should read 0, 0, and 32. Enter 0 in the z box as instructed to straighten out the feet of the arch. (Alternatively, you could just use the move tool and eyeball it, but being precise is much better.)
  7. Change to Edge subobject mode. The text says to marquee-select the five edges of the cutout area in the Left viewport. I do not see how to do this in one move, because a single marquee that touches all of those edges will select the diagonal edges in the upper corners as well. Do it in two moves: marquee select the bottom and inner vertical edges in one sweep, then hold down the control key while marquee-selecting the bottom edge of the horizontal beam. As before, marquee-selecting should select the edges on both sides of the figure.
  8. Click the Bridge button in the Edit Edges rollout to create new polygons that bridge the open edges.
  9. Save incrementally.

Tutorial 5.3: Chamfer and smoothing

This tutorial begins on page 181.

  1. If you closed the scene from the last tutorial, open it, and select Edge subobject mode.
    You are told to select the edges that are located in the inside upper corners of the archway. The location of the left one is indicated by the mouse pointer in the lower right viewport shown on page 181. As should be evident from the picture, but not from the instructions, you will need to use the scene rotation gizmo to be able to see these edges. I recommend rolling the Perspective viewport to see each one in turn, control clicking them to select them.
  2. Follow the instructions to apply a Chamfer of 48 to these two edges.
  3. Switch to Vertex subobject mode. You are told to marquee-select the vertices across the top of the arch. This means the vertices in the uppermost corners of the outside of the figure, the vertices at the top of the horizontal beam. If you have selected the right ones, you will see a screen like figure 5.18 when you click the Settings button for Weld. Complete the weld as instructed.
  4. Turn on the Slice Plane tool. If necessary, rotate the tool to match the orientation shown on page 183. (The tool seems to remember the orientation it had the last time it was used.)
  5. Make cuts as instructed at heights specified on the figure (96 and 72).
  6. The text tells us to use a button that we have never had use for before. Look on the toolbar for the button just to the right of the View dropdown box. In the image on the right, I have opened its rollout feature. This is the Transform Coordinate Center control. The text wants you to select the middle of the three options on the rollout, the Use Selection Center button.
  7. Change to Polygon subobject mode. Examine the picture on page 184. Select the bottom two polygons on the left side of the archway. Try setting their x transform value to 32 as instructed in the text. This may work, or it may deform the arch. If the change goes the wrong way, undo, then set the x value to -32 instead.
    Whichever method worked, spin the scene in the Perspective viewport, then select the two lower polygons on the opposite side of the archway, and transform them with a value that is the negative of the one that worked above.
  8. Switch to Element subobject mode, and select the entire model as instructed.
    Find the Smoothing Groups rollout, near the bottom of the Modify panel. Set the Auto Smooth value to 25, then click the Auto Smooth button as instructed.
  9. Save as instructed.

The text explains that the next tutorial will introduce UV Mapping of the object you have created.

Tutorial 5.4: Creating a UV Map

This tutorial begins on page 186.

  1. Continue with the scene you have created for this chapter. Select the archway object. Use the Modifier list to add a modifier to it: Unwrap UVW. The text does not explain at this point, but I have told you before that UVW stands for the XYZ coordinates of an object whose surface has been unwrapped, or "skinned", and spread out flat.
  2. The Unwrap UVW modifier should be selected. If it is not, select it. Find and click the Edit button in the Parameter rollout of this modifier.
  3. The text explains that what follows is a quick method for creating a UV layout for your object.
    Find and click the Faces button in the lower panel of the editor screen. (When you hover over the button in 3DS 2010, the popup hint says "Face Sub-object Mode".) Rather than dragging a marquee around everything in the window, follow the alternate method in the text: press ctrl-a to select all.
  4. Open the editor window's Mapping menu, and select Flatten Mapping.
    Apply the settings in the text.
  5. Put a check in the Select Element checkbox, which is just below the three Selection Mode buttons.
    Follow the direction in the text to click various faces in the editor and confirm what part of the model they correspond to. (The parts of the model will be selected as well, each time you click a face in the UVW editor.) It is important to do this because you will be moving the faces in the editor, and may lose track of which face is which.
  6. Typo: the book says to look for transform buttons in the upper right corner of the editor window. They are in the upper left corner, below the menu bar. You will use the move, rotate, and scale buttons in these exercises.
    Carry out the steps in this sequence to move and stack shapes that will have the same textures mapped to them. It makes the template less complicated to realize that the front of the arch and the back of the arch will look the same, as will each inner side and each outer side.
    Note the tip on page 189 that it is important when stacking pieces that you stack them without any overlap. Only stack pieces that match exactly in this exercise, and make sure they fit exactly.
    When you scale the entire template in the last step, you will not be able to fill the blue square you are working in (the placement square). Just make it as close as you can, but do not overlap the placement square with any of the objects.
  7. Close the editor and save the scene incrementally.

You should review the list of considerations on page 193. The authors have pointed out several of these ideas in the exercise above, but you will want to be aware of all of them.

Tutorial 5.5: Rendering a UV layout

This tutorial begins on page 193.

  1. Open your scene file from the last exercise. Select the model, its Unwrap UVW modifier, and click the Edit button to open the UVW Editor.
  2. Open the editor's Tools menu, and select Render UVW Template.
  3. A dialog box appears. The text cautions that you should make sure that the width and height values are the same (square image) and that the values are powers of 2, which work much better in Unreal. For those of you unfamiliar with powers of 2:
    Power of 2 Value
    0 1
    1 2
    2 4
    3 8
    4 16
    5 32
    6 64
    7 128
    8 256
    9 512
    10 1024
    11 2048
    12 4096

  4. The text informs us that the highest power of 2 we will normally need is 2048 (2 to the 11th power), and that we should use the default value of 1024 this time.
  5. Click the Render UV Template button.
  6. A Quick Render window opens. The image in it will appear damaged. Don't worry, it probably is fine, just displayed badly. Click the Save Image icon on the tool bar (looks like a 3.5 inch floppy disk, which is starting to become an unfamiliar image to users), and pick a file format, a name, and a location to save the file. Save the file, and remember where it is and what it is named.

The text provides four textures to use with this model. They are shown on page 197, and they are saved on the disc for the class as an Unreal package file.

The next tutorial explains taking your model from 3Ds Max to the Unreal Editor.

Tutorial 5.6: Exporting a mesh from 3DS Max, importing into Unreal Editor

This tutorial begins on page 198.

  1. Open the saved file from the last exercise. Follow the instructions to right-click the Unwrap UVW modifier and choose Collapse All. Note: this action makes a smaller 3DS Max scene file, but it prevents you from making changes to any objects that were in the modifier stack.
  2. Select the mesh/poly object. Open the Application menu in 3DS Max 2010 (File menu in earlier versions), and select Export Selected.
    Follow directions to select the ASE file format, to name the file, to note its location, and to save it. As described in the text, there is one more step: to confirm that all required options are checked in the ASCII Export window. Mesh Definition, Materials, and Geometric are probably checked already. You will probably have to check the boxes for Mesh Normals and Mapping Coordinates.
  3. Click OK to finally save an ASCII version of the scene file. Close 3DS Max.
  4. Open Unreal Editor. The Generic Browser should open automatically.
  5. In the Generic Browser, open the File menu, choose Import, and open the ASE file saved above.
    Enter the three parameters given in the text. Ignore the warning about materials.
  6. The text is unclear in this step. Find the MyStaticMesh package that you just made in the long vertical list on the left side of the browser window. Click it, and the browser should show the doorway mesh in the large blank panel, as shown on page 199. The asterisk by the name of the package indicates it has not been saved yet.
    Open the File menu for the browser and save the currently displayed package. I used Save As, and it saved in the same folder that the ASE file is stored in.

Tutorial 5.7: Static mesh editor

This tutorial begins on page 200.

  1. Begin by opening Unreal Editor. In the Generic Browser, open Chapter_05_StaticMesh.upk. This instruction is in the paragraph above the first step in the tutorial.
    Find the mesh indicated in the text and double-click it. It will appear in the Static Mesh Editor. It is subtitled NO COLLISION MODEL.
  2. The instructions in the text are slightly off for our version of Unreal Editor. Twirl open LODInfo, [0]. Elements, [0], and choose Material.

    The material named in the text is not in the package. In the browser, select mat_arched_doorway. Click the Use Selection in Browser button in the Mesh Editor.
    Note: this material is already used on this mesh. If you want to see it applied, click the Clear All Text button (the square one to the right of the magnifying glass) and repeat this step.
  3. Drag in the Mesh Editor to spin and zoom the mesh. It moves very easily. Choose a new position for it that shows off the texture well. Click the Eyeball icon in its icon bar to save a new thumbnail image.
  4. Close the Mesh Editor. Click File, Save As on the browser menu bar. Put your initials in the package name and save it. The program may refuse to save it in the default location. If so, it will volunteer to save in a different folder. Note that folder's location.

The chapter continues with a lesson about collisions. As you should know from another class, a collision mesh, or collision model, is a shape that encloses an actual mesh. The text compares it to a force field that prevents actors from passing through it (page 202). When you think about that, remember that the Unreal Engine and the text consider any object in the game to be an actor.

A collision model is more than that. It acts as a trigger for events that should occur when particular kinds of objects collide with it. For example, you may want different events to occur when a player collides with the mesh and when a non-player character (NPC) collides with the mesh.

The text explains that you will use the Static Mesh Editor to apply collision models to your meshes. It introduces some new terms:

  • DOP - discrete oriented polytope. Unfortunately, the word polytope has several mathematical definitions that are not all compatible. In this context, it means a surface of a polyhedron, one of the surfaces of the collision model.
  • 6-DOP - a collision model with six faces, forming a solid cube or rectangle, called a box in the text
  • 10-DOP - a 6-DOP that has had the edges on one axis beveled
  • 18-DOP - a 6-DOP that has had all of its edges beveled
  • 26-DOP - a 6-DOP that has had all edges and all vertices beveled

As with other objects in the game world, fewer polygons in a collision model are desirable, but not always attainable.

Tutorial 5.8: Creating collision surfaces (first collision mesh)

This tutorial begins on page 203.

  1. Open the package you saved at the end of tutorial 5.7. Double-click the sm_archedDoorway_collisions mesh.
    Follow the instructions in the text to see a 6-DOP collision mesh applied to the arch.
  2. Follow the instructions in the text to change the collision mesh to a 10-DOP-Z model. Note that the visual for the model does not change. As the text explains, the editor automatically simplifies collision models. Your ten surface box was automatically simplified to a six surface box.
  3. Follow the instructions to change the collision mesh again to an Auto Convex Collision model. Set the parameters as indicated on page 204. The collision model will now understand that the arch is not a solid box. Note, however, that we now have a set of related meshes and a set of related collision meshes. (More on this in a minute.)
  4. Close the editor and save your package again.

The chapter turns to custom collisions. As noted earlier in the text, the simplified collision models that the Static Mesh Editor makes are not always what you need.

The text also introduces the idea that a collision boundary has to be convex, not concave. This begs a definition of each term. The one in the book is okay, but you need a rule that works three dimensionally:

  • Think of a sphere. You can connect any point in or on the sphere to any other point in or on the sphere with a straight line that does not leave the sphere. This makes it convex. The same test works for a cube, so to 3DS Max, a cube is convex as well.
  • Think of a bowl. There are many points in and on the bowl that, when connected by straight lines, the line is outside the the body of the bowl. For instance, consider the points on the rim of the bowl connected by the arrow in the image on the right. The arrow goes through open space that is not part of the bowl. This makes the bowl concave. Even one instance of a line outside the body of the object is enough to make the body concave by this definition.

Well, darn. We will want to use objects that are concave. How do we get a valid collision mesh for them?

By these definitions, our archway model is concave, and we have already been told that a collision mesh must be convex. This is why the archway mesh was broken into a logical set of meshes in the last exercise, so that they could each be given a convex collision mesh, and the overall shape of the arch could be maintained. Let's say that again: the concave object was broken into a set of convex objects that could each be given a convex collision mesh.

Before starting the next tutorial, the text informs us that collision models must be named with specific prefixes for the Unreal Editor to use them. Note the short list on the bottom of page 205.

Tutorial 5.9: Creating custom collision surfaces, part 1

This tutorial begins on page 206.

  • Follow the instructions in the text to open a file, copy an object, and to slice up the object. The lesson shows the use of the slice plane tool to cut the archway into pieces.
  • What it does not show is how to decide where to make the cuts. For that, you need to understand the definitions above. You need to imagine what the pieces of the object should look like, or experiment with some cuts, proceeding or undoing as needed to make pieces that are sufficiently not concave.
  • Note, for example, that each of the seven pieces that comprise your new archway satisfy the definition of convex. Had you not made the second horizontal cut, this would not be so.
  • At the end of the tutorial, save the file as instructed, but do not close 3Ds Max. Continue with the next tutorial.

Tutorial 5.10: Creating custom collision surfaces, part 2

This tutorial begins on page 209.

  1. Follow the instructions to separate the lower left foot of the divided archway. It is important that you name it as instructed in the text.
  2. Separate the remaining pieces of the archway, again naming them as instructed.
  3. Select each piece of the archway, and cap the borders as instructed. (Ignore the illustration on page 210. It is not informative.)
  4. Hide the frozen object (the original archway) as instructed. Delete the right leg, left leg, and center beam objects as instructed. (Look at the illustration on page 211: these are the pieces not to delete.) Adjust the location of the polygons as instructed in sub-steps C and D. In sub-step F, it is easier if you set the y-value of each selected polygon to 0 in the Coordinate Entry area instead of using the spinner.
  5. The text tells you how to test convexivity in this step. There is little point. The four remaining pieces are convex, but the seven original pieces were as well.
  6. Unfreeze all objects, and unhide all objects as well.
  7. Marquee select all objects, or use the Select From Scene feature to select all objects. The second method is preferable, since it allows you to check for any leftover objects in the scene. Export the objects to ASE format. Make sure you know the name and location of the file you save.
  8. Close 3DS Max, and open Unreal Editor. Click File, Import in the browser. Use the settings in the text to import the ASE file you just made. Open the StaticMeshImport package, and the Meshes group. Double-click the only mesh in that group, and click the Show Collision button in the Static Mesh Editor. You should see your archway and your custom collision model.
  9. Save as instructed.

Three lessons left in the chapter. In the next one, you add a mesh to a level and add a texture to it. Some observations about adding meshes:

  • Using a single mesh several times in a level uses less memory than using the same number of different meshes in a level.
  • Static meshes should be used for most of a level's physical detail.
  • Plan your levels. Random placement of meshes will not work well.
  • The same mesh can serve a new purpose if it is rotated, scaled, or both.

Tutorial 5.11: Placing and adjusting meshes in a level

This tutorial begins on page 214.

  1. Open Unreal Editor, and open the the level and package specified on page 214. Insert the arched doorway indicated in step 1. Practice moving, rotating, and scaling the archway.
  2. Use the alt-drag method to make duplicates of the archway. Arrange them in a visually interesting but playable way. Consider that you will need cover in the level when other characters are shooting at you.
  3. Choose one of your archways, and press F4. Drill down to StaticMeshActor and StaticMeshComponent.
  4. Open the Materials property and click the Add New button.
  5. Select the material specified in the text and click the Use Current Selection button.
  6. Use the Play From Here feature to check movement in your level. Adjust placement of the archways as needed. Save the level with a new name.

The chapter reminds us that we are working with static, unmoving meshes at this point, which means we can set up light and shadows that will not change dynamically. In the next two lessons, you add a new UV map channel in 3DS Max to an object that will be used for shadows, and then you use it in Unreal Editor.

Tutorial 5.12: A second UV Channel for shadow maps

This tutorial begins on page 217.

  1. Run 3DS Max and open the file specified at the top of page 217. Note that this version of the archway has a collision model, but it has not been simplified.
    Press the H key as instructed and select the archedDoorway (unsliced) object.
  2. Open the Modify panel and confirm that the correct object has been selected.
    Open the Modifier list, and add an Unwrap UVW modifier to the object.
    The text says to refer to the figure on page 217 to see how to set the Map Channel to 2. The picture in the text is not clear enough to see any detail. Look at the image on the right instead. Look for the Parameters rollout, Channel section, and increment the value from 1 to 2.
  3. Click the Edit button to open the Edit UVWs window, which you have seen before. Turn on Face Sub-object mode. (Under Selection Modes.)
  4. In the Edit UVWs window, marquee select all faces. They will turn red in the Edit window and in the Perspective window. Open the Mapping menu and click Flatten Mapping. A dialog box will appear: in it, change Face Angle Threshold to 50, and click OK. The faces will rearrange in the Edit window.
  5. Close the Edit window. Collapse the modifier stack as instructed.
  6. Marquee select all objects, or select them all from the Select From Scene dialog box.
    Export them to an ASE file with the name given in the text. Make sure you know where this file is, since you will need it in the next tutorial.

Tutorial 5.13: Activating the second shadow maps channel

This tutorial begins on page 218.

  1. Close 3DS Max, and open Unreal Editor. Open the package specified on page 218, then open the level map specified.
    As an aside, I accidentally hid my static meshes at this point, while typing these instructions. The key that toggles static mesh visibility on and off is W. It only affects the currently selected viewport in the Unreal Editor. (What's W for? "Wook, it's not thewe, Wabbit"?)
    As noted in the text, this scene has an archway and a column in it. The column should be casting a shadow on the archway, but it is not doing so.
  2. In the browser, import the ASE file made in the lesson above, using the settings on page 219. You will get a warning for each element in the file that does not have a material applied to it. Just click through them.
  3. Find the new mesh in the browser and double-click it to open the Mesh Editor. Set the properties as instructed in the text and read the sidebar about those properties.
    Close the Mesh Editor and save the package in the browser.
  4. Review tutorial 5.7. Use the procedure in that tutorial to apply the specified material to the new mesh.
  5. Remove the archway mesh that is in the scene already. Replace it with the new mesh. Do not line it up with the existing shadows in the scene, but place it so that the shadow of the column will fall on it. (It won't be visible yet.)
  6. Open the properties of the new archway with a double-click. Find the property specified in the text and remove the check mark from its box. Close the properties window.
  7. Open the Build menu and click Lighting.
  8. Save the level map.