anachronox-sdk/docs/MD2_Info.txt

90 lines
16 KiB
Text
Raw Normal View History

2002-01-21 00:00:00 +00:00
#/ Joey: sections I've commented out thusly are most probably lines that I'm unclear on, and/or want your feedback on. /#
Disclaimer and Statement of the Obvious:
Now, for many of the things I tell you about, how to open windows and whatnot, Joey has put in Hotkeys. These hotkeys are Important to pay attention to, but since they're shown in the program, I won't reiterate 'em here. Furthermore, there's a LOT of dry stuff in here, so if you don't think you need to know something, feel free to skim. I tried to organize it well, so hopefully you can find what you're looking for, if you need it. Finally, when I use the word "bitmap", I don't necessarily mean a Windows .bmp file. I mean Any supported raster image such as tga, .png, .pcx, .jpg, .atd (we'll get into those later), and, of course, .bmp.
Prerequisite(s) for this tutorial: Delivery_101
EVERYTHING YOU EVER WANTED TO KNOW ABOUT YOUR MD2s, BUT DIDN'T KNOW HOW TO ASK.
<v.01>
Before we get started, just in case you don't know, MD2s are the model files used in Anachronox. /# What does MD2 stand for? How long has the Md2 format existed, and for how many different games? I jus' wanna give the reader a little background on the format, since I'd like to know that sort of stuff if I was reading something like this. /#
All you need for this lesson is the Anachronox Particle Manager (particleman.exe), and an Md2. (and whatever bitmaps* the Md2 uses.) #/ hey, is that gonna be the name of the executable? I know my shortcut points to particleman_d, but that's some kooky developer version, right?/#
1.) Open an Md2 in ParticleMan (which is how I'm gonna refer to the Particle Manager from here on out) By doing the following: Go to File>open, and click on the .md2 you like. (Keep in mind, you can Load an Md2 from anywhere, but if you're not loading it from a under your Anoxdata directory (wherever you installed Anachronox), the texture won't load right.) /# This assumption is correct, no? /#
2.) (optional) You SHOULD now see whatever MD2 you just loaded, with its skin loaded and everything. Now, ParticleMan WAS initially designed for particles, but if you want the particle to go away (this IS, after all, the Md2 tutorial), go to Particle>Suppress Spawning, and the particle will go away. This is the Last thing I'll say about particles here. This tutorial is for Model stuff only...
3.) Crack open the "Model Properties" window. This is done by going to Windows>Model Popup (Since we're not discussing Particles, you can close the Particle properties window by going to Windows>Generator Properties.). This Model Properties window is where ALL the magic happens. #/ Is this Doc gonna be HTML? Would I get to include Images? /# Now, there's a LOT of information to cover in the six tabs of the Model Properties window, so I'll take 'em one by one.
4.) First Tab: MD2 INFO. This displays the following... Base Md2, Delivery, Stats, Skins and Surfaces, and Memory useage.
4a.) Base Md2: this is the Md2 you just loaded, path an' all.
4b.) Delivery: We use a program called LW2MD2 to convert Lightwave files and .uv information (how the bitmap applies to the model). When we use this program, we can scale the model, and tell how many bytes to devote to the geometry (basically, if you don't devote enough bytes to the geometry, you get a warbling, as if the model's made out of Jelly.) Anyway, this Delivery box shows what the model was scaled at, and how many bytes were devoted to it. (3 bytes is the default, 5 is usually enough to keep most things from warbling, and 6 is used on things that are VERY big, or that you see very closely. #/ is this too much information? I want to make sure that the kids have a thorough understanding of what they're looking at, and they CAN skip it... I just don't want to bury important information in a lot of bullshit... /#
4c.) Stats: #/ What the hell is that first number? /# , number of vertices, number of polys in the model (tris), and number of animation frames, if applicable.
4d.) Skins and Surfaces: This is divided into two sections, as you'll see... the skins/emits section tells you how many bitmaps the model uses, and it tells you what the bitmaps are named. This is useful for making shaders, but that's another tutorial. The Tag surf window tells you how many surfaces (special polygons) are tagged, or used for a specific function in the game. Typical examples of tagged surfaces are fx_1 (for particles), hand_r (for attaching a weapon to a right hand), etc. #/ We need to have a talk about the difference between skins/surfaces, Tagged surfaces, and all that stuff. I think I'm a bit fuzzy... /#
4e.) Memory Usage: #/ Alright, Joey. I'm BLANK. These are just Numbers. Hook me up. /#
5.) Second Tab: MDA INFO. This only REALLY applies when you write an MDA (shader) file. But I'll cover it here, all the same. Be sure to refer back to this after you read the MDAs_101 tutorial. This tab shows the following... Base Md2, Chunk Properties, and Profile Data.
5a.) Base Md2: This is the Md2 used for the Mda. If all you've Loaded is an Md2, it'll show the path of the Md2, same as the Base Md2 window in the last tab. (see 4a).
5b.) Chunk Properties: #/ Joey? Dude, what the Hell's going on? Let's include this in our Powwow.../#
5c.) Profile Data: in the Select box, you can see all the separate Shader Profiles available for your MDA. This is where you can see all of the skin variants of a model, etc. In the Passes window, there's a hex number that #/More Joey needed here /#
5d.) the recompute normals button #/Grayed out... Joey, is this obsolete? /#
5e.) the Refresh button #/ what purpose does this serve? /#
6.) Third Tab: SELECTOR. This handy lil' tab shows the following... Triangle Highlight, Head Triangles, and Tagged Surfaces.
6a.) Triangle Hilight: In Anachronox, with the inclusion of New Particles (the kind you make with This particle manager), Any polygon of a model can emit particles. Which is useful if you can find out which polygons are which. When you click on the "Highlight a specific triangle" button, you'll see some wireframes appear on your model. Additionally, one Polygon (triangle) will be filled in with a teal color. This is the selected triangle, whose number is shown in the window to the right of the highlight button. (if the selected triangle is dark red, it's because you're seeing it from behind. the selected triangle and the wireframes are always visible. (you'll notice that the wireframe around the selected triangle is colored red, green, and blue. This coloring shows the order of the vertices) If you're not content to select a number, there's a slider bar to scroll through in order to find exactly the poly you're looking for. (this is useful if you want a monster's eyes to gout smoke, or for their ears to spit fire, or whatever.)
6b.) Head Triangles: This part is complicated, and if you don't want your character to do any facial deformation (facial expressions, lip synching), you can skip it. Otherwise, here's the digs. Now, the finer elements of giving an .md2 facial morphs is plenty of information for another tutorial. So I'll give you the quick version here. Basically, in order for a character to have facial morph positions that it can assume while playing other animations (talking while walking, for example), the md2 has to have some stable frame of reference, some way of knowing that even if the character is moving, some part will stand still. That's where Head Triangles comes in. If, for example, you had a humanoid character, you would want three triangles from his head, since no matter what animations your character plays, his head won't change shape. So you highlight a triangle on the character's head, say the forehead. Then you press the first "set" button. You'll see the triangle number appear in the window next to the words "Triangle 1". So you repeat the process two more times, with different triangles from his head, and you'll have all you need. Once that's done, you press the "BONE" button. Doing this, with the three stable head triangles, will create a bone. #/ Joey, I'm running out of Bullshit here.. Might need more cold, hard facts... /#
6c.) Tagged Surfaces: This little window shows you all the different surfaces of the model that have been specifically tagged for any reason. Remember that bit about fx_1 (for particles), hand_r (for attaching a weapon to a right hand) and all that? This window will tell you what triangle number that best corresponds to any given tagged surface. Just select the surface, press the "goto" button, and the number will appear.
7.) Fourth Tab: FRAMES. For when you load an MD2 or MDA with Animations. This one shows the following... Raw frames and Parsed Animations.
7a.) Raw frames. If the object you loaded Doesn't have any animations, There will only be one raw frame. However, if it DOES have animations, the Raw frames window will show the name of every frame of animation that the model contains. Usually in Anachronox, these frames have names such as amb_a_001, where amb_a is the name of the animation, and the three digit number represents where in the animation that particular frame is. To see what any single frame of animation looks like, click on it's name in this window. The model that you've loaded into ParticleMan will show the frame you selected.
7b.) Parsed Animations. This window will show all the animations that Anachronox understands (for a list of the animations that Anachronox understands, refer to the "Delivery_201" tutorial). To see what an animation looks like, click on the animation name in this window, and the model you've loaded will loop that animation endlessly. Note the "Reparse!" button below this window. this button #/Joey? What's this button good for? Has it been obsoleted by the "reload model" command? Also, is it REALLY necissary to explain the purpose of everything in the "frames" panel, when you summarize everything succinctly in your one little sentance of instruction? ug. I suppose the tutorials have to cater to the dumb ones, too./#
8.) Fifth Tab: DISPLAY. How to see everything you want to see. This tab shows the ollowing... Render Modes, Render Passes, and Debugging.
8a.) Render Modes. Clicking on one of these will display this element of your model. "Vertices" will display all the vertices in your model, as well as a little line coming off of the vertice that shows the direction of the surface normal (note: the term "Surface Normal" is a complicated term that affects lighting, reflection maps, etc. It really has no bearing on the MD2 viewer, so won't be discussed here. But it's good to know about...). #/Hey, Joey? Where would be a good place to discuss the concept of Surface Normals? The MDA tutorial, maybie? Where could I get a good, iron clad definition to use? /# "Wireframe" will draw a wireframe version of the model, showing the edges of all of the polygons. "Flat-shaded" will display the model you've loaded as flat, gray polygons. This will help you see the shape of the model's geometry, without the skin. Finally, "Shader/Texture" will show the skin of the model, and if you've opened an MDA with Multi-pass shaders (see the MDAs_101 tutorial), the shaders will be displayed as well. Note that combinations of views will work as well, so that you can see (for example) "wireframe" And "shader/texture" at the same time if you want (although "Flat-shaded" will always hide the "shader/texture" when selected).
8b.) Render Passes. #/ Joey, this is ALL you. I know you explained it to me, but I'm still leaving it to you to write out the entire render priority spiel... /#
8c.) Debugging. "Highlight Morphs" will draw a yellow dot over each of the affected vertices when you're cycling through facial morphs (facial morphs will be covered in the next chapter). "Draw Bone Axes" will display a little X,Y,X axis based on a head bone you've created, if applicable (refer back to 6b if you're confused on Head Bones). The options are on by default, and help you to determine if your facial morphs are working correctly.
9.) Sixth Tab: MORPHS. This tab is devoted to facial Morphs, so if you don't intend for your character to have facial Expressions or Lip Synching capability, you may ignore it. This tab shows the following... LWO Morph Directory, LWO Morphs, and MDA morphs (Note: Facial Morphs can ONLY exist on an MDA, so technically, the MD2 portion of the lesson is over. However, it IS the sixth tab of the Model Properties window, and since the MDA tutorial is the next in this series, The following will describe the entire process of adding facial expressions and lip synching capability to a model).
9a.) LWO Morph Directory: In order for your model to have Facial expressions, you need to have a directory devoted to Facial Expression models. In this directory, Every model must be Identical, except for their facial expressions. Furthermore, they have to be able to use the same UV co-ordinates as your model (see delivery_101). For Anachronox, we use 18 Lightwave objects, for 20 different facial expressions (you might want to do the same, although you can easily do more or less). For Demonstration purposes, I'll list off the 18 files we use (Remember, these are all in a directory set aside for facial morphs). With Joey's Facial Morph code, all of the files need to have four character file names. The ones we use are:
base.lwo - This is the Still (No facial expression) pose. It must have the same facial expression as the model used when dumping the lightwave animations.
Note: Expressions are denoted with an ex, Mouth positions are denoted with an mp.
mp00.lwo - This is the base mouth position, with the mouth Closed. This may or may not be identical to base.lwo. Note that Expressions start with the number 01, whereas Mouth positions begin with a position 00.
mp01.lwo - Phoneme mouth position for C,D,G,J,K,N,S,T,Y,and Z mouth sounds.
#/If this ends up being HTML, can we include the lil' Illustrations for these?/#
mp02.lwo - Phoneme mouth position for F and V mouth sounds.
mp03.lwo - Phoneme mouth position for L and TH mouth sounds
mp04.lwo - Phoneme mouth position for B, M, and P mouth sounds.
mp05.lwo - Phoneme mouth position for Q, R, U, and W mouth sounds.
mp06.lwo - Phoneme mouth position for E mouth sounds.
mp07.lwo - Phoneme mouth position for I and A mouth sounds.
mp08.lwo - Phoneme mouth position for short O sounds.
mp09.lwo - Phoneme mouth position for ooo sounds.
ex01.lwo - Confused facial expression.
ex02.lwo - Happy facial expression.
ex03.lwo - Sad facal expression.
ex04.lwo - Angry facial expression.
ex05.lwo - same as ex01 (confused), but doesn't change the shape of the mouth.
ex06.lwo - same as ex02 (happy), but doesn't change the shape of the mouth.
ex07.lwo - same as ex03 (sad), but doesn't change the shape of the mouth.
ex08.lwo - same as ex04 (angry), but doesn't change the shape of the mouth.
Once you have made all the facial expression and mouth position LWOs you want, copy the name of the directory they're in, and paste it into the "LWO Morph Directory" window there. If you scaled your md2 when you delivered it (see Delivery_101), use the "Pre-scale LWO data by:" window to adjust the facemorph objects. You'll note that the default scale by amount is 1.3. This is also explained in Delivery_101. Anyway, once you've pasted in the directory where your facemorphs are located, and you've adjusted the scale correctly, press the "Import!" button. The names of all your Lightwave Morph frames should now appear in the "LWO Morphs" window. If not, Check the console for an explanation.
9b.) Lwo Morphs. This window, if you followed the last step correctly, will now display all the loaded facemorph frames. If you click on one of the frames, you'll see a wireframe version of that facial position object superimposed over the object that you currently have loaded. Additionally, you'll notice lines being drawn from every point on the facemorph wireframe to the corresponding point on your loaded model. This is useful for determining that the points on the hands of your morph frame, for example, correspond with the points on the hands of your model. If everything seems appropriate, press the "----GO--->" button, and the morph frames will show up in the "MDA Morphs" window. The "Threshold:" window you see is for #/Joey? what's Threshold/Reset/Debug output for? Need a bit of explainey... /#
9c.) MDA Morphs: This window shows your final Morph frames. Clicking on them will cause your loaded model to change facial expressions. That's It. Save your MDA, and it's Done.