2D Artwork and 3D Modeling for Game Artists- P12

Chia sẻ: Thanh Cong | Ngày: | Loại File: PDF | Số trang:50

0
46
lượt xem
3
download

2D Artwork and 3D Modeling for Game Artists- P12

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tham khảo tài liệu '2d artwork and 3d modeling for game artists- p12', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả

Chủ đề:
Lưu

Nội dung Text: 2D Artwork and 3D Modeling for Game Artists- P12

  1. 524 13. Making the RF-9 Plasma Gun Game-Ready Embedding the Shape (for Torque Users) Before you continue, remember to save your MAX file, and be sure to have the tex- ture file located in the same directory. In this section you’ll tell the Torque plug-in to get your model ready for export as a .DTS file format. Located in the Chapter 13 Data section on the CD-ROM is a DTS Export plug-in utility called NOTE max2dtsExporter.dle; if you haven’t done so Y The plug-ins listed in this already, copy it to the \PLUGINS\ folder in your chapter work for 3D Studio FL 3DSMAX5 program directory (you’ll have to Max version 4 and higher. restart Max). Once Max has been restarted, load up your RF-9 scene file and do the following: AM 1. Click once on the PlasmaGun mesh in your scene to select it. 2. In the Utilities panel, click the DTS Exporter Utility button. (If this button TE isn’t listed, click the More button and search the list. If it’s still not listed, the plug-in might not have been loaded properly.) DTS, by the way, is Torque’s object format. 3. In the Exporter section, choose Renumber Selection. 4. A blank dialog box opens; type 2 and click OK. This will affect the level of detail (LOD) of the gun, enabling the mesh to have the highest detail in the game (more on LOD later in this chapter). 5. Click Embed Shape. In a flash, the exporter places the RF-9 into a nice DTS- required hierarchy. You can see this by opening the Schematic view and expanding the tree, as shown in Figure 13.13. The RF-9 is now placed in a structured hierarchy pertinent to creating DTS shapes for the Torque engine. ® Team-Fly lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  2. Adding and Manipulating Nodes 525 Figure 13.13 The DTS hierarchy created by the DTS Exporter utility’s Embed Shape function. The Embed Shape button Adding the Dummies With the required DTS hiearchy now in place, let’s add some dummy objects so that a player can mount and use the RF-9. 1. Minimize the Schematic view. 2. In the Create panel at top-right, click on the Helpers icon (it looks like a tape measure). 3. Within the Helpers section, click on the Dummy button, and click and drag to create a small box in the User view of your scene. (The size of the dum- mies is negligible; they’re just there for your reference. I keep mine small, like in Figure 13.14.) 4. Name this first dummy object MountPoint, and position it on the middle of the grip as shown (make sure it’s in the middle, as seen from all views). 5. Align the pivot point as you did the other objects before (this isn’t critical, but it helps to stay consistent). se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  3. 526 13. Making the RF-9 Plasma Gun Game-Ready Figure 13.14 Add a dummy object to the scene in the Helpers section and call it MountPoint. Position it on the grip area. The Helpers button 6. Add another dummy object to the scene and call it MuzzlePoint. 7. Position the new dummy object directly in front of the muzzle, as in Figure 13.14. This will be the origin of the plasma balls that are launched from the end. Note that the pivot point of this dummy is critical; ammunition will be directed where the y axis is pointing. 8. Now link the dummy objects to the TIP PlasmaGun object in the hierarchy. A quicker technique would be to To begin, open the Schematic view; click on the MountPoint object you’ll see your newly created dummy and choose Edit, Clone, and then objects listed. rename the object MuzzlePoint. This will also copy the pivot point 9. Click on one of them, then click the of the MountPoint object. Link button at the top of the Schematic View screen. 10. Your cursor turns into two boxes linked together; just click and drag a line from the dummy to the PlasmaGun object, located below and linked to the Start01 object in the hierarchy (see Figure 13.15). This will make the dummy object a child to the parent weapon object. 11. Click on the black arrow at the top to deselect the Link mode, then do the same for the other dummy object as well. Now you have all your required mounting nodes attached properly and are ready to proceed with dumping out the model. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  4. Exporting the RF-9 for the Torque Game Engine 527 Figure 13.15 Link both dummy objects to the PlasmaGun object in the Schematic view. The Link button Exporting the RF-9 for the Torque Game Engine The last and simplest thing to do is to dump your hard-earned game-ready model for use in Torque. Before dumping out the model, however, you’ll need a CFG file that will tell the exporter exactly what to dump out. This is common for almost all exporters for all game engines. Located in the Chapter 13 Data section on the CD-ROM is a file called weapon.cfg; Place a copy of that file in the same folder as your RF-9’s MAX file and the texture file. The configuration file simply tells the exporter what to include or occlude dur- ing the exporting process. All that’s listed in this text file is AlwaysExport: MountPoint MuzzlePoint se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  5. 528 13. Making the RF-9 Plasma Gun Game-Ready NOTE When it comes time to export the slogre model, the configuration file will be fairly complex. Just make sure to update the AlwaysExport section with whatever nodes you want included during the export, or else they won’t be pre- sent in your DTS model. Also note that you can have only one CFG file present, and the name is arbitrary. In the Utilities section, the DTS Exporter utility has an Export: Whole Shape but- ton. Click it, give the shape a name, and make sure that the directory it is export- ing to is the same as the one in which your MAX, CFG, and texture files reside. These files should all be located in a separate folder within the \RealmWars\rw\data\shapes\plasmagun\ folder. Viewing the Model in Torque You can view the model in Torque using the TorqueDemo.exe -show command. Just pick up the shape by clicking the Load Shape button and selecting the model from the list, as in Figure 13.16. Use the W and S keys to zoom in and out, and A and D to rotate. Figure 13.16 Viewing the complet- ed RF-9 Plasma Gun in the Torque viewer. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  6. Adding Levels of Detail (LODs) 529 Adding Levels of Detail (LODs) I hinted at creating levels of detail for game objects earlier in this book, and now’s the time to explore this process. The RF-9 plasma gun currently has over 1,300 polygons associated with it, which is a bit pricey for just a weapon. Most game engines will handle such a large amount just fine, but having many such weapons—along with the rest of the game’s geometric detail—will certainly bog down your computer system. Ultimately, your system will slow down and seem a bit choppy at times, especially if you’re playing over the Internet. One way to resolve these high geometry issues is by assigning levels of detail (LODs) to your objects. Level of detail mesh objects are simply copies of the same model, but each has varying polygon counts. This way, the game engine can replace a higher mesh object with a copy whose mesh is lower in polygon count as the player’s view increases with distance. After all, how much detail on another player’s weapon can you possibly discern from far away? Try to picture an opponent stand- ing far away on a hill, holding the RF-9—it would only appear that he’s holding a tiny dark item—an unnecessary detail for a game engine to have to render, to your view, of 1,300+ polygons. TIP Levels of detail are not necessarily a If the game engine in question sup- requirement for any model. Having ports LODs—and most do (including them is just a way to speed up game the Torque engine)—creating them is play, without noticeable loss of model fairly easy using a MultiRes modifier. All quality, from the distance between you need to do for the RF-9 is clone the the player’s view and the model itself. model, apply the MultiRes modifier, make a few adjustments to the hierar- chy, and register the new levels of detail for the model. The RF-9 is currently embedded in the structured hierarchy as seen in Figure 13.15; it is labeled PlasmaGun2. Notice that there is also a dummy object called Detail2, linked to the Base01 object. This is a detail marker that both the exporter and game engine use to refer the appropriate detail mesh object—that is, when the game engine needs to display the lowest resolution of your detail mesh, it looks for the Detail2 dummy marker, which, to the exporter, is directly related to the PlasmaGun2 object. Subsequent dummy objects and meshes with higher numbers (for instance, Detail32:PlasmaGun32 or Detail64:PlasmaGun64) will be used as the object comes closer to the player’s view. se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  7. 530 13. Making the RF-9 Plasma Gun Game-Ready Let’s make for the RF-9 just one optional level of detail that has only half of the polygon count (or about 650 polygons), so that the engine can display that model when the player is far away from it: 1. Open the Schematic View again so that you can see the entire hierarchy of the RF-9. Currently, there’s only one level of detail— PlasmaGun2, which also has a dummy reference marker called Detail2. The mesh right now is at the highest quality (1,350 polygons) possible, so you need to change this num- bering scheme so that the number located at the end of the label will repre- sent the highest level of detail of the model (the higher the number, the greater the polygon count of the model). Click once on the PlasmaGun2 label to select it, then click once more, and rename it PlasmaGun64 (see Figure 13.17). Torque needs to have detail markers in binary increments, such as 2, 4, 8, 16, 32, 64, and so on. In this case, the name “PlasmaGun64” will represent the highest level of detail. 2. Double-click the Detail2 dummy object in the Schematic View. Press Del to delete it—new dummy markers will be recreated at the last step. Figure 13.17 In the Schematic View, change the name of the RF-9 from PlasmaGun2 to PlasmaGun64. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  8. Adding Levels of Detail (LODs) 531 3. Now make a clone of the plasma gun mesh. With the RF-9 actively CAUTION selected, click Edit, Clone. A Clone You can make as many level of Options dialog will open, allowing detail meshes as you want, but you to chose the cloning method. keep in mind that the greater the Be sure the Copy option is selected, number of detail levels present, the then, in the Name field, change the larger and more cumbersome your name to PlasmaGun2 and click OK. .dts file will be to the game engine. You’ve now made an identical copy of the weapon’s mesh; this will be apparent in the Schematic View (Figure 13.18). Figure 13.18 Choose Edit, Clone, and clone the RF-9. Change the name to PlasmaGun2. 4. The new clone you’ve just created will represent the lowest level of detail, but since it is in fact a clone, it still has the same polygon count—1,358 in this case. To cut this count in half, go to the Modifier panel and apply the MultiRes modifier. In the MultiRes panel, click the Generate button to apply the modifier to the PlasmaGun2 object. Not much happened. Now look to the top of the MultiRes panel in the Resolution section—change the Vert Percent from 100 to 50 (Figure 13.19). You’ll see the mesh reduce its poly- gon count in half, to about 682 polygons. se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  9. 532 13. Making the RF-9 Plasma Gun Game-Ready Figure 13.19 Apply a MultiRes modifier to the PlasmaGun2 clone, and set the Vert Percent to 50. 5. You should now have two detail meshes in your scene—one RF-9 with 100 percent detail, and one with 50%. You’ll see the difference in the two when viewed in the Torque engine. Lastly, you’ll need to register these new detail meshes for the Torque engine. Open up the Schematic View again; you will see both detail meshes linked to the Start01 dummy. Double-click the Base01 dummy to select it, then open the Utilities panel. In the DTS Exporter Utility section, click Embed Shape. The utility will now create two dummy objects, Detail64 and NOTE Detail2, linked to the Base01 Continuous level of detail is supported object (Figure 13.20). in newer game engines.This means that the engine develops a smooth And that’s it; you’ve now created two mesh detail transformation from the different levels of detail that the highest to lowest mesh quality in rela- Torque engine can use to swap in the tion to distance.This is fairly taxing, game—one for up close, and one for due to the intensive mathematical far away. You can view the detail calculations required; that’s why it’s meshes in the same way you viewed the not available in many other engines. RF-9—using the Torque -show utility. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  10. Tips for Exporting to Other Game Engines 533 Figure 13.20 Select the Base01 dummy object in the Schematic View, and click the Register Details button in the DTS Exporter Utility. Just click the Export:Whole Shape button in the DTS Exporter Utility and replace the existing plasmagun.dts file, which should be located in the \RealmWars\rw\data\shapes\plasmagun\ folder. Viewing the New Level of Detail in Torque Once you’ve saved your .dts object with new levels of detail, view it in Torque using the TorqueDemo.exe -show command. Select the plasma gun model and zoom in close to see it. No changes to the mesh will be apparent. To see the two separate levels of detail, click the Detail Control button. In the Detail Control panel, adjust the slider left and right to see the two detail models dynamically swap in front of your eyes! (See Figure 13.21). Not bad detail, considering one mesh contains half as many polygons as the other! Tips for Exporting to Other Game Engines What I’ve covered in this chapter, as far as preparing your model for the Torque game engine, is very similar when using most other game engines. It’s just a matter of reviewing the specifications that the game engine calls for. Plug-ins are usually se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  11. 534 13. Making the RF-9 Plasma Gun Game-Ready Figure 13.21 Once you open and zoom in on the RF-9 in the Torque -view utility, use the Detail Control panel to view the two new levels of detail. Y FL AM TE available for most popular game engines; for instance, the Half-Life exporter for 3D Studio Max is called smdexp.dlo and is available free in the Half-Life SDK, downloadable at the Valve resource site (http://hlsdk.valve-erc.com). Just consult the game engine’s SDK (software development kit) documentation for further details. Summary In this chapter you imported the RF-9 plasma gun model into 3D Studio Max, and used this program to prepare and finalize the weapon for use in the Torque game engine. In 3D Studio, you applied the skin texture you developed in Chapter 11. You also created a bounding box, which tells the engine the extents of your model, and attached key game objects called dummies, which dictate to the game engine certain areas of your model where a player can pick up and use the weapon. All of these components are linked in a structured hierarchy that is understood and read by the game engine’s Max exporter. The entire preparation of a game model in this way is very common for most engines. ® Team-Fly lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  12. CHAPTER 14 Making the Slogre Game-Ready with 3D Studio Max and Character Studio se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  13. 536 14. Making the Slogre Game-Ready A s shown in Figure 14.1, you’re now at the last stage of compound-asset cre- ation with one of the two models you’re developing for a video game. In English, that means this is the chapter in which you’ll take your newly modeled and U-Ved slogre, slap on the eerie skin you made in Chapter 12, “Skinning the Slogre with Deep Paint 3D and Photoshop,” and get it ready for use in the Torque game engine. In this chapter you will ■ Apply your newly developed texture skin to the slogre character. ■ Adjust the model’s alignment and scale. ■ Learn about resetting transforms. ■ Create the character’s bounding box. ■ Change the character’s shape with modifiers. ■ Add a Character Studio Biped bones structure to the mesh. ■ Learn about and adjust envelopes for the skin. ■ Add dummy nodes for critical mounting and camera points. ■ Add level of detail (LOD) to the model. ■ Export the slogre to the Torque engine. Figure 14.1 The last stage of compound-asset creation. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  14. Applying the Skin to the Slogre 537 Applying the Skin to the Slogre Let’s start by skinning your model with the texture you created in Part III, “Texturing with Photoshop and Deep Paint 3D.” You should have in your posses- sion the MAX file you created in Chapter 6, “U-V Mapping the Slogre with DeepUV,” which simply contains the slogre mesh that’s been checked for errors and U-Ved with DeepUV. If not, extract the slogre_mapped.max file located in the Chapter 14 Data section on the NOTE CD-ROM. Then, extract the file Although you saved your texture from SlogreSkin.png (also found on the CD- Chapter 12 in different file formats, ROM); this contains your texture. meant for different game engines, Place these two files in the same folder you’ll use the SlogreSkin.png file on your hard drive. Then, in 3D here to get this model ready for Studio Max 5, open the Torque, which is the engine you’ll most slogre_mapped.max file (Figure 14.2). likely be using for this book. Figure 14.2 Open your U-V–mapped model in 3D Studio Max. se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  15. 538 14. Making the Slogre Game-Ready NOTE This file has the User viewport at the bottom set to a smooth, dynamic rendering, which is what you’ll need for viewing your texture. If for some reason none of your views are set to render- ing (that is, all views display a wireframe mesh of the slogre), press F3, or click Customize,Viewport Configuration; then, under the Rendering Method tab, choose Smooth + Highlights. Once the MAX file is open on your desktop, do the following: 1. Using the Select Object tool (the button at top with a white arrow on it), select the model to make it active. 2. Enter the Material Editor by pressing M or choosing Rendering, Material Editor. 3. The very first cell at the top-left should be blank; that’s the one you’ll fill with the texture bitmap. Click on the cell (it should be named “1—Default”) to make sure it’s active. 4. Click on the Show Map in Viewport icon (it looks like a Rubik’s Cube). This will display the material, once it is loaded, on the character. 5. Just below the Show Map in Viewport icon is the currently named material, which you can change by clicking in its window and replacing the text with the name you prefer (I typed SlogreSkin). 6. Under the Blinn Basic Parameters section, click on the small blank gray but- ton next to Diffuse to load a Material/Map Browser screen (see Figure 14.3). 7. In the Material/Map Browser screen, double-click Bitmap. A bitmap file browser screen NOTE opens; search for your slogre In shader terms, diffuse simply refers to skin texture, which should be the absolute color or material that is located in the same directory reflected when general lighting is as the slogre’s MAX file. If applied to the object. Because you’re you can’t find the .png file, not really interested in other rendering- use the SlogreSkin.png file on specific values (for now), that’s the only the CD-ROM. material parameter you need to fill. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  16. Applying the Skin to the Slogre 539 Figure 14.3 Bring up the Material Editor and click the Diffuse button to browse for a texture map. The Diffuse button 8. Click the Assign Material to Selection button (see Figure 14.4). You should now see your texture applied to the slogre mesh. 9. Save your work. Figure 14.4 Select Bitmap from the Material/Map Browser screen and add the slogreSkin.png texture. Apply it by clicking Assign Material to Selection. The Assign Material button se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  17. 540 14. Making the Slogre Game-Ready NOTE It is imperative that you store your MAX, PNG, other texture files, and configuration files (which you’ll see shortly) in the same directory, because the export plug-ins need to reference everything at once in the same location. Scaling and Aligning the Pivot Point All weapon and character models in games need to be properly scaled and must have a pivot point (or axis) that is aligned according to the game engine for which they are being designed. ■ Generally speaking, the scale of the model is measured in meters; the game engine will render models according to this measurement. That means if the coffee mug you just exported is set to 10 meters, you’ll have enough java to keep an entire country awake all night! ■ The pivot point makes the model face the proper direction when placed in the game environment. Scale the Mesh When Lars (my artist friend and colleague) and I were conceptualizing the slogre model in Chapter 2, I envisioned a beast that would lumber around at approxi- mately four meters tall. To scale the slogre accordingly, select the slogre object, right-click it, and choose Properties in the Transform menu that appears; you should end up with an Object Properties panel that shows critical information such as polygon count, user-defined properties, and size (see Figure 14.5). As shown, the slogre model currently stands at a z-axis height of over five meters, a bit taller than necessary. To scale this big guy down to around four meters, do the following: 1. Exit the Object Properties panel. 2. Click the Select and Uniform Scale tool located at the top of the screen. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  18. Scaling and Aligning the Pivot Point 541 Figure 14.5 Right- click the slogre model to bring up its Object Properties panel. 3. Right-click this tool to open the Scale Transform Type-In dialog box, where you can manually enter a new scale percentage. 4. After doing a little math, I’ve determined that to reduce the slogre’s z-axis height from 5.374 meters to 4.000 meters, you’ll have to scale him down about 74.4 percent. Type 74.4 in the X, Y, and Z fields, as shown in Figure 14.6 to shrink the slogre down to size. Figure 14.6 Use the Scale Transform Type-In dialog to scale the slogre down about 75%, which makes him just about four meters tall. The Select and Uniform Scale tool se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  19. 542 14. Making the Slogre Game-Ready Notice that if you right-click the slogre and view his properties, the height is still the same. That’s because 3D Studio keeps tab on every single move you make, including when you physically move, rotate, and scale your objects. These types of operations are commonly known as transforms, and can be utilized in hundreds of applications. When you perform an operation such as scaling the slogre, the slo- gre’s size on the screen will change, but the new measurements won’t be locked down until you reset the transforms on the model; the quickest and easiest way to do so is to add a Reset XForm modi- fier onto the modifier stack. To make the transform permanent, click the NOTE Reset XForm button in the Utilities If you’re fiddling around with your tab of the Command Panel, and then model, and aren’t ready to commit to click the Reset Selected button below the changes you’ve made, don’t reset it to add the modifier to the modifier your transforms.That way, 3D Studio stack (see Figure 14.7). Then, return maintains a history of the model, enabling you to quickly and easily undo to the slogre’s Object Properties any transform you’ve performed. screen to confirm that the slogre has, indeed, been scaled down in size. Figure 14.7 Apply the Reset XForm modifier to lock down the scale changes. The Reset XForm button If you’re sure you want to retain the changes you’ve made, feel free to collapse the item in the modifier stack; in the Modifier panel, just right-click the item in the stack and choose Collapse To (or Collapse All, which will collapse the entire stack). Figure 14.8 shows the Reset XForm on top of the character mesh in the stack. lease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
  20. Scaling and Aligning the Pivot Point 543 Figure 14.8 The Reset XForm added to the modifier stack. Collapse this to retain your changes forever. Set the Pivot Point In the case of the Torque engine, the programming code requires that the character mesh (and all other meshes, for that matter) have its axes aligned so that the y axis points directly forward (through the front of the model), the z axis points straight up, and the x axis points to the object’s sides. In Figure 14.9, the x and z axes are correct, but the y axis is backwards. Figure 14.9 The axes of the slogre must be aligned so that the he faces in the proper direction in the game. Here, his y axis is pointing 180 degrees in the wrong direction. se purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Đồng bộ tài khoản