<li><aclass="backlink"title="Click to do a full-text search for this title"href="./Animations?action=fullsearch&value=linkto%3A%22Animations%22&context=180">Animations</a></li>
<h2id="head-72d0748c7878196226e271994b56ecd27cbc75a2">Animation - Creating .md5anims and .md5meshes</h2>
<spanclass="anchor"id="line-4"></span><pclass="line874">There are four steps to getting animated characters into the game: <spanclass="anchor"id="line-5"></span><spanclass="anchor"id="line-6"></span><oltype="1"><li>Character creation. This step includes modeling a lo-poly version of the mesh, rigging the mesh, skinning the mesh and applying materials to it. <spanclass="anchor"id="line-7"></span></li><li>Animating the character. <spanclass="anchor"id="line-8"></span></li><li>Adding animations to the character’s .def file. <spanclass="anchor"id="line-9"></span></li><li>Exporting the meshes and animations to the game. <spanclass="anchor"id="line-10"></span><spanclass="anchor"id="line-11"></span><spanclass="anchor"id="line-12"></span></li></ol><pclass="line867">
<h2id="head-510c9c21da7189985872101de85475be373ac45f">1. Character Creation</h2>
<spanclass="anchor"id="line-13"></span><pclass="line874">The Quake 4 engine uses Maya to convert meshes and animations into usable .md5’s. Guidelines for creating a character: <spanclass="anchor"id="line-14"></span><ul><li>The lo-poly mesh needs to be valid and clean with triangulated polygons and planar surfaces. <spanclass="anchor"id="line-15"></span></li><li>The mesh must have UVs. <spanclass="anchor"id="line-16"></span></li><li>Freeze transformations and delete history on the mesh before binding it to the rig. <spanclass="anchor"id="line-17"></span></li><li>No more than four joints may influence any one vertex. <spanclass="anchor"id="line-18"></span></li><li>The mesh must be bound to the rig using the Smooth Bind option. <spanclass="anchor"id="line-19"></span></li><li>Joints should not have scale offsets on them before being bound to the mesh. <spanclass="anchor"id="line-20"></span></li><li>The character must have an origin. The engine uses the origin information to place and move the character in the game. For AI purposes, the origin should be constrained to the Z translation of the root joint or center of gravity. For multiplayer, the origin should remain stationary. The origin’s translation in Y should be zero. (Y is up in Maya.) <spanclass="anchor"id="line-21"></span></li><li>The engine uses hardware skinning to create the mesh. The file that creates the mesh should therefore have the character in as neutral a pose as possible. <spanclass="anchor"id="line-22"></span></li><li>Create and use reference files. Any changes to the master rig or mesh should be made in that file only. When creating animation files in Maya, reference the reference file using a prefix that uniquely identifies the character. <spanclass="anchor"id="line-23"></span></li><li>Shaders are applied using the Hypershade tool in Maya. Create a material, click on the box next to the color channel and choose ‘File.’ Enter the shader name as it appears in the .mtr file into the ‘Image name’ box. Apply the shader to the mesh. <spanclass="anchor"id="line-24"></span></li><li>It’s a good idea to save the files as ascii (.ma) rather than binary (.mb). That way, the file can be edited through a text editor if needed. <spanclass="anchor"id="line-25"></span><spanclass="anchor"id="line-26"></span></li></ul><pclass="line867">
<h2id="head-9972992d9e46ac214f7bae422bfd9a31c51e096d">2. Animating the Character</h2>
<spanclass="anchor"id="line-27"></span><pclass="line862">Animate the character as normal in Maya. For those who are new to animation, <spanclass="u">The Animator’s Survival Kit</span> by Richard Williams is a good place to start. There are also scores of tutorials on the Internet for Maya-specific animation techniques (<aclass="http"href="http://www.highend3d.com">http://www.highend3d.com</a>). <spanclass="anchor"id="line-28"></span><spanclass="anchor"id="line-29"></span><pclass="line874">The animations used by AI and NPCs can move in space as long as the origin is properly constrained to the character. Multiplayer animations are split between the torso and legs and should therefore be animated in place. When saving the animation, be sure that the Time Slider includes the range of frames intended. The animation will be exported using that range. Otherwise, a range can be specified in the export block of the .def file (see below). <spanclass="anchor"id="line-30"></span><spanclass="anchor"id="line-31"></span><spanclass="anchor"id="line-32"></span><pclass="line867">
<h2id="head-e654fd57899861ce331484f635dabe726f08906f">3. Adding Animations to the Character’s .def File</h2>
<spanclass="anchor"id="line-33"></span><pclass="line874">The character’s .def file contains the variables that define the character’s behavior. Animations available to the character are listed in the .def file and Maya files are exported to the game as .md5’s based upon that information. Animation files are added to the export block and then further defined in the model definition block. The game Editor’s list of available animation is updated with information from the model definitions. <spanclass="anchor"id="line-34"></span><spanclass="anchor"id="line-35"></span><spanclass="anchor"id="line-36"></span><pclass="line867">
<h2id="head-7e8b6b1b5aefea7cf1f595cff343795173387092">3.1 The Export Block</h2>
<spanclass="anchor"id="line-37"></span><pclass="line874">The export block consists of: 1.) the options line, 2.) the Maya file being used to create the mesh, 3.) one or more Maya animation files. For the character .def file, the export block should contain run, walk, and idle animations. <spanclass="anchor"id="line-38"></span><spanclass="anchor"id="line-39"></span><pre>export new_character
<spanclass="anchor"id="line-40"></span>{
<spanclass="anchor"id="line-41"></span>options -prefix nc_ -scale .3937 -align ALL -keep muzzle_flash
<h2id="head-2d0d58d07218ecb67b3ef6d331c82215ef22b3f8">3.2 The Options Line</h2>
<spanclass="anchor"id="line-50"></span><pclass="line874">The above example contains options most frequently used when exporting .md5’s: <spanclass="anchor"id="line-51"></span><ul><li><pclass="line891"><em>Prefix</em>: when referencing the master file, Maya will ask for a prefix that will be added to the joint names. Specify that prefix here. <spanclass="anchor"id="line-52"></span></li><li><pclass="line891"><em>Scale</em>: you can tweak the scale of the character on export. <spanclass="anchor"id="line-53"></span></li><li><pclass="line891"><em>Align</em>: this will align the specified Maya node and all of its children to face the proper direction. <spanclass="anchor"id="line-54"></span></li><li><pclass="line891"><em>Keep</em>: the engine will prune joints that have little or no skin weights attached to them. If such joints are necessary to keep in the .md5, they must be specified here. <spanclass="anchor"id="line-55"></span><spanclass="anchor"id="line-56"></span></li></ul><pclass="line874">Some additional commands that may be useful: <spanclass="anchor"id="line-57"></span><spanclass="anchor"id="line-58"></span><pre>"-rename" Usage: -rename [joint name] [new name]"
<h2id="head-6db736b79eb46e006275dc1c56044203ef7a0503">3.3 The Models Definition Block</h2>
<spanclass="anchor"id="line-77"></span><pclass="line874">The models definition block: 1.) defines the name of the model as it will appear in the game Editor, 2.) defines the names of the .md5 animations as they will appear in the game Editor and Modview, 3.) defines the channels of the character, 4.) allows sounds and effects to be played on specific frames of the animations. <spanclass="anchor"id="line-78"></span><spanclass="anchor"id="line-79"></span><pre>model model_new_character
<spanclass="anchor"id="line-92"></span> anim run -dest characters/anims/run.md5anim
<spanclass="anchor"id="line-93"></span>}
<spanclass="anchor"id="line-94"></span></pre><spanclass="anchor"id="line-95"></span><pclass="line874">Consult the existing .def files that have been provided with the SDK for additional examples. The multiplayer models and animations are defined and exported through player.def and player_meshes.def. The marine AI models and animations are exported through ai/char_marine.def. <spanclass="anchor"id="line-96"></span><spanclass="anchor"id="line-97"></span><pclass="line867">
<h2id="head-7956248faa839d32021494d3829b8a1f5811adca">4. Exporting Meshes and Animations to the Game</h2>
<spanclass="anchor"id="line-98"></span><pclass="line874">Exporting the meshes and animations converts the Maya files to the md5’s that the game uses -- as defined and listed in the .def files. It is first necessary to define where your version of Maya is located so that the engine can find it. Follow these steps: <spanclass="anchor"id="line-99"></span><spanclass="anchor"id="line-100"></span><pre>Press the windows key and the pause/break key simultaneously.
<spanclass="anchor"id="line-101"></span>Click the Advanced tab.
<spanclass="anchor"id="line-107"></span></pre><spanclass="anchor"id="line-108"></span><pclass="line874">When ready to export, access the console and type: <spanclass="anchor"id="line-109"></span><spanclass="anchor"id="line-110"></span><pre>exportmodels ai/new_character.def
<spanclass="anchor"id="line-111"></span></pre><spanclass="anchor"id="line-112"></span><pclass="line874">Be sure to include any subdirectories below the ‘def’ directory. This command will export any animation or mesh in the export block that has been updated since the last time the models from that .def file were exported. Animations and meshes that haven’t been updated will be ignored. Using the command ‘reexportmodels’ will export every animation and mesh within the def file, whether or not they have been updated. <spanclass="anchor"id="line-113"></span><spanclass="anchor"id="line-114"></span><pclass="line874">Unless specifically defined in the export block, the frame range of the md5anim is pulled from the Time Slider of the source file. However, the engine assumes that every animation begins with frame 1 regardless of where the Time Slider range happens to lie. If the Time Slider starts on frame 10 and ends on frame 20, the .md5anim will start with frame 1 and end with frame 11. Therefore, it’s a good idea to have every source animation begin at frame 1. <spanclass="anchor"id="line-115"></span><spanclass="anchor"id="line-116"></span><pclass="line874">To define the range in the export block: <spanclass="anchor"id="line-117"></span><spanclass="anchor"id="line-118"></span><pre>anim walk.ma -range 10 20 -dest walk
<spanclass="anchor"id="line-119"></span></pre><spanclass="anchor"id="line-120"></span><pclass="line874">If there are any errors with the mesh or animations, etc., the engine will list the errors and the export will fail. A common mistake is to make a syntax error in the .def file which will either cause an error on export, or cause a successful export where the character won’t actually appear in the game (a simple box shows up in its place). If this occurs, scour the .def file for any misspellings, invalid paths, open braces, etc. Otherwise, if the export is successful, the new .md5’s will be available to use in both the game Editor and Modview. <spanclass="anchor"id="line-121"></span><spanclass="anchor"id="bottom"></span></div><pid="pageinfo"class="info"lang="en"dir="ltr">Animations (last edited 2005-11-04 17:29:52 by <spantitle="EricBiessman @ 67.129.250.254[67.129.250.254]"><aclass="nonexistent"href="./EricBiessman.html"title="EricBiessman @ 67.129.250.254[67.129.250.254]">EricBiessman</a></span>)</p>
<li><ahref="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a></li><li><ahref="http://www.python.org/">Python Powered</a></li><li><ahref="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a></li>