Friday, September 11, 2009

Step By Step: Exporting a Character from Poser to Half-Life Uncompiled Format

Since there is not a good step-by-step guide, I am going to write in detail how to get a character out of Poser into a format that Half Life can use, with instructions and screenshots.

This process was taken from the two YouTube videos cited in the previous post.

Tools You'll Need:
Poser (another modeling package would probably be similar)
Source SDK
Mod Tool 6.01
ValveSource Plugin for Mod Tool

Exporting from Poser

1) Open up Poser Pro (or your other program) and get the model you want. I'm using Simon because he's dressed and ready to go. Select File>Export>COLLADA.
EDIT: In order to make the textures map correctly, try exporting as a .obj file and importing that into Mod Tool. Sometimes COLLADA doesn't work right.
 
2) In the next dialogue box, select Single Frame export. I haven't figured out animation yet, but it may be that in the future multi-frame export is useful for animation. Separate post for that!
 

3)  In the next dialogue, make sure that only Simon is selected.

4) Give your file a name in the following dialogue box. In the one after that, change the scale to 1000%. Uncheck "Include Normals" and "Include Rigging" since we'll be rigging the character ourselves. Everything else should be set up okay from there. If a "Select Morphs" box comes up after that, just click "OK".


Importing into Mod Tool

5) Yay, your model is exported! Now, open up Mod Tool. (BTW, all these programs take up a LOT of memory so if you run them at the same time, your computer might crash. I advise opening each separately.)
In Mod Tool, go to File>Import>Model...
 
6) Choose Collada (.dae) on the File Type dropdown in the Open dialogue. Find your model and double click it to import. You'll probably get an error in red at the bottom: Triangle Count Exceeded. Don't worry about it.
Reduce Polygons
7) Let's go ahead and reduce down the polygon count to make it easier to work with (and allow for export into Half Life). Choose Model>Poly. Mesh>Polygon Reduction.


8) When the dialogue box opens, use the "Units" drop down menu to select "Final triangle count" and then beside "Tri Count" type "7000". Half Life will allow for up to 7500 polygons for its characters, so I'm just exporting a little below that count to be safe. Immediately your image will change to have fewer polygons. You'll see a visible difference.

Exit out of that dialogue box.

Freezing Transforms


9) To make your model export correctly, you need to freeze all of its transforms. This is accomplished by clicking "Transform" in the right hand menu then clicking "Freeze All Transforms".



Baking the Textures

10)One more step before we line up the skeleton: exporting the texture map. When you exported the COLLADA file, in the same location, all the textures were saved with it. Although they don't show up on your model right now, they're still associated with the appropriate parts. What you need to do is to let the program make one texture out of all those textures and to save it somewhere. To do this, click on the character to select it, then go to Model>Property>Render Map.


11) When that dialogue comes up, set X Res to 512 or 1024, whichever works, then next to UV, select New>Unique UVs (Polymesh).

12) Set the Path to wherever you want to put it, preferably in the Source SDK material folder that you'll be using. Choose Targa(.tga) under "Format", and under the first dropdown under the Map section, select "Surface color only (albedo)". Then, click "Regenrate Maps..." and exit out of the dialogue box.
 
13)  Press 8 to open the explorer (handy shortcut!) and find your object. Delete any materials that are already there.

14) On the right sidebar, under "Create", click "Textures", then click "Image."A dialogue box will show up. 


15) Click "New" beside the Image dropdown, and find your image that you saved for the texture.Yay, your model is textured! If you choose "Textured" under the drop-down view mode menu to the right of the screen, you'll be able to see your texture. (You can see my texture didn't turn out so well in this screenshot. I'm not going to take the time to fix it now because usually it turns out okay. Look for a separate post on texture tweaking.

 



Add & Align Biped Guide
16) Now that our character is all set up, we're ready to put bones into it! Choose ValveSource>Character Rigs>Biped Guide. (I'm going back to wireframe view for this.)

17) When you do that, a "skeleton" will show up on the screen with different lines connected by boxes. But it is HUGE! Type "z" to activate the zoom tool, then right-click to zoom way out to see the whole thing. You should see your character in between the legs of the guide.


18)The boxes act like joints and the lines act like bones. Your goal is to line up the bones and joints as closely as you can with the Poser model. So, you'll want to select the model and use the Scale, Rotate, and Translate tools to line up that character. First, uniformly scale up until the shoulders and head kind of line up. You can do this by typing scale coefficients into the "Transform" box near the "S" on the right side of the screen, or by clicking "S" and then dragging the box in the middle of the three axes. I like typing because it's quicker, but sometimes it doesn't work correctly. You also might want to switch from 'User' perspective to 'Front' perspective so you don't have to deal with the distortion that the camera brings while resizing.
 
19) After you get it scaled up appropriately, click on the red boxes to select them ('y' is the shortcut key for getting into select mode). Then, click on the R and T buttons for rotating and translating, and make the bones line up with the body. Other helpful keyboard shortcuts: Zoom tool, press 'z', then middle click is zoom in, and right click is zoom out, and left click + drag is reposition.
  
20) This part is more of an art than a science. You need to line up all those bones from Top, Right, and Front views. The hands will be the most difficult part since you have to move the position of each of those fingers.  I'm not going to take a lot of time to do my alignment since I'm primarily doing this for tutorial purposes, but go ahead and spend some time to make this right. A quick check shows all my bones are decently in line from each perspective.

Rig the Character
 21) Now, select ValveSource>Character Rigs>Rig from Guide. It'll do a bunch of magic.You'll end up with a different looking model and bunches of dialogue boxes. You can exit out of all those.



22) Press 8 again to open an explorer, if you closed it. Click on ValveGuide, then press Ctrl+T for "Select Tree", then press the Delete key to delete the guide.

Envelope the Character
23) Almost there, I promise!   Expand ValveBiped in the explorer. Click to select your character, then go to Animate>Envelope>Set Envelope.

24) Click "Yes" in the dialogue box that comes up next. Then, your mouse cursor will turn into a little arrow with "PICK" right beside it. Now, left-click to select, then right-click to confirm. Sometimes this works weirdly for me but keep trying that process and eventually you'll get a new dialogue box (that you can close) and a colored-point version of your model.
 
Tweaking the Points
25) All right! You're close to done! Use the rotate and translate tools and select some of the random sphere things that were added to your model. Play around with them and make sure that your character is moving fairly naturally. Try nodding/shaking its head, moving arms forward and backwards, etc. If you find something that's deforming strangely, then you'll want to edit their point weights. I will cover that later in a fine-tuning tutorial.
Exporting
26) Finally! Click on ValveSource>Export to .SMD. Pick the location of where you'd like to save the file (probably in the models source folder of your mod). You can leave all the other settings. Click the OK button!

You're done!! Well, kind of.
The next steps are compiling together the model you just exported and its texture into one file that Half Life can handle. I will be covering these steps in a future tutorial, since I haven't worked quite that far yet.

Remaining things to do for character importing:
- Actually getting the character into the mod
- Finding out how to do animations using this model in Face Poser
- Figuring out if there's anything additional you have to do to allow for lip syncing

Final Words
Yeah, the process seems long and overwhelming, but the truth is, after you've done it 10 or 12 times (as  I have while trying to get things right) it's not too bad. You'll get better at it. Any modeling tool has a steep learning curve but after spending a bunch of time using Mod Tool and learning the different shortcuts you'll get much quicker at it.
Please let me know if you have any problems or questions!

No comments:

Post a Comment