[MDX to M2 Conversion] Animation Repairs


Description

A short guide on fixing corrupted animation data using a hex-editor

Hey everyone, ive been learning a lot recently specifically with converting some MDX files made for Warcraft 3.
To preface, im starting this guide with an already-converted .m2 file from a source .mdx, i used the Lazy  Converter and assigned animation ids by hand.

So you've managed to convert your model, but now all its animations are jittery and look like garbage! Well not a problem, this is something we can *somewhat* easily fix on our own, without the help of something like Blender or other Model Editors.

To start, choose a specific animation you want to clean up first, in this tutorial ill be using my models "Attack Unarmed" animation, locate the animation ID using 010 and a matching .m2 template from the Animations block, refer to the animation by the ID referenced here:
image.thumb.png.a587725723214b115cb0ea164596c1a1.png
We can see here, my animation ID is 17, with that in mind we can move on to the Bones

We need to pick out specific bones based on the animation itself, use Wow Model Viewer and find the animation you selected previously. In the below gifs, you'll see the offending animation in all its glory, ill be specifically targeting the leg bones for this tutorial
image.gif.af4e9ef9f13df3124b94453bde0b2135.gif
Now in WMV go to View>Show Model Control, uncheck "render" and check the "bones" box until you can see a visualization of the bone structure:
image.png.e9943d5e8af76b7ab97bc6cffcf1e980.png
The given render of only the bone connections is useful in finding specific bones in the structure
Picking out the right bone can be difficult, but usually you can use the parent structure to find the bone you want
In my case, the legs are connected directly to the waist, and visibly we see 4-5 bones in each leg chain
image.thumb.png.11929ebaa6b1ef2c2284fa4906f9d0b4.png
With the given image, we can see that bone #2 is the waist, we can see all the bones connected to bone #2 in the image as well, with smaller offshoots being bones 8-11
That being said, we have two chains of 5 bones each starting at bone 2, those ranges in my case are: Bone #3-#7 and Bone #12-#16
Now that we've narrowed down where we need to make changes, lets open up a bone and see whats inside. 9/10 times  the corrupted data is within the Rotation data for the animation. Bones store each animation separately in its own block like this:
image.thumb.png.a131bbe79dfce5177ac45b751bf3d744.png
Right here we've located the anim id #17 data for a specific bones rotation data. Not all data is corrupted, but some definitely is let dig a little deeper to see exactly what the problem is:
image.thumb.png.728d16bf54ad5a411808a26c99d05f44.png
As you can see by the giant red boxes, some of the data here does not follow a regular "pattern", specifically, look at the 4th value in each line, these are labeled as the "W" value. These values should always line up near each other, at least with the same polarity.
In order to fix this, we simply need to target the corrupted lines (the ones in boxes) and swap their negative and positive values.
Heres the end result here:
image.thumb.png.c526a5e7ba2a4e41e42d0c3f14136592.png
Now my data is following a regular pattern, with emphasis on the W values being in-line
Congratulations! If you've made it this far, you just repaired the animation data for a single animation on a single bone! Great job!
Lets keep working through each leg bone, fixing each set of corrupted values so that the "pattern" is intact:
image.thumb.png.602fb28022c6579476b9d2dd78185e7a.png
This bit of data corruption follows a different pattern. You'll notice some 0 values and some that are .000061, these are essentially null values, we need to leave them alone, that being said, the W and Y values here are corrupted. Lets fix them like this:
image.thumb.png.056f31e1eebf47d46131d4aaf63112f7.png
Looks much better now, keep working through the structure until you finish all the bones in the set.
Now we should be good to go, lets save the .m2 and try it out in-game or in the model viewer.
Excellent! Were on our way to a fully working model! This process takes absolute ages, and is a bit tedious for beginners. I strongly suggest enlisting some help, perhaps 2 could split animation data down the middle and merge corrected data together when finished
image.gif.0e921d31c87bcf2ab95106e258365ea6.gif
Thats all for now, happy editing!

 

 

  • Like 2
  • Thanks 3


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now