More Awesome Than You!

The Bowels of Trogdor => The Small Intestines of Trogdor => Topic started by: wes_h on 2007 November 07, 20:25:41



Title: ANIM Editing
Post by: wes_h on 2007 November 07, 20:25:41
Here is an alpha-level program suite for editing animations.
The two main components are AnDis, an animation disassembler, and AniComp, an animation compiler.
For all practical purposes, you can take a game animation, use AnDis on it, the use AniComp on that and run it in the game. Some of the files reconstituted this way are not exact binary copies, usually the differences is floating point numbers out past six places or so. Well past the limits of the display.
I still have one unfixed bug that affects some fraction of one percent of the total animations that do not disassemble. I will fix this one day. While I do not have BV, someone that does reported that, except for the few oddballs, it handled all the BV animations also.
There is a set of program notesin the package, but they are not for the beginner or faint of heart. I use file associations so that I can just right-click in the explorer to disassemble or recompile things, and still double-click the file to edit it.
But you could just run them from the command line. They have no options, just the command and filename.


Title: Re: ANIM Editing
Post by: Inge on 2007 November 07, 20:37:21
Thank you very much :)  Can you just tell me where I can find the facial expressions stored?


Title: Re: ANIM Editing
Post by: wes_h on 2007 November 07, 20:47:25
In most animation files there is a faceblends section. Facial animations are morph type (vertex) animations. The disassembler will usually place these in a section with "-ap02" in the filename.

I attached a later version of the program notes here. There is some description of the facial blends and values, derived from work Marvine did.


Title: Re: ANIM Editing
Post by: Inge on 2007 November 08, 09:35:45
Oh boy!  Now to find out whether the senile dementia process has yet started in my poor elderly brain cells...

Later:  Ok, and my first missing brain cell revealed itself by not knowing what AniMesh is, and where I can find it.  :)


Title: Re: ANIM Editing
Post by: marvine on 2007 November 08, 11:48:32
I can't link there from my workplace, but you'll find the Animesh plug-in and related threads in R&D at MTS2, in the animations sub-forum :)


Title: Re: ANIM Editing
Post by: Inge on 2007 November 08, 13:08:31
Found it!  Thank you :)

Hmm no wonder I couldn't make head nor tail of all this:
Quote
First, if you have not ever made an animation with MilkShape, you will need to learn and practice that before you will understand any of what I wrote here.
it says in the txt.

Yes, well ok so maybe I need to find out what all that's about.  I had an idea that animations were all about "comments" whatever they may be other than forum posts :D

P.S. What doe "IK" mean?


Title: Re: ANIM Editing
Post by: J. M. Pescado on 2007 November 08, 14:50:37
IK is "inverse kinematics", a fancy term involving "here's a thingy, you figure out how to get it". Primarily, I see it in reference to the use of a sim's grabbo arm.


Title: Re: ANIM Editing
Post by: Inge on 2007 November 08, 15:32:51
I see!  Well if the sims really understood their world, that's how they'd operate all the time.  Then there would be no more solitary woohoo continuing long after the partner errored and snapped out of bed :)  It's a wonder any of them stay married as they can't even tell if the other is there or not when they're indulging.


Title: Re: ANIM Editing for th
Post by: marvine on 2007 November 08, 19:41:16
I've been trying to find a good explanation, that one works nicely  :D
Also, almost all in-game animations use IK for the arms and legs, wether there's an interaction or not. From an animator's point of view, it would be much easier to grab a hand or a foot and put it exactly where you want it with the skeleton following instead of rotating each bone of the limb in turn, ending up fiddling with 0.001 degree rotations to get more or less what you need.


Title: Re: ANIM Editing
Post by: wes_h on 2007 November 08, 20:12:17
It is interesting that the game engine supports IK in anim files. A lot of stuff converts the IK animation to FK keyframes for faster runtime operation. I have never attempted to match the disassembly with 3D coordinates on those IK movements, but I suspect there is likelyhood a close correlation. I believe you could copy the animation data for the arms from one animation, put them into a different one, and then alter the expressions, or take all the expression data from some animation you like and put it in one you don't.

It would be really nice of we had a nice 3D tool that you could do all of this in. Since we don't, I made do with what I could cobble together. One thing I learned in the process is that lots of maxis stuff was built bass-ackwards. The programming equivalent of baling wire and popsickle sticks.


Title: Re: ANIM Editing
Post by: dizzy on 2007 November 09, 04:04:55
In Animate Sim primitives, it looks like you designate an object or sim "IK Object" (usually in stack object). IK transforms are probably dictated by that object, so what's this IK stuff about?


Title: Re: ANIM Editing
Post by: Inge on 2007 November 09, 21:02:20
Right, I have set up the file associations, and learnt how to make animation frames in milkshape (using a bendy jumping box).  I am stuck at the bit where I export an animation from SimPE because it wants to make them into .5an files whereas according to the instructions Andis is expecting .5gd?


Title: Re: ANIM Editing
Post by: marvine on 2007 November 09, 22:14:56
Weird, Andis shouldn't expect .5gd files, I don't even think it can do anything with them . It works perfectly fine here with .5an anyway.

Dizzy: I wish I knew...


Title: Re: ANIM Editing
Post by: J. M. Pescado on 2007 November 09, 22:40:37
It's probably a manual error. Isn't a 5gd a mesh-thing?


Title: Re: ANIM Editing
Post by: Inge on 2007 November 09, 22:48:01
Oh I see now - I was reading the other text file that Wes uploaded with the detailed instructions of how to associate the file extension with the application.  I think it must have been a typo in there.  The text file that comes with the tool actually does say 5an.


Title: Re: ANIM Editing
Post by: Inge on 2007 November 10, 14:52:05
Ok, now I am stuck.  I changed the association so it's 5an, extracted a-react-surprise-standing_anim with simpe, and disassembled it into seven anmdat files and one anmctl file.

The readme is talking about having the right skeleton, saved as ms3d format, to go with the animations, but how do I find that mesh?  Presumably I want a sims face mesh - could I use any of my sims' face meshes for it?

And then I can't spot the next step either.  There seems to be a lot of info about the disassembled file formats - do they all need editing in a text editor?  Where does milkshape come into it?   I have read the readme over and over but it's not coming to me.  Basically for the purposes of what I was going to try, I am not intending to add any frames, just reduce the degree of movement in the face to make the expressions less exaggerated.


Title: Re: ANIM Editing
Post by: dizzy on 2007 November 10, 19:26:26
The meshes are all in Sims03.package, right? I'm not sure but I think you need a file like "afFace_tslocator_gmdc.5gd" for that.


Title: Re: ANIM Editing
Post by: marvine on 2007 November 11, 10:49:43
Inge, I'm afraid that you'll be disappointed: the face animations use morphs (I'd swear this is mentioned somewhere in the notes), and while you can edit the face blends in the appropriate anmdat file, Milkshape can't read them nor would it be possible for Wes to make it do so. You see how morphs are handled by the Animesh plugin, with dummy meshes to represent the morph's vertex locations? This works fine with the 3 fitness states, but you can see why it wouldn't with 27 face blends (if I remember well).
Also, with the body morphs we don't edit the "change fitness" anims, we just indicate the vertices's target location that the animations will use...
And right, Milkshape can work with vertex animations (moving the vertices without the use of joints), but I guess that designing a tool that would allow to do so in reference to the morphs would be a crazy coding work, if even doable.
Simpose allows to use the face blends, but the developer assigned arbitrary morphs that don't really represent what is possible in game so the expressions are limited, and he didn't include the eyes and teeth blends - so it's not possible to use Simpose for even a rough preview, by entering similar values. I googled the extensions of the files generated by Simpose a while ago when I realised that the developer wasn't working on it anymore, in the hope of finding that some kind of conversion would be possible (for somebody else  :D), and came up with industrial robot software >_<

Now, I've been working on a similar thing for the CAS face animations which are an old pet peeve of mine; I could do this in the anmdat file, but in this case I find it easier to change the blend values directly in SimPE, in the raw view tab - a little less hard on the eyes.
In this case, it's more a matter of finding acceptable values between the neutral face (0 for every blend) and the exxagerated expressions, so the lack of preview isn't a serious issue; it just takes a few loads and reloads of CAS to check where I'm going. Anyway, if I was able to change the main pose's expressions to my liking, I still didn't locate the animation files for the random face overlays or the close view.

The text files are more useful if you want to replace a face animation with an existing one: you'd disassemble both animations, and either paste the wanted face blends in the original anmdat, or link to them in the anmctl file, making sure that the timecodes match and editing them if necessary.
In fact this disassembler and compiler are really neat, they already saved me remaking a whole "get down" animation for the spiral stairs for which I had forgotten to add the sound effects on export, and stupidly overwrote the ms3d file. I just had to disassemble an EAxis stairs animation, make the number and timecodes of the sound events match mine, then link to these in the anmctl file of my own disassembled anim.


Title: Re: ANIM Editing
Post by: Inge on 2007 November 11, 14:08:39
Inge, I'm afraid that you'll be disappointed: the face animations use morphs (I'd swear this is mentioned somewhere in the notes),

It may well be mentioned in the notes, but it wouldn't have meant anything to me unless it then went on to explain "this means you can't use this tool for editing facial expressions" :)   But I thought it could be used for that because Wes said "We've even managed to change the facial expressions" in the other thread talking about this tool.  That's why I said "ooh let me have it then" and he replied with a link to this thread.  Are you singing from seperate hymnbooks or shall I just go back to sleep?


Title: Re: ANIM Editing
Post by: J. M. Pescado on 2007 November 11, 14:30:24
One technique that you can use to force simple facial expressions is to simply give the animation a null facial expression, and then overlay a stock facial expression on top of it as an Animate Overlay prior to launching some or all of the core animation sequence. It is advisable to split animations into small, discretized subanimation chunks rather than jumbo-canned-animations like some Maxis animations, as anyone who has experienced "animation-lock" where a sim WILL NOT QUIT DOING SOME STUPID THING until he has completed the entire LONG EXTENDED STUPID SEQUENCE can tell you!


Title: Re: ANIM Editing
Post by: Inge on 2007 November 11, 14:46:22
I'd lilke to stop sims animating their faces altogether (I don't mind if some chewing movements take place at mealtimes, but I don't mind if they don't either).  Can you think of a simple way of doing this?


Title: Re: ANIM Editing
Post by: J. M. Pescado on 2007 November 11, 14:51:13
Oh, REMOVING facial animation is easy. Just zero out all the face-bone-movements and they will keep their neutral face through the entire thing unless something else causes a facial overlay externally.


Title: Re: ANIM Editing
Post by: marvine on 2007 November 11, 18:31:09
It may well be mentioned in the notes, but it wouldn't have meant anything to me unless it then went on to explain "this means you can't use this tool for editing facial expressions" :)   But I thought it could be used for that because Wes said "We've even managed to change the facial expressions" in the other thread talking about this tool.  That's why I said "ooh let me have it then" and he replied with a link to this thread.  Are you singing from seperate hymnbooks or shall I just go back to sleep?

I'm sorry if I didn't explain well, technical stuff and English aren't very easy for me and I would rather have let Wes tell you more.
You can use the tool to change the facial expressions, but it's not convenient for completely new face animations - at this point nothing is.  I believe that what Wes referred to is that we were able to do cut-and-paste jobs with different animations, taking the face data from one to recompile with another. Or when I played with the morph values to understand how they worked, it allowed me to paste that in different test animations instead of retyping them all.
If you just want to set the expressions to neutral, Pescado is right, you can just set all the values to 0, either in raw view in SimPE or in the anmdat file - now I think it would be faster in the anmdat file: just keep the first keyframe with the values reset to 0, delete all the others - maybe unlinking the whole face anmdat would work too, but in this case the sim might get stuck with the last expression performed before the neutralized one.
Or would a behaviour approach like Pescado suggested be conceivable for this instead? I'm totally out of my depth when it comes to coding.


Title: Re: ANIM Editing
Post by: Inge on 2007 November 11, 19:35:53
Just zero out all the face-bone-movements

....  what?  where?  Does this mean opening and decompiling every single animation file?  I did try it programmatically by hacking all the facial overlay BHAVs and it seemed to help some, but they still went completely stupid on the phone etc.


Title: Re: ANIM Editing
Post by: wes_h on 2007 November 12, 03:06:40
I am sorry I cannot spend very much time until tomorrow evening explaining due to real life stuff.
But there are two different animation tools I have made.
AniMesh is a MilkShape plugin that converts skeletal animations (for body or object meshes) made with MilkShape directly into the TS2 binary format (tagged .5an). It is posted on MTS2.
Animax, which is posted here, is a two stage toolset that you launch via commandline or file association. Stage one converts the Maxis binary to a text script format that I dreamed up one day. The compiler converts that same format back to Maxis binary. If you change nothing between stage one and stage two, you should expect that the edited file performs the same as the original one, even if it is not a perfect binary copy.
The power comes from being able to cut, paste and modify the values between stage one and stage two, or to swap portions gathered from different disassemblies into a composite binary. This you do with Notepad or such. The changes one could make include being able to alter the values of the facial morphs, each of which form a part of an expression. The best documentation that exists unless someone else experiments and writes more is the material that Marvine wrote, which I copied into the second readme.
My general observation is that animations that are not defective in their binary format will not crash the game, even when the actions they dictate are grossly wrong. Remember, we started this with a conversation about plumbing the less dissected aspects of TS2, and so I made these tools available fro interested parties to use and learn with.
While I am definitely interested in suggestions for improvement, I can say I started working on animation stuff last year, although in fairness I will also say that some periods of time went by in which little progress was made. And despite my starting from a base of knowledge contributed by Miche, Atavera, DataFarmer and all the other early decoders, a lot of research and learning was necessary to get it this far.
So I am sorry if you expected a graphic design tool for the facial expressions, but that is a tool that is not easily possible to make at this time, although I have thought of cobbling one together using the likes of OGRE. In the meantime, the humble offering I have already made is all that I know of that is available.
<* Wes *>


Title: Re: ANIM Editing
Post by: Inge on 2007 November 12, 11:05:31
No I didn't expect a graphic interface, so I used it from the command line without a problem.  I was confused by the fact there was a dll that appeared to be named like a milkshape plugin included with the distribution, so I thought that the disassembler was creating something that would could be imported to milkshape.

I'm wasn't complaining, just confused.


Title: Re: ANIM Editing
Post by: wes_h on 2007 November 12, 18:42:23
There is a MilkShape plugin in the package, and it is a sort of animation importer. It scans a .anmdat file (mainly ap01) and will attempt to convert some of that data into MilkShape animation format. It does not do a good job, because the arms do not always come out right, and because the vast majority of the game animations use IK animation for the arms and legs, and there is no support in MilkShape for IK.

Importing Object animations would be far easier, and I would like to see that worked on, too. The AniMax concept could help there, too.

<* Wes *>