Things you will need:
- 3ds Max
- ActorX and/or 3DS2UNR if like me your ActorX wont export VertMeshes you will need 3DS2UNR
- Unreal Tournament 2004Download 3ds2unr here
Download ActorX here
Download PDF version of this tutorial hereIntroduction:
This tutorial is designed for use with unreal tournament 2004, much of the principles and techniques can be transferred across different platforms. Once you have your model made in 3dsmax and you come to animating it, it’s good to think about what type of animation would be best suited to your model. In this tutorial I will show you how to use the modifiers that come with 3ds Max to animate the vertices of your model and how this information can be imported into Unreal Tournament 2004.But first…Why Skeletal Animation? A skeletal animated model is composed of a mesh (your 3d model) and a skeleton with a valid hierarchy. In 3ds Max you can use Bones or Biped to create the skeleton. Both have their advantages and disadvantages. The bones are then attached to the model and each vertex of the model is then weighted to a bone that will control its movement. This is known as Skinning and in 3ds Max if you used Bones to create the skeleton you will need to use the Skin modifier to attach the bones to the model. You then move and rotate the bones to create the animation.When you use ActorX (for Unreal models) to export your work it will create 2 files, a .PSA and a .PSK file. The .PSK file saves the mesh information. It holds one copy of the mesh and the bones. The .PSA file saves the animation information, it holds information about the bones, and how they move and rotate for each sequence. This information is relatively small in comparison with vertex animation because it only needs to record the information once.
A skeletal mesh can be used to spawn effects at the bone locations. The bones can also be used in other ways, to hide parts of the mesh i.e. in ut2004 when someone is decapitated; the head bone is hidden thus hiding the head of the player. This is not possible with vertex animation and a completely new “decapitated” animation must be made to achieve the same effect.
Bones can be used to animate arms and legs in a very realistic way and in a fraction of the time it takes vertex animation to do the same thing. But more complex animation, such as a ripple is very hard to achieve with skeletal animation and would require a very large number of bones. Vertex animation however, would have no problem animating a ripple, and in a fraction of the time it would take skeletal animation.
Why Vertex Animation? Vertex animation is older and different to skeletal animation. You can use anything to animate the mesh including bones and modifiers. The bones will not be saved when the mesh is exported. Instead, for each frame of animation a copy of the mesh is made. This is how the information about where the vertices have moved is saved. Unlike skeletal animation (which only has 1 copy of the mesh), the file size of the vertex animation information can balloon very rapidly according to the number of vertices and the number of frames per animation. So keep this in mind when you model and animate your mesh. Try to keep the triangle count as low as possible and the animation as short and to the point as possible.
Vertex animation can be used to achieve very complex and dynamic effects which skeletal meshes could never do (not without using an insane amount of bones and time!).
One thing to note about vertex animation and Unreal Tournament is that any “overlay” effects (such as when a player is hit by the link gun or shock rifle) will not work properly. This is because the overlay is applied to the mesh of the model. Because skeletal meshes have just 1 copy of the mesh this is fine as the mesh is always visible. But vertex animation uses a different mesh for each frame of the animation so the mesh that the overlay effect was applied to is instantly swapped out for the next mesh in the sequence.
Step 1: The first step is to make sure our scene within 3ds Max has been set up properly. We need to make sure the units match those that unreal uses. To do this simply open the Units Setup menu by going to Customize>Units Setup… and select Generic Units.
There are some rules that must be followed when creating a vertex animated mesh for use within Unreal Tournament. The vertices of the model must never leave a 128×128 bounding box. Keep in mind that when you animate your model it may move outside of this box. But this doesn’t have to be a problem, simply make your model really small. It can be rescaled inside unreal tournament or when we come to import it later. To make sure I stay within these limits I like to make a simple cube which I then freeze in box mode. So let’s do that first! Create a 128x128x128 box by going to Create>Box then click and drag your box. Type in dimensions of 128 in the Length, Width and Height settings in the parameters rollout of the box. Click the Select & Move tool and move the box into the center of the scene. You can do this quickly by typing 0 in the X transform box (at the bottom of the screen), 0 in the Y transform box and -64 (because half of 128 is 64) in the Z transform box.When the box is in position right click it and go to Object Properties. Inside the object properties window, under the interactivity section check the Freeze box. Then under the display properties section make sure Display as Box is checked. Sometimes to make the box more visible I like to de-check the Show Frozen in Gray box. Click Ok when you are done. Step 2: The next step is to create the mesh that we are going to animate. For this tutorial I will show you how to use the ripple modifier on a flat sheet and how to save that information out as a VertMesh. These methods can be applied to your own models. Make a sheet (Plane) that is 50 x 50 with Length and Width segments of 15. 15 is quite a high a number, but it should allow the model to deform nicely with the ripple modifier. Step 3: Add the Ripple modifier to the model by going to Modify (blue rainbow symbol)>Modifier List>Ripple. Make sure you are at Frame 1 in the animation time line and turn on Auto Key mode. A red outline should appear around the screen. The next step is to set the number of frames we want. Open the Time Configuration menu by clicking the tool with a red clock in the bottom right of the screen. Leave all the settings and change Length to 20. Click OK. You should notice the length of the frames has changed at the bottom of the screen. Now we can start to use the modifier to animate our model. In the Ripple parameters insert the following values:
Amplitude 1: 3.0
Amplitude 2: 3.0
Wave Length: 38.0
Move the slider to Frame 5 and change the Phase to 0.5. Move the slider to Frame 10 and change the Phase to 1.0. Move the slider to Frame 15 and change the Phase to 1.5. Finally move the slider to Frame 20 and change the Phase to 2.0 to make the first and last frame the same so that the animation will loop. Each time you make a change to anything to the scene (whilst auto key is turned on) it will be recorded on the timeline and you will see a box appear on the frame that was active at that time. The box can be different colours which indicate different things to make things faster and clearer. For example if you rotate the model you will notice a green box appears indicating that rotation has taken place on that frame. These frames only appear for the currently selected object in the scene. Play the animation.
Step 4: Now the simple animation is finished turn off Auto Key mode. Name the model something logical like RippleMesh00. Add the 00 to the end to indicate this is mesh number 0. This is helpful for the exporting process. Now we need to record the animation and save it as .3ds files that unreal can read. To do this we need to take a “snapshot” of the model. With the model selected go to Tools>Snapshot… A small window called Snapshot should open. We are saving a range of frames not just 1 so select Range. Next we need to input the actual range of the animation time line that we want to convert. So in this case we want to save it from frame 0 to frame 20. Under Copies we need to tell it how many frames there are in total (how many copies of the mesh to make). The range 0 – 20 consists of 21 frames NOT 20! (Because frame 0 is also a frame!) So input 21 in the Copies setting. Make sure Mesh is selected in the Clone Method section and click OK. You should see that new models of each frame have been created ranging from 1 to 21. Because we named the model with 00 at the end you should see when you press H (Select from Scene shortcut) a list of all of the meshes will appear, and in order! Select meshes 1 to 21 (It is ok to select the 00 mesh as the converter will ignore it anyway ;)) With all of the models selected go to File>Export Selected… and save the file as .3ds. I named mine RippleMesh and saved it to my desktop so I can move it to the correct folder shortly. Click OK if the Preserve MAX’s Texture Coordinates option pops up.
Step 5: The next step is to import the files into unreal but first we need to create our project folder, just like you would if you have ever coded anything for unreal. First create a new folder in your UT2004 base directory; this is your project folder. Name it something unique and relevant such as MyRippleMesh. Within that folder create 2 more folders, one called Classes and one called Models. Move your .3ds file into the Models folder. At this stage download and move the 3ds2unr.exe file to the Models folder. Add your project to the list of EditPackages inside the UT2004.ini file which is located inside your UT2004\System folder. (Inside the UT2004.ini file scroll down to the list of EditPackages under the Editor.EditorEngine section and add yours to the end).
Now all we need to do is convert the .3ds file into .3d files that unreal will import via unreal script. Open a new DOS command window by going to Start>Run… Type cmd in the space next to where it says Open and click OK. Navigate to where you installed your copy of UT2004. Then navigate to your project folder and to the Models folder that was created inside. The directory setup should look similar to this C:\UT2004\MyRippleMesh\Models>. Type “3ds2unr –setproj” without the quotations. This opens 3ds2unr’s Browse for Folder window. (This is how we tell 3ds2unr where to do the converting). Navigate to your project folder e.g. C:\UT2004\MyRippleMesh and click OK. The next step is to convert the .3ds file. We need to tell it the name of the .uc file to create for our mesh (this is also the name of the mesh) and the name of the animation. The syntax is “[3ds2unr] [Nameof.Uc] [NameOfAnimation.3ds]” so in this case type “3ds2unr RippleMeshClass Ripplemesh.3ds” without the quotations marks. If all went well you should see it say “imported 20 frames”. If you included the 00 model then you might see a warning about a frame being out of sequence. You can safely ignore these. If you see a lot of errors about vertices then it means your animation went outside of the 128×128 bounding box limit. If all went well you should find in your Models folder 2 new files have been created, one that ends with _a.3d and one that ends in _d.3d. If you look in the Classes folder you should find a new .uc file has been created that contains import code. This is the code the UCC compiler needs to import the model into your package. But before we can do that we need to fix the code slightly as it is not fully compatible with UT2004. Open the new .uc file in your favourite text editing program. I like to use Textpad.
The first thing we need to change is the class declaration line. Where it says “expands” needs changing to “extends”. If you unwrapped and textured your model you may have to comment out some extra lines about the texture but as we didn’t let’s move on! Now all we need to do is compile our package. To run the compiler you can open a new DOS command window and navigate to your UT2004\System folder and then type “ucc make” without the quotations. To go down a directory type “cd..” without the quotations. To go up a directory type “cd NameofFolder” without the quotations. To change directories type “Drive Letter:” without the quotations. For example to change to your C: drive simply type “C:” without the quotations. Remember that in order to compile new versions of your package, the old version must first be deleted from the UT2004/System folder.
When you have compiled your package you can view the new VertMesh inside the unreal editor. Inside the editor load your package by going to the Actor Browser>Open. Then to view VertMeshes simply go to the Mesh Browser and select your mesh, in this case RippleMeshClass.
That’s it! Well done for completing this guide. You can use more than one modifier to animate your model. And even a combination of bones and modifiers.
TIP – You can use anything to animate a vertex mesh.