Importing WoW Models with Animations (FBX) into 3DS Max

This is a quick guide on how to properly import FBX files with animations into 3D Studio Max. Before starting, make sure you have the most recent FBX plugin from here.

Importing an FBX Model
1) Select the character in WoW Model Viewer. Go to File > Export and select the FBX option. You will be prompted to select an animation name, leave this blank to export all animations.
– It may take a minute or two to fully export. The program may seem unresponsive, but it is likely still working. Be patient.

2) In 3D Studio Max, go to File > Import and select the FBX file. Under the animation section, select the “No animation” option.
– You may get a warning about the skin while importing, just click ok it won’t affect anything.

Optional Cleanup Steps
3) Remove the TurboSmooth modifier from the mesh.
4) Add an “Edit Mesh” modifier and consolidate the material slots.

Adding Animations
1) With the model still open, import the FBX file again and select an animation from the drop down list.
2) Remove the TurboSmooth modifier.
Importing animations currently has a bug which affects the last few keyframes. Fortunately, this is easy to fix.
3) Select all the bones (CTRL+A). Copy the first key and place it over the last key. (Shift-click and drag the key to the end).
– You can export the animation at this point.

Problems and Fixes
1) When trying to export in 3DS Max, I get the error “Duplicate bone name encountered”.
– This is caused by the bone names being too long. Use Tools > Rename Objects to rename the bone prefix to something shorter.

Converting WoW Models to UDK with WoW Model Viewer

Exporting M2 models using WoW Model Viewer
1) Export the models from WoW Model Viewer as OBJ files to a new directory.

2) Run the 3DS Max script obj_to_ase_rescale.ms to convert the models to ASE files and resize them.
– Make sure the OBJ import options have “Import as single mesh” selected.
– The objects are being resized so their thumbnails will show up properly in the UDK.
3) Copy the toolbox folder to the new directory.
4) Run convert_wmv_models_to_udk.bat.
Import the textures into the UDK. Save.
Import the models into the UDK. Save.
– Alpha materials will need to be set manually. [Pic]

Output Example #1

Problems and Fixes
1) The models are being exported into many sub directories.
– Go to Options > Export Options > Uncheck “Preserve Directory Structure”.

Importing WoW 2.4 Characters with Facial Animations

Note: This uses the 2.4 WoW character models, which are pretty dated by now. I am leaving this here for reference purposes, but it is dated. If you wish to use something newer, look into the FBX export option.

This is an overview of how I converted WoW character models and added custom facial animations.

Exporting the model M2 file
1) Open WoW Model Exporter and load WoW 2.4.

2) Save the M2 and export the animation list-file.

Importing the character into 3DS Max
1) Open 3D Studio Max. Import the M2 using WoWM2Import.ms, set the FPS to 100.

The imported model will be very small. We will fix that in the next step.

Modifying the mesh
1) Right-click the viewport and select “Unhide All”. Select everything and scale by 5000%. Manually recenter.

2) Select the bones, add them to a new layer, then hide the layer.

3) Export with ActorX.
Optional: Change the bone size. Select the bones. Go to Animation -> Bone Tools. Change the width and height to 0.01.
Optional: Some characters have eyelids which need to be hidden. Create a new material ID for the eyelids.

Adding Animations
1) Download the toolbox.
2) Place the animation list-file in the wow/m2 directory.
3) Run convert_animations_to_max.bat.
– This creates a maxscript file that will save each animation as a seperate .max file.
4) Batch process the animations using ActorX. Use the “Process all animations” button.

3) Export as PSA.
4) Import the PSA into the UDK and untick “Anim Rotation Only” in the animation editor.

Teeth and Face Morphs
Most WoW characters don’t have teeth. In order to make better looking face animations, we will need to add them.
1) Import the teeth (I use teeth from Left 4 Dead 2 characters). Position and rescale to match the WoW mesh.

2) Add an “Edit Mesh” modifier to the WoW mesh and attach the teeth.
Change the animation time to 100 for these next few steps.
3) Locate the jaw bone (ex: Bone_NightElfMale_30). Create an animation of it opening by rotating it. It should be closed on frame 0, and fully open on frame 5.
4) Under the Skin modifier, select all the teeth vertices and change their weight so they aren’t affected by the jaw animation.

5) Add an Edit Mesh modifier, move the vertexes (and teeth) to create one of these face shapes.
– Dont move all the lips verts at the same time when shaping the mouth, it can produce inaccurate results.
6) Turn any mouth morphs off and export the reference with ActorX.
7) Turn on a single mouth morph and export with ActorX using a unique name. Repeat for each mouth morph.
– Make sure the animation is on frame 0 when exporting.
8) Import the reference mesh into the UDK. Create a new morph target set.

9) Import the morph targets and test to make sure they work.
– The order of the modifier list in 3D Studio Max is very important. If you can’t select vertices using an “Edit Mesh”, check the modifier order. Skin needs to be on top.
– To use morph targets with talk animations, the bone that controls the mouth needs to have its keys deleted. Note: Some of the idle and stand animations have mouth movements as well.
– You can not delete any verts when making morph targets, but you can move them so they can’t be seen (or delete them from the reference mesh).

FaceFX Setup
FaceFX will combine bone animations and morph targets to create out animation. First we will export the jaw animation we made earlier.
1) Load the FaceFX plugin in 3D Studio Max. Unhide the jaw bone. Under “Reference Bones” click the export button and select the jaw bone.
2) Move to the last frame of the mouth animation. Under “Bone Poses” in the FaceFX plugin, click export and enter an animation name.
3) Export the FXA file.
4) In the UDK, Right-click the WoW mesh and select “Create new FaceFX asset”.

5) Right-click on the mesh’s FaceFX asset and select “Import from FXA”.
6) Right-click the FaceFX asset and select properties. Add the morph target set.

7) Open the mesh in the animation editor. Under the mesh tab, add the morph target to “preview morph sets”.

8) Open FaceFX and select the “Face Graph” tab. Right click the background, under add node select FUnrealFaceFxMorphNode. Put the morph name under target_name.

– Keyframes can be added to the animation graph by right clicking the curve name under animations. Select “Curve Properties”. Untick “Owned by Analysis”.
– A tutorial that covers FaceFX usage can be found here.

Attaching Armor
1) Load the character file you saved earlier (before any of the “Edit Mesh” modifiers were added). Export with ActorX.
2) Attach to the character in the UDK using SkeletalMeshActorMULTI. This will allow both meshes to play the same animation.
3) Apply an invisible material to all the material slots except those you wish to render.

Attaching shoulders and helms
1) Export the character from WoW Model Viewer wearing the shoulders as a Milkshape file.

2) Open the Milkshape file and export as an OBJ file.

3) Open the WoW character in 3DS Max, import the shoulders OBJ file and make sure “Import as Single Mesh” is not selected.
4) Use the align tool to scale the shoulders to the WoW mesh.

5) Export each shoulder as an ASE file. Import into the UDK.
6) Place the model in the level as an InterpActor. Open the model properties and attach it to the appropriate actor bone.
– Offset and scaling can be done in matinee.

Animation Blending TutorialAnimation NodesMatinee Control
1) Create an AnimTree for the mesh using this setup.
2) Add the waist separator bone to the “Branch Start Bone Name” field.
3) Place the mesh in the map using SkeletalMeshActorMAT. In the properties, set the AnimTree.
4) Add a matinee slot for the mesh. Add an animation track for Slot_LowerBody and Slot_UpperBody. Use the curve editor to set their values to 1.

Problems and fixes
1) The shading on my character doesn’t look right.
– WoW models are generally emissive. Setting the materials to emissive will remove any blockyness.
2) The face animation is not playing when using a custom character skin.
– Previewing the animation in matinee will usually fix this.
3) Attachments are clipping/disappearing when the camera is in certain positions.
– This may be related to the attachment being too small.
4) Where can I find the hair textures?
– Look for paths similar to “textures\character\bloodelf\hair00_00.blp”.
5) How can I add the glowing eyes used by night elves and unded?
These are separate meshes that need to be exported, then attached within the UDK.

Source Engine Machinima Resources

The Valve Source engine games (Half-Life 2, Team Fortess 2, Left 4 Dead, Portal) are great platform for machinima. It’s a engine that is constantly being updated and has a huge fanbase, although there are a few downsides.

Pros
Huge communities dedicated to custom content.
An advanced facial animation system.
Many maps and models to start with.

Cons
No dynamic lighting.
An ancient map editor (Hammer).
All maps and models need to be compiled.

Useful Sites and Forums
TF2Maps.net – Team Fortress 2 mapping community. Lots of useful tutorials related to map making.
Interlopers.net – A Half-Life 2 community with many technical tutorials.
Steam SDK Forums – The official Valve forums.
Facepunch Forums – The official Garry’s Mod forums.

Tools
Crafty – A Valve map viewer and file browser, with export capabilities. [Download]
VTFEdit – A tool to view and convert Valve VTF files. [Download]
GCFScape – Allows you to browse and extract files from Valve packages (GCF, VPK, BSP, PAK). [Download]
MDLDecompiler – A tool to decompile valve MDL files into SMD format. [Download]
VTA Apply – Allows you to extract VTA animations from SMD model files. [Download]
GUIStudioMDL – Used to compile QC files. [Download]
Source SDK
MDLTextureInfo [Download]
BSPSource A map decompiler for Source games. [Download]
HLLib – Command line tool to extract content from Valve package files. [Download]
Propper – Propper allows you to compile VMF brush data as an SMD file.
VMEX – VMEX is a map decompiler for Source games.
3DS Max Plugins – Wunderboy’s 3DS Max plugins which include an SMD importer/exporter and a VTA exporter.
XVI32 – A simple and free hex editor, needed for decompiling models.

Other Links
Source Recorder Tutorial
MaxOfS2D’s Source Engine Tutorials
Episode Two Scripted Scene Example

Animated Cameras in Garry’s Mod

All credit for this goes to MaxOfS2D who first documented this here. For people who don’t use Garry’s Mod regularly, this is a little more detailed tutorial on how to accomplish this.

Bringing the Map into 3DS Max
Exporting a map with Crafty will allow you to export models, textures, and brush geometry. Crafty is capable of opening numerous file formats, including .vmf and .bsp.

1) Open Crafty and select the game you will be using under Setup > Profiles.

2) Open the map file. This will allow you to fully preview the map.

3) Go to File > Export. Export the map as .obj file.
– Note: Exporting maps will also export the textures. These are numerous and will take up a lot of space.

4) Import the OBJ file into 3D Studio Max.
– Make sure the “Flip ZY-axis” option is unselected.

Creating the camera animation
1) In 3D Studio Max, go to Import > Merge and select the camera2.max file.
2) Create the camera animation.
– Using “Walk Through” mode will make this easier.

3) Select the static_prop bone. Use Export Selected to export the animation as an SMD file.
4) Create a QC file for the camera which includes the camera animations. Save and compile with GUIStudioMDL.
– The SMD and QC files used in this example can be downloaded here.
5) Open Faceposer and create a VCD file that includes the camera animation.

Playing the animation in Garry’s Mod
You will need these lua scripts installed first (extract to garrysmod\garrysmod\addons).
1) Spawn the camera.
– The camera should use the Kleiner NPC.
2) Set the name of the camera by typing in console: ent_setname camera
3) Use the teleport.lua script to set the world position of the camera.
– teleport_target camera – Sets the camera as the teleport target.
– teleport_yaw 270 – Fixes the rotation (this step may not be needed for every map).
– teleport_perform – Teleports the camera.
4) Use the imview.lua script.
– imview_select_name camera – Sets the camera as the target.
– imview_toggle – Toggles the camera view.
5) Play the VCD by using the following command “ent_fire camera setexpressionoverride scenes/flying_camera.vcd”, or by using the NPC Scene addon.

The Result

Problems and Fixes
1) Decompiling a TF2 map produces a different 0,0 coordinate compared to in game.
– Check the 3DS Max import settings to make sure the coordinates aren’t being altered.
2) The FOV in game is different compared to 3DS Max.
– Using the Better Camera addon will allow you to set the FOV in Garry’s Mod.

Creating a Biped Source Model

If you wish to create custom animations for a Source character, you will need to create a rig after decompiling the model. One easy way is to accomplish this is to use a biped with the model.

1) Decompile the model (if needed) and import into 3D Studio Max.
– TF2 models don’t need to be decompiled, the SMD files can be found in steamapps\username\sourcesdk_content\tf\modelsrc

2) Under the Create > Systems tab there will be a biped option. Make the biped about the same size as the character.

3) Turn on figure mode. [Pic]
– The “figure mode” button is located in the Motion panel. This needs to be enabled before you can alter the biped.
4) With the biped selected, use the align tool to center the biped to the character’s pelvis bone.
– F3 will toggle wireframe mode, which will make it easier to see what you’re doing.
5) With the body mesh selected, right click the background and select “Freeze Selection”.
– This will make things easier to see and prevent you from accidentally moving the mesh.

6) Scale and align the biped bones to fit the character. The goal is to match the biped bones to the character’s bones, while making sure they stay in the middle of the mesh.
– Modify the biped structure settings as needed to match the character (number of fingers, number of spine links, etc). [Pic]
– Use the “Xtras” option for things such as the Demoman’s grenade vest or the Scout’s dog tags.
– Align things in the following order: legs, spine, head, arms, fingers.
– Make sure the biped bones are being aligned to the pivot point.

7) Use the link tool to link the character’s bones to the biped bones.
8) Turn off figure mode.
– Optional: Create a new layer and add all the Source model’s bones, then hide the layer.

Rigging through Scripting
An easier way to rig (in my opinion) is through the use of maxscript. You can find some of the example scripts I’ve made here.

This tutorial is largely based on this Youtube tutorial, although it has been adapted to use a biped (the Youtube video uses a CAT rig).

Adding Custom Animations to a Source Model

This is a short guide on how to add a custom animation to an existing character model. This does not go over how to animate, and assumes you have an animation completed and ready in 3D Studio Max.

1) Export your completed animations as SMD files to a new directory.

2) Copy the (name)_definebones.qci file to the new directory (example: F:\Steam\steamapps\username\sourcesdk_content\tf\modelsrc\player\pyro\scripts\pyro_definebones.qci).
3) Copy the toolbox folder to the directory.
4) Run compile_smd_animations.bat.
You should now be able to preview your animation in the SDK Model Viewer.

5) To play the animation in-game, create a VCD file using Faceposer.

Old Manual Method

1) Export your completed animation as an SMD file. [Pic] – Make sure the Valve bones are not hidden when exporting. 2) Using GCFSCape, find the original animation file for the model (example: pyro_animations.mdl), extract it to the local directory, then rename it (example: pyro_animations_original.mdl). [Pic] 3) You will need a definebone file. For TF2 characters these are included in the SDK directory (example: pyro_definebones.qci), for other games see this reference. 4) Create a QC file for the animation, mine looks like so. – It’s a good idea to use a prefix for your animation so they’re easy to find, in this example I’ve used a z_ prefix.

$modelname "player/pyro_animations.mdl"

$includemodel "player/pyro_animations_original.mdl"

$include "pyro_definebones.qci"

$sequence z_taunt_1 "z_taunt_1.SMD" fps 30.00

5) Compile the animation using GUIStudioMDL. [Pic]
You should now be able to preview your animation in the SDK Model Viewer. [Pic]

Problems and Fixes
1) How can I hide weapons during an animation sequence?
– Move the weapon bone under the model when creating the animation in 3DS Max.
2) When running the compiler I get a “filesystem.dll” error.
– This is usually caused by not having the SDK open when running the compiler.
3) Some of my in-game animations no longer work.
Some animations such as taunts will no longer display from player actions. This can be reverted by switching back to the original animation file.

Related Tutorials
Creating a CAT rig for a TF2 character
Basic animation of a TF2 character
Creating VTA files with 3DS Max
TF2 custom animation tutorial

Examples


Mapping with Hammer Tips

Hammer is the map editor used for Source engine games (Half-Life 2, Team Fortress 2, Portal, Left 4 Dead).

Creating your own maps offers a huge advantage when it comes to machinima. Sure you can always use existing game maps, but adding your own elements and design will bring your machinima to the next level.

The best way I’ve found to learn is by opening up existing map files and see how they’re done. You can find examples in your SDK folder.
– TF2 map VMF files are located in Steam\steamapps\username\sourcesdk_content\tf\mapsrc\

Example Map
When mapping for machinima, there are lots of other elements we dont need to worry about (such as player clipping areas).
You can download a very basic TF2 example map here. These should only take around 30 seconds to compile when using fast compile settings.

Compiling
Every time you wish to view changes to your map it will need to be compiled (File > Run Map).
Generally you should use fast compile settings. The official Valve maps should take somewhere between 2-6 minutes to compile (examples: 2fort 5:43, badwater 2:35, hydro 4:43). If it’s taking a lot longer there is likely something wrong with the map file.

Tips
– After compiling you may see a pink checkboard texture in some places. This means the cubemaps need to be rebuilt. Type “buildcubemaps” in the console, then reload the map (type “map mapname” in console).
– Add windowed mode to the launch options, this way you can alt-tab quickly without the game crashing.
– Compile only the entities when making minor map changes.
– Use Shift+W to toggle the snap to grid feature in Hammer.
– Use the Z key to toggle the camera in Hammer.
Increase the model render distance in the Hammer options (Tools > Options > 3D views).
– The skybox and ground detail names can be found under Map > Map Properties.
– TF2 game modes (arena, capture point) are determined my certain map entities.
– If your map leaks (or has any other VBSP issue), the water will be invisible.
– Decompiled maps are mainly for learning how something is done, they often won’t recompile properly.
– Make sure your skybox is perfectly sealed, any leaks will cause errors.
– A 3D Skybox can be used to create a background.

Links
Beginners guide to Hammer
BSPSource A map decompiler for Source games. [Download]
TF2 Environment Gallery
Official Valve Maps Decompiled
VTFEdit – A tool to view and convert Valve VTF files. [Download]
VMEX – VMEX is a map decompiler for Source games.
TF2Maps.net – Team Fortress 2 mapping community. Lots of useful tutorials related to map making.
Adding Custom Models to Source Games

VTA Apply

VTA Apply [Download] is a small program to extract VTA animations from SMD model files. It has some bugs, but it’s still useful for studying facial animations.

To run this program you will need a reference SMD, and a VTA file which can be obtained by decompiling a model.
– Only the newest version of MDLDecompiler (0.5) will export a VTA file when decompiling.

1) Run the program, you will be prompted to select the input SMD followed by the VTA.
2) You will be prompted to select a frame to export, the names for these frames can be found in the qc file from the model you decompiled.

3) Save the file. Import into 3DS Max. You will have to repeat this process for each frame you want to export.
– Some of the meshes will have a vertex count mismatch. You will need to add vertexes before you can use morphs.
– This will not work with L4D models.

Propper (Hammer Plugin) Tutorial

Propper is a Hammer plugin that allows VMF files to be compiled as an SMD. This is useful for making props for your map, or to export the geometry to 3D Studio Max. Make sure to install and configure Propper first. This is a very situational tool, but it can save you a lot of time when you need something specific.

Exporting Map Geometry Using Propper
1) Open the map VMF, select everything you want to compile and copy it to a new map file.
– Propper is not compatible with Left 4 Dead, but you can save the L4D VMF file and reopen it using the HL2 SDK.
– Make sure you delete any extra map entities, as they can sometimes cause problems with the compiling.

2) Select File > Run Map, under advanced select the Propper setting you created during installation.

3) You can now import the compiled SMD into 3D Studio Max.
– The textures will all need to be replaced manually, since the imported model will use VMT files.

Problems and Fixes
1) The texture tiling doesn’t look correct.
– Try changing the UV tiling to 0.25
2) I get a “Unparsable Vertex Data” error when trying to import the SMD file into 3DS Max.
– This can usually be solved by deleting any extra entities (such as func_breakable) before compiling with Propper.
3) A mesh I exported has ugly shadows when imported into another game engine.
– This can usually be fixed by applying a smooth modifier to the mesh in 3DS Max. The result.