Animated Milkshape Model -> Panda3d

I am using Milkshape 1.8.4 and trying to export a model with a single animation to .x. I tried exporting the mesh and materials separately from the animation. The export goes well, as does the conversion to egg format.

The static model works exactly as expected. The animation, however, does not.

I tried the suggested exporting to SMD and back after clearing and the animation didn’t work at all then.

When I do a straight export of everything including the animations to a single .x file, convert to egg, and then use in panda, the animation doesn’t work and the model is stretched and distorted.

I am using version 1.6.2 of panda3d.

Is there something I’m doing wrong?

if the model is streched and distroted that’s usualy not a bad sign. could mean that your animation are loaded. but that animation and vertexdata are somewhat not matching perfectly. is your skeleton origin in the very same location/rotation/scale as your mesh? (not only visually but the transform parameters)

I believe so? I created the skeleton from scratch on the preexisting model. I attached some vertices to the leg bones and it animates correctly in Milkshape.

It’s just after the export and conversion that it doesn’t work anymore. Wouldn’t the animation still work if it loaded?

hm. propably. if converting to egg. is there any animation data in your resulting egg file?

see reply below

Here is a link to the .egg file after I convert the animation-only .x file:

http://www.filedropper.com/link-step1

Sorry, it ended up being too long to post in a reply and I didn’t want to do multiple posts for it.

I’m not sure, but the fps {486.878} seems wrong somehow? Other than that, nothing sticks out at me as being wrong.

I ran pview with my model and then the animation file as parameters. When I press ‘a’, it cycles from 1 through 4 and repeats. My animation is supposed to be 40 frames long; however, I do only have 4 keyframes.

if there are only 4 keyframes you will only see 4 frames beeing played by default. (panda’s default settings have interpolation turned off).
you can easily change this in your own application so it interpolates smoothly between the frames.

btw. the link you provided only links to the frontpage of the filehosting service, not your actual file.

I haven’t even gotten to any actual panda3d coding yet, I’m still trying to get the model and animation to work correctly in pview. Even if I manually advance through the keyframes 1 at a time in pview, the model doesn’t move at all. I hoped it would at least move to the position of that keyframe.

Sorry about that last link, I tried a different file host this time. I included both the egg file for the model and the animation. If you don’t mind, could you take a look at it and see if you notice anything wrong?

http://www.mediafire.com/file/dgzlntnzwtz/link.zip

i’m not an egg export but i’d say the vertices arent asigned to the sekeleton. so although you have a moving skeleton. the vertices dont move with it.

I’ve already assigned vertices to the bones that are moving (I haven’t done all the vertices yet because I’m just testing at this point) in milkshape before exporting.

Perhaps I’m not following the correct process?

  1. I imported the static model from a 3ds file into Milkshape.
  2. I added joints/bones to the model.
  3. I assigned vertices to some of the bones.
  4. I enter Animation mode and set a keyframe, skip to frame 10, rotate one of the joints, which shows the corresponding vertices also moving, set a keyframe, repeat for the other 2 keyframes.
  5. I export in DirectX 8.0 format just the mesh and materials to an .x file.
  6. I export in DirectX 8.0 format just the animation to an .x file.
  7. I use x2egg on each of the .x files.
    8) I run pview .

Actually, looking at the model file, there aren’t any entries at all. This means x2egg did not think it was an animated model, and it didn’t create an animatable egg file as a result.

Probably you should use “x2egg -a link -o link.egg link.x” to convert it. The “-a link” parameter tells it to make an animatable file, with a character name “link”. You should use the same option on your animation file.

David

I tried your suggestion, and I have Joint entries in the egg files now. However, when I pview those, if I specify the animation file, the model shows loaded in the console, but there is nothing displayed, just the gray background in pview.

I looked through the egg files, and the animation egg file shows the joint names that I specified in milkshape; however, the model egg’s joint names are not what I renamed them to in milkshape, they are things like “n0b5”.

The .x files exported directly from milkshape show the same. The “Frame” entries in the animation file are named correctly, in the model file they are not.

Did a little digging, the “n5b0” names are group names that already existed on the model or were created when I imported it from 3ds.

This is where the disconnect is happening, the model file doesn’t contain any joint data, just the groups of vertices and their corresponding properties. In the model .x there are just entries of “Frame n0b5” and then a grouping under each one of “Mesh” with nothing but coordinates that I assume are each polygon in the group.

For some reason, when x2egg converts the x to an egg, it’s changing the groups to joints. I’m guessing that’s why the animation file isn’t working, it doesn’t know what to animate.

Perhaps x doesn’t have an explicit ‘joint’ designation, and uses Frames for both generic grouping and for animatable joints. In this case, x2egg has to convert every Frame into a Joint to be on the safe side. This also means that your animation table has to have the same set of joints.

Perhaps it will be best, then, to convert your animation and your model in a single x file, instead of two x files. That will make it easier for x2egg to ensure that the animation and the model match up together.

David

Unfortunately, the groups are there to assign materials to, so I can’t remove them.

Is there another pipeline path I could take in this case? I would like to have the animations separate from the model.

I tried Blender, but wasn’t too impressed with the interface. I might be willing to consider a commercial product, but what I liked about Milkshape was the easy/simple interface.

What happens if you add the same set of groups to the animation? Does that help?

David

The groups are part of the mesh and assign different textures to different parts of it. I don’t have a choice when exporting to directx as to what to include other than mesh, materials, and animation.

Besides, the animation file is correct in that it lists the actual joint names that I want to animate in the model. It’s the model file that ends up not exporting joints, just these groups.

I think I’m going to start looking for a new modeling app and see if I can’t do better.