Exporting an animation into Havok format, which is the format Elemental uses, had been driving me crazy for a long time. Now I think I have debunked one great mystery on how to get the skeleton, mesh and animation into a separate file. If you explore Elemental's folders you will find out that this is the way the 3D assets are handled and you will find all these files separated all over different folders.
In order to be able to do this you need to download the following:
Havok Content Tools http://software.intel.com/sites/havok/ approx 250MB. You need to fill out some info first.
First of all I did this using a model that was made for a Havok Tutorial that can be found in the digital manual that comes with these tools. I highly recommend that you read this manual as it contains info on all the filters and has some tutorials that help you understand how it works. The tutorial I followed was "Tutorial: Export and Animation Basics" and the model used for this tutorial can be found in the "scenes/havokContentTools/tutorials/exportBasics/tutorialStart.max" folder. This model contains a girl that is running forward and I hope that what I did can be carried over to any model you may have.
Ok so now that you opened the model the first thing you want to do is navigate to "Havok Content Tools" in the main bar and click Export. This will bring up the Filter Manager and is the only place you'll need to fiddle around to get your files. I won't be going into much detail since I still don't really know how to properly use most of these filters, so feel free to experiment with them and if you discover something feel free to share the info .
It is extremely important that you take note of the order the filters are placed. The filter order goes from top to bottom and if you place em in the incorrect order you might get errors and get unexpected results. Also note that moving them around is fine, you will only get errors at the time you press the "Run Configuration" button seen in the picture below.
The first Filter you will add is Trasnform Scene, and I added this because according to the tutorial Havok's runtime uses meters as it's base unit and since 1 3DSMax unit is 1 inch this is required to properly trasnform the model's size. Add the filter as shown in the next picture and choose "INches to Meters" on the right hand side options:
The next filter you will add is the Create Skeleton filter found in the animation tab. The name is self explanatory and if you opened the Havok Tutorial girl you will see that the bones are added to the list on the right side of the Create Skeleton options. Now I'm pretty sure that for our own custom models we will have to manually add our Rig. In that case I think you only need to click the "Manual" circle in the Build Rig options. After doing that the Add button in the Bones section will turn on and you can manuall add the bones. The same applies to the animations.
After adding your skeleton the next filter you will add is the Create Skins filter, example below:
Up next is the Create Animation filter. This one has similar options to the create skeleton option for obvious reasons, and in the case of the Havok tutorial the Automatic Option worked fine:
Now if you want you could use the Preview Tool to see what these filters will be creating. The preview tool is really really useful since this way you don't have to create a file everytime you do some changes. In fact you should use the preview tool everytime you plan on actually creating a file. Anyways add a Preview Tool to see what happens by going to the Graphics tabs like seen in the next pic then click "Run Configuration":
If you ran the configuration above, then you should get a Havok Preview of the girl running a constant loop:
Thats what it would look like if you made an .HKX file right now but thats not what we want. We want to break the Mesh, Animation and Skeleton into three separate files. How do we do that then? Well lucky for you I kept banging my head on this for a long time. The answer is simple, you need to add "Prune Types" filter. What this does is it "Prunes" or deletes parts that you specify, like the Skeleton or the Mesh which in the end will allow us to have our desired result! Yahtzee.
Ok so now we need to add the Prune Type filter and please remember it is EXTREMELY important that you properly order it in the Configuration set as seen below:
Notice how I moved Prune Types ABOVE the Preview Tool. If I leave Preview tool above Prune types then I would get a preview of the first 4 filters but I would'nt preview whatever the Prune Types did.
If you notice the Prune Types options on the right, you can see there are several Boxes you can check. These boxes are what we want to play around with.
At this point you should be able to get rid of the Preview Tool filter, but I highly suggest that you run it everytime you make a change. Now that we are almost done, I'm just going to give you the check boxes that you need to enable in order to export the Mesh/Animation/Bones into separate files.
First of all, in order to export the file you need to add a "Write to Platform" filter which will create the .HKX file we are looking for. Example below:
You should choose an easy to look location (like the Desktop) as your path to save your file. If you don't change the default filename then you need to create the file, then go to the directory and rename the file you created, because if you don't the file you create next will have the same name and will Override the previous one.
You need to do this 3 times, 1 time for each the Skeleton, Animation, and Mesh. Below are the settings you need to change in the Prune Types Filter in order to obtain the desired result.
Settings if you want the Skeleton only:
Settings for the Animation only:
Settings for the Mesh only:
Now you should be able to have 3 separate files each containing an Animation, Mesh, or skeleton. If you want to test this, go to Start>All Programs> Havok and look for the Havok Preview tool.
If you open this then drag these 3 files 1 by 1 and click "just" add to scene you should be able to see the fruits of your labor. Note that if you add the animation file you will not see anything at all. Same for the skeleton, if you add the skeleton by itself it will be just standing there. If you mix them both then the skeleton will start running. Same for the Mesh.
Thats that, I hope that this really means that we can actually import our animations into the game. The next step is to figure out if we can actually do it through XML atm. I will be attempting it sometime soon but if someone wants to go ahead and try here are the 3 files for the exported animations.
Mesh: http://dl.dropbox.com/u/8088480/GirlMesh.hkx
Skeleton: http://dl.dropbox.com/u/8088480/GirlSkeleton.hkx
Animation: http://dl.dropbox.com/u/8088480/girlrunningAnim.hkx
Reserved
Great news, I managed to get my animation in game. In my case I added it as a Pedestrian Prop! Woot this means we can add any asset into the game (I think). Next I will try to add her as a custom sovereign.
Here you can see the brand new girl prop running in an endless loop as her Idle animation. I had to do some XML tweaking but it wasnt that hard to do. There was an orientation problem, she was running into the ground instead of over it, but since this was a prop I just rotated her to the corect position.
Heres the XML changes files that you need in order to get her into the game as a Pedestrian prop in the tile editor.
This first XML file creates the animation pack. Here I believe you set the animation types like the Idle animation. I suppose if you change the Idle tag to attack or cast spell then it would do that animation when attacking etc.
http://dl.dropbox.com/u/8088480/GirlAnimXML.xml
The second file sets my model as a Pedestrian prop, in it you specify the Mesh (model) and it's corresponding skeleton. You also asign an animation pack in this second file.
http://dl.dropbox.com/u/8088480/MyAnimProps.xml
There ya have it, I believe with this info people should be able to get into the game any type of model/animation. Next for me is trying to get the Dragonlance Draconian in the game with its own animation pack. Hope this helps!
Great job.
If you use the "run all configurations" it runs all the config templates. So you can set up 3 different configuration sets, each one aimed at exporting mesh/skeleton/animation. This will save you some time if you want to stream-line the process.
If you're looking to do some hardcore animation, you can even set up more configuration sets, each one covering a certain set of frames.
Adding 3 templates is really nice indeed, I saved a bunch of time messing around with a prop I wanted to get in the game. Last night I was experimenting some with animating stuff and I came up with the lame idea of making a door that was trying to be forced open. This experiment yielded some interesting results that I think I should share with fellow animators.
Ok so first of all, I tried animating the door the easy way, I just rotated the door object itself to make it seem as if it was being forced opened. This did not work for me. If you run the Havok Filter and run a preview without using the Prune Type filter you will see the door doing what it's supposed to do. The problem is that when you try to separate the animation/skeleton/mesh and then put them together it will not work and the mesh won't be affected by the animation.
The solution for this was to add a simple bone and apply a Physique modifier to the door. Then just animate the door by rotating the bone and viola, that will do the job.
Extra Note: I noticed that I couldn't add my door prop as a <Tag>Structure</Tag>. All I got was a black area that had no movement/animation. I decided to change the tag to <Tag>Pedestrian</Tag> and that did it. So it seems that the only props that will (look for/work with) animations are pedestrians?
That's to be expected though. The game only expects to find animations in certain types. You most likely can't animate a sword in an itemtype, for example.
actually if you change the model path of the attachment to say a unit model it will be animated sitting on his hand. So I think there is some other information that we will need before we can animate a spinning saw blade of doom weapon.
I was trying to get this to work with a custom model to no avail, just doesn't show up.
I've been experimenting with more animation stuff since my last post, so I guess I've been at it for almost 2 hours wth did that time go damn... Anyways I just found about the attachement code trying to get a custom sovereign to hold a custom made "sword". I failed in getting the animations properly working for my super Stickman sov. At least, this time around the game didn't crash.
I did manage to get some interesting results when exporting my HKX's. First I created a Stickman, then I gave him a crappy animation and finally I exported the skeleton/animation/mesh into separate files. Opening these files in Havok Preview tools shows that it works as intended.
Next I wanted to add a sword that would follow that animation/skeleton so I deleted the mesh and made a shitty looking "sword" then attached it to the right hand. I then exported the Sword Mesh only and when I added it to my other 3 previous files the sword attached to the right hand and followed through the animation.
Maybe this is a possible way to add weapons and equipment? Also I just started using 3ds max like 2-3 weeks ago so I'm still a complete noob at it and I have no idea if there is anything that designates the hands as an "attachment" slot. Hope this helps some, and thanks for the comments/ideas!
From past experience it is usually a reference point ,node, or bone with a certain name, such as "hand_left_lcf" that follow along with that "hand bone", that allows the attachment of the item via code later.
The xml exports of current skeletons contains references to something called hkSimpleLocalFrame these in turn contain references to boneindexes.
Ex:
<hkobject name="#0041" class="hkSimpleLocalFrame" signature="0xe758f63c"> <!-- memSizeAndFlags SERIALIZE_IGNORED --> <!-- referenceCount SERIALIZE_IGNORED --> <hkparam name="transform">(0.000000 -0.000000 1.000000)(0.196116 0.980581 -0.000000)(-0.980581 0.196116 0.000000)(1.178301 5.891504 1.051860)</hkparam> <hkparam name="children" numelements="0"></hkparam> <hkparam name="parentFrame">null</hkparam> <hkparam name="group">null</hkparam> <hkparam name="name">Unit_Mount_Lcf</hkparam> </hkobject>
and later on
and here http://origin-software.intel.com/en-us/forums/showthread.php?t=62769&o=d&s=lr is a post that says that
Amazing work Civ. Yet another breakthrough by a Dragonlance Mod team member.
So today I got another step closer in uncovering the secret required to import your own custom animations into Elemental. I've been trying to get the model I made for my animated pedestrian and using that as a custom sovereign. Getting the model in itself to show isn't a problem, but animating it on the other hand is. If you look through the sovereign animation packs xml you'll see that theres a bunch of stuff there, which is basically defining the packs and subpacks, which in turn define the type of animation which determines what file contains said animation.
So I went and used the same animation for an Idle, Run, Pose, MIrroridle just to see if I could get my custom sov moving. The good news is, the game isn't crashing. The bad news is I haven't gotten the sov to move at all, except this one time that I forgot to put the skeleton hkx file, which resulted in the sovereign actually moving, but as a big blob as seen bellow .
At least it was moving and it didnt crash..
Another thing I confirmed is that the Up Axis in the game is Y, and the forward axis is Z. This is a good thing to keep in mind when creating stuff to avoid problems. There is a rotate filter in the havok menu but idk if I'm doing something wrong but I cant get it to get my character looking in the right direction.
Thats it for tonight I hope, come back tomorrow to see how much more I keep banging my head on this >.<
Civfreak, your work is incredibly helpful, but can't we get some dev help on this? It's kind of messed up that people have to figure all this stuff out the hard way.
I finally got got an animation to work!!!!!!!!!!!!!!!!!!!!! So far my attempts have been futile and my model refused to move the slightest till today. I decided to try and make an animation pack containing all the types to see if I could get anything going and making a separate race as well so I could test it with that.
I decided to copy all the CPELF XML files so I could follow it as a guideline and I modified em by adding a SM (For stickman) tag in front of a bunch of stuff in the animation packs/coreunits and coreskins.
So after a while of testing and back and forth loading I actually got my custom skeleton/mehs and animation working woooooooooot (sort of). First I noticed something weird. My FUC**NG model was lying on the ground looking up... At least it was moving. But I was confused because when it had no movement, he stood up correctly so wtf?
So next logical step was to rotate the model back to the original position, even though when it was static it was in the correct orientation.... So rotate 90 degrees and bam... the model was standing up and doing my idle animation as it was supposed to...
So yeah I'm not exactly sure what I did but I do know this was really pissing me off. The head above is a separate file that contains the head. I learned this thanks to looking through the Elves xml. The head is a frigging equipment... And in the case above that head is looking in a different direction because I was lazy and only exported a rotated body/skeleton.
But the point of this post is to inform whoever cares that it does seem possible to get your custom shit in game, although doing so ain't no easy f*%^&$& task.
@Onion
Thanks for the comment, as for the devs helping I was told by one that they use Maya mostly for their animation stuff so I wouldn't count on getting help on anything other than that, at least for now.
Indeed for now any tools for helping us are in maya. We will see how it goes, and I will keep you filled in on any progress I make with the tools.
As it seems when animating up is up in maya and you simply keep origin as the ground, or attachment point if you are making a static item.
I will look into animations myself shortly.
I am impressed at the progress you have made without the tools.
Thank you 3DG, I hope you don't have much troubles playing around with Maya and I'll be looking forward to your progress with your models . Do you know how I can create attachment points in 3DSMax? I read through some stuff and I figured it was a Dummy but I haven't really tried it yet.
It seems to be a point, in the helpers toolbar. And I would try naming it exactly the same as an existing atachment or try something new but remember exactly what you called it. Export it with the skeleton file, should work.
Ohhhhhhh thats kind of obvious and I didn't think about it dohhhhhhhhhh. I'm going to try this now see what happens!
On another note I found out that if I export a model that is not whole I will get problems with the ingame animation.
Example: The stickman's mesh I've been using for testing purposes was made up of 2 meshes. The head and the body. So I exported it all to a single file and when I start the game, the model gets all distorted. So I went back and deleted the head and just left the body and that fixed the distortion issue.
Point of the story = make models a single contiguous mesh or it'll get all fked up. At least thats what I've managed to do so far.
Well points didn't work for me, but playing around with 3DSMax I found that there is a modifier called "Havok Local Frame" which I added to my skeleton's hand but when I went into the game I couldn't get a weapon on my hands. When I open the skeleton in the Havok Preview tool the XML looks similar to how a Sovereigns Skeleton xml looks. So I guess this is another tiny step in the right direction.
As for the Havok Local Frame modifier; if you add it to a bone you will get a big "LF" over that bone in the view port. This modifier has only 2 options you could change and they are: 1)Name 2)Group.
Now I named it hand_right_Lcf and did the same for the group because thats what the XML files has for most weapons and because I honestly don't know what else to put. I wish some dev would help with a tiny bit of info, while I am making progress it is getting extremely frustrating and blahh.
Anyway hope this is of use to someone out there.
Did you name the point correctly?
Yup, I named it "hand_right_Lcf". I tried several other things as well; like making a dummy, renaming the hands as well as applying the modifier in the example above and nothing seemed to work.
One thing I did notice was that when I open my model in the havok preview tool and then I open one of the game's model in the same scene my model will be in a different axis. But when I go to the game my model is standing up correctly and facing the correct direction... Does it make sense? Not to me .
There are many great features available to you once you register, including:
Sign in or Create Account