1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu 3D Game Programming All in One- P18 doc

30 263 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Arbitrary Extrusion Arbitrary Extrusion has much in common with Axial Extrusion, except that you extrude your base primitive shapes in whatever directions are necessary. Like Incremental Polygon Construction, this approach to modeling can be seen as similar to sculpting in clay. Machinery lends itself well to modeling with this technique. Topographical Shape Mapping Topographical Shape Mapping is a method usually used to model terrain, like Axial Extrusion often is, except that Topographical Shape Mapping is best suited for automat- ed operations rather than manually modeling. In the geographic sense, topographic data can be obtained from various government and private sources. The data consists of, at a minimum, a coordinate and an altitude for each mapped point on the real terrain's surface. There are various algorithms and many pro- grams available that can read this data from a file and render a 3D view of the terrain in question. The data files come in various formats depending on the agency that produces them: DLG-O, DEM, SDTS, and DRG, to name just a few from that acronymic world. Normally this approach is used in one of the many available Geographic Information Systems (GIS), and there are tools that can convert this data into a format you can use for modeling in games. Hybrids Well, the Hybrid category is the catchall category. Often it is prudent to combine tech- niques in a single model—use the approach that works best for the component being cre- ated. If you find yourself mixing techniques, most likely you will be doing a little bit of Incremental Polygon Construction mixed with many shape primitives or using a few primitives mixed with a great deal of Arbitrary Extrusion. The best point to be made here is that you should use what works best for you in your cur- rent circumstances. The Base Hero Model The technique we are going to use is basically the Shape Primitives approach. We will hand-modify various shape primitives to get the results we want. The kind of model we are going to make is primarily a segmented-mesh model. An alter- native would be a continuous-mesh model. The difference is that in the segmented-mesh model, there are different, distinct objects or meshes for different components in the model, whereas in the continuous-mesh model, the entire model has one large, convolut- ed surface. Our primary segments will be as follows: The Base Hero Model 417 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ■ head ■ torso ■ right leg ■ left leg ■ right arm ■ left arm So that's six segments in all. (A continuous-mesh model would have one segment.) All the leg and arm segments will each have two subsegments. Each segment or subsegment can be thought of as an individual mesh, or submesh. The Head We'll use the Shape Primitives approach to build the head. The keys to successful use of this technique are (1) choose the right primitive and (2) use a primitive with sufficient vertices to do the job. For the head part of the model, we're going to use a cylinder with 12 faces on the tube, stacked 6 segments high. That translates to a 6-stack, 12-slice cylinder, in MilkShape terms. 1. Open MilkShape, create a new document, and set the Point Size to 3 and the Grid to 1ϫ1 in the Preferences dialog box. Save the new file as C:\3DGPAi1\resources\ch14\myhead.ms3d. 2. Create a 6-stack, 12-slice cylinder as depicted in Figure 14.1. Size the cylinder such that the bounds of the cylinder extend from about Ϫ20 to +20 on all three of the axes. 3. Choose Select in Vertex mode and then select the bottom layer of vertices. 4. Scale the selected bottom vertices to 95 percent of original, as depicted in Figure 14.2. 5. Now select the top five rows of vertices, ignoring the bottom two rows, and scale them to 95 percent. 6. Next, scale the top four rows of vertices to 95 percent. 7. Repeat the scaling operation for the top three, then the top two, and finally the top row by itself. You should now have a cylinder with a bit of a bevel at the bot- tom that tapers gently toward the top, as shown in Figure 14.3. Chapter 14 ■ Making a Character Model418 Figure 14.1 The initial cylinder. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 8. Next, shift the top five layers of the cylinder toward the back, so that the rearmost vertices (designated A, high- lighted in black, in Figure 14.4) line up, at the back, with the layer of ver- tices that is second from the bottom (B in Figure 14.4). They don't have to be aligned precisely, but try to get them pretty close, as shown in Figure 14.4. 9. Next, working from the Side view (Top Right viewport), select the bottom six vertices visible in that view (at the right side of the view) and move them down and to the right a bit. Figure 14.5 shows which vertices you want and how far to move them. These ver- tices make up the jaw. 10. Select all the vertices in the model, and scale to 75 percent in the Y-axis only. Do this by typing the value 0.75 into the Y scale box when you have the Scale tool selected and then clicking Scale. tip The view in what MilkShape calls the Left view- port is for us actually the Right view (or Right Side view) located in the upper-right frame, because Torque's coordinate system is oriented differently. It's because of this that I normally use MilkShape with the Show Viewport Cap- tion option under the Window menu turned off , in order to avoid confusing myself. 11. Now, using the same technique of selecting and moving (without doing any scaling) as used in steps 4 to 9 above, shape the model as near as you can get to Figure 14.6. This is the Right Side view (upper right frame). You only need to work in this view, The Base Hero Model 419 Figure 14.2 Selecting the bottom vertices. Figure 14.3 Tapering the cylinder. Figure 14.4 Shifting the layers. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. and no other, and only use the Select and Move tools. Now you can see the head shape taking form in profile, with the nose jutting out. 12. Okay, this next part gets a bit tricky. Using the Right Side view, select the 16 vertices in the lower-left corner (which is the lower back of the head/upper rear neck area), as shown in Figure 14.7. 13. Scale this group of vertices to 80 per- cent by typing 0.8 in the X-axis scale box, and then click Scale. 14. Now select just the nine vertices in the lower left, as shown in Figure 14.8, and scale these to 80 per- cent again. What this does is make the jaw and cranium parts of the head stand out in an exaggerated fashion. By doing the scaling incrementally on the vertices in the region like that, we get a fairly smooth shape. Take a moment to swivel the model around in the 3D view, and you can now see a definite car- toonlike big-jawed, low-browed heroic figure tak- ing shape. Okay, so not all heroes look like that. But we're making a game, right? So make it fun! Now, as cute and lovable as that beetle-browed look is, it's a bit too Cro-Magnon and robotic looking, so we need to tone down the forehead and eyebrow area somewhat. 15. In the Right Side view, in the row of vertices that is second from the top (see Figure 14.9), select the vertex that is the second from the right (in the temple area) by dragging the Selection tool around it. This will have the effect of selecting that vertex and any others that are obscured behind it. There happens to be one more back there, so you will end up with two vertices selected, which you can see by examining the model in other views. Chapter 14 ■ Making a Character Model420 Figure 14.5 Shaping the jaw. Figure 14.6 Shaping the head. Figure 14.7 Back of the head/upper neck. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 16. Drag the ver- tices back (to the left) a few ticks. 17. Switching now to the Front view (upper left frame), scale those two ver- tices by 120 percent in the X-axis. This has the effect of widening the gap between them. (See Figure 14.10.) These steps have the effect of softening the sharp corners, just enough to make the head more organic looking. 18. Still with the Front view, select all the vertices in the top three rows, which is mostly the cranium area, and then incrementally apply 90 percent X- axis and Z-axis scaling to them—as you did ear- lier: top three, then top two, and so on. Figure 14.11 shows the results we are looking for here. 19. If you haven't saved your work recently, do it now. No particular reason, other than it's good practice. We're getting close to finished with the head. 20. Using Figure 14.12 as a guide, select the three ear ver- tices in the Right Side view. 21. Stretch the ear vertices apart by scaling them 170 percent in the X-axis, as shown in Figure 14.13. The Base Hero Model 421 Figure 14.8 The smaller back of the head area. Figure 14.9 The temple vertices. Figure 14.10 Scaling the temple vertices. Figure 14.11 Scaling the cranium. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 22. Now back in the Right Side view, guided by Fig- ure 14.14, select the three columns of vertices at the rear of the head. 23. Drag them forward so that the rightmost column of selected vertices is just behind the unselected column (the fifth column), as shown in Figure 14.15. 24. Next drag the two columns at the back of the head forward, so that you end up with a configu- ration like the one depicted in Figure 14.16. 25. By now, you should be get- ting fairly adept at using the Select, Move, and Scale tools in MilkShape, so I'll give you a little assign- ment: Make the scalp region at the top of the head look like the scalp shown in Figure 14.17, using just these three tools and operating only on the top row of vertices. You will have to work in both the Front and Side views while monitoring your progress in the 3D view. Chapter 14 ■ Making a Character Model422 Figure 14.12 The ear vertices. Figure 14.13 The scaled ear vertices. Figure 14.14 Selecting the three columns of vertices. Figure 14.15 Dragging the vertices forward. Figure 14.16 After dragging the vertices. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 26. Next, use the same techniques to shape the nose and eyes. Figure 14.18 shows which vertices to use to shape the nose. Scale the vertices by 50 percent in the X-axis. 27. Shape the eye-socket vertices shown in Figure 14.19 by scaling to 30 percent in the X-axis. 28. Now, this entire work should exist as one group. Rename that group as "head" in the Groups tab in the toolbox. 29. Save your work as C:\3DGPAi1\ resources\ch14\myhead.ms3d. By saving the head in its own file, you can keep it safely out of the way while you work on the other parts. And there you have it—as you can see in Figure 14.20, steely-eyed, big- jawed, beetle-browed genuine dyed-in-the- wool hero material! The Torso Like the head, the torso will be based on the cylinder shape, but this time we will use two of them and weld them together. 1. If you have the head file still open, leave it open. If you don't have it open, then open it. The Base Hero Model 423 Figure 14.17 Shaping the scalp. Figure 14.18 The nose vertices before scaling. Figure 14.19 The eye-socket vertices after scaling. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 2. Save the file as C:\3DGPAi1\resources\ ch14\mytorso.ms3d. We want to have the head around to use as a sizing guide when we start the torso model, and then we will delete it. 3. Drag the head mesh up until it is three or four grid lines above the model origin (the 0,0,0 coordinate), as suggested in Figure 14.21. 4. Use the Cylinder shape, and make one that has 6 segments, or stacks, and 12 slices, or faces. Give the name "chest" to the group it creates. 5. Rotate the cylinder by 90 degrees in both the X- and Y-axes. 6. Move and scale the cylinder until it has the same relationship to the head, as shown in Figure 14.22. 7. Turn the Auto Tool option off, if it is on. 8. In the Front view, select all the vertices from one end of the cylinder, then hold down the Shift key, and drag over the vertices at the other end of the cylinder to select them as well. These vertices form the cylinder caps for either end. 9. Scale the vertices to 50 percent in the Y- and Z- axes. 10. Drag the vertices up until the top ones are in line with the top of the cylinder. Figure 14.23 shows what the result should look like. 11. If you like to use the Auto Tool option, turn it back on now. 12. In the Front view, select the right-hand end cap, and rotate it by Ϫ20 degrees in the Z-axis. 13. Now rotate the left-hand end cap by +20 degrees in the Z-axis. Chapter 14 ■ Making a Character Model424 Figure 14.20 The finished hero head. Figure 14.22 The relationship of the chest cylinder to the head. Figure 14.21 Positioning the head mesh. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 14. In the Groups tab in the tool- box, choose the head group and delete it. This gets it out of the way so it won't clutter our model. We have the head saved sepa- rately, so no worries here. 15. In the Top view, select the two vertices in the middle at the bottom, in the area of the sternum, as shown in 14.24, and move them toward the inside of the chest a bit. Use Figure 14.24 as a guide. 16. Now you'll do the same for the back as for the front, but just slightly differ- ently, for a different effect. In the Front view, select all the vertices in the top three rows, including the ones that are in the end caps. 17. Hide these vertices, using Edit, Hide Selection. 18. Now in the Top view, select the middle three ver- tices at the top of the view, as shown in Figure 14.25. These are the middle back vertices. 19. Move the middle back vertices toward the inside of the chest a bit, just as you did with the ster- num, but perhaps not quite as much. 20. Create another new cylinder (to be named "ab"), and give it the same 90 degree rotation in the X- and Y-axes. 21. Move and scale the ab cylinder until it has the same relationship with the chest, as shown in Figure 14.26. The Base Hero Model 425 Figure 14.23 The cylinder caps after scaling and moving. Figure 14.24 The sternum vertices after moving. Figure 14.25 The middle back vertices. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Now we have our primitive abdomen inserted. We're going to have to splice that mesh onto the chest mesh in order to complete the torso. It's actually not terribly hard to do, and after you've done it once, it will seem intuitively easy. But there are quite a few fiddly lit- tle steps involved to get there from here. So please be patient. 22. Using the Groups tab, hide the ab mesh. 23. In the Right Side view, select the bot- tom vertices, as shown in Figure 14.27, and then hide them using Edit, Hide Selections. 24. Back to the Groups tab, unhide the ab mesh. Don't use the general Unhide All command, because we want the chest vertices that we just hid to stay hidden. 25. In the Right Side view again, select the vertices shown in 14.28 and drag them up so they are directly over the location where the hidden ver- tices for the chest are. Study Figure 14.28, which shows the vertices selected and dragged into posi- tion. Compare it with Figure 14.27 to get a sense of the right place to put the vertices. The intersec- tion of lines shown by the white arrow in Figure 14.28 does not get a vertex at this time—we will deal with that shortly. 26. In the Front view, locate the end cap vertices, as shown in Figure 14.29, and drag them out to the position indicated in that figure. 27. Next, do the same for the vertices to the left of the previous set. Drag them to exactly the same place as the previous set, as shown in Figure 14.30. 28. Repeat steps 26 and 27 for the other end of the ab mesh. 29. Drag the next set of vertices over to the chest positions, as shown in Figure 14.31. Chapter 14 ■ Making a Character Model426 Figure 14.26 The ab cylinder relative to the chest. Figure 14.27 Hiding the lower chest vertices. Figure 14.28 The ab vertices dragged over on top of the chest vertices. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... Box Mapping dialog Figure 14.69 The reorganized map box, as shown in Figure 14.70 Make sure you have Split front/back turned off, and Gaps in Map turned on Click OK The unwrapped left hand will appear in the window, surrounded by the selection box Move and size the hand mapping, placing it in the center of the window in the blank area Make sure it is small enough to allow the mapped right hand in here... The 3D view showing the UV template texture We'll continue from here into the animation section using the UV template hero skin that I've included in the C:\3DGPAi1\resources\ ch14\hero.jpg file Character Animation Well, a static model, no matter how cool looking when it's standing there, is not terribly interesting in a first-person shooter We're going to have to animate that sucker! If we were a big... you created in UVMapper 33 Rename the material as "heroskin" 34 Using the Groups tab, select all the meshes and then switch back to the Materials tab and click Assign You should now have a 3D view that Figure 14.73 The final UV mapping layout resembles Figure 14.74 Team LRN Character Animation Of course, your version is in color The lines of the triangles in the color groupings assigned in UVMapper... something that closely resembles the layout in Figure 14.29 Dragging some Figure 14.32 end cap vertices over on top of 31 Zoom in on chest vertices all the places that you dragged vertices to, and make sure that they are exactly over the line intersections of the chest triangles Figure 14.31 Dragging the next 32 In the Right set of vertices into position Side view, select and hide all vertices on a line... housekeeping-like fiddling 14 Choose Edit, Select, All You will get everything on the screen selected in a selection box with the little black sizing handles at the corners and midway along each side 15 Grab the sizing handle on the right side Your cursor should change to the leftFigure 14.67 The unwrapped head right sizing cursor (this is an arrow pointing left and right) 16 Drag the sizing handle... identical common coordinates will be "welded" together This basically means that superfluous copies of vertices will be deleted, and the polygons that we're defining will be reattached to the remaining single copy of each vertex Figure 14.36 After snapping to 41 In the Groups tab in the toolbox, choose both grid…oops! meshes, the chest and ab, so that they are both selected and highlighted in the wire-frame... who manually creates animations using action figures that he poses, changing the poses step by step as he works through the animation, converting what his eye sees into the appropriate frame in his animation program This is certainly a good low-budget option In this book we are going to hand-build our animations, because the point is to learn how to do it They may not be the best animations in the world... than running speed, he walks, using this animation This is the animation used when the character is running backward This is the animation used when the character is running sideways, sometimes called strafing A simple animation where the character's right arm points where the character is looking, such as when holding a weapon The head looks up or down depending on where the character is looking This... configurations! 1 Open the file C:\3DGPAi1\resources\ch14\myhero.ms3d 2 Select File, Merge, and choose the arms file you just created, which should be called C:\3DGPAi1\resources\ch14\myarms.ms3d 3 Choose both the right arm and the left arm meshes and move them into position You should now have a model pretty close to the one shown in Figure 14.63 The Hero Skin Now it's time to skin the model In Chapter 9 you learned... are now in a position to go ahead and use Paint Shop Pro to create your skin for the Hero model Refer back to Chapter 9 if you need a refresher Make sure to save your skin as a JPG file type if you want to minimize file size This means that you will also have to go back into MilkShape and redefine your material to point at the JPG version and not the BMP version Figure 14.74 The 3D view showing the . turned off , in order to avoid confusing myself. 11. Now, using the same technique of selecting and moving (without doing any scaling) as used in steps 4. use for modeling in games. Hybrids Well, the Hybrid category is the catchall category. Often it is prudent to combine tech- niques in a single model—use

Ngày đăng: 26/01/2014, 18:20

Xem thêm: Tài liệu 3D Game Programming All in One- P18 doc

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN