Skeletal animation problem(s)

Two weeks ago, I started learning how to load MD5 models and animate them. I found a Java MD5 loader online (some dude ported it from the MD5 model loader on 3dgep.com) and I fixed a bunch of bugs and removed a whole lot of unnecessary stuff.

For the entire first week, the mesh was rotated at a weird angle and wasn’t moving at all. I fixed that, and now the mesh is actually moving.

The problem is that instead of individual limbs moving, the entire mesh is moving as a whole. Initially, I was under the impression that the cause of the problem was that the per-vertex bone indices were incorrect. I soon realized that I was wrong and the problem wasn’t the result of incorrect bone indices or bone weights. This is my very first time attempting 3D animation in OpenGL (make of that what you will. I know for a fact that you can’t get very far in 3D game development without animations in the game). I don’t know about you, but I personally believe that two heads are better than one. I’ve got several heads at my disposal. I mean…er…

It would be awesome if you guys could help. Meanwhile, I’ll try and figure out a solution. If you get any brainwaves, please remember to tell me all about it.

POST SCRIPTUM: the model I’m using is ol’ Bob (carrying his lamp, which he never leaves home without) from Doom 3.

I (think) I’ve found the problem.

I’m passing the per-vertex bone indices to the vertex shader, obviously. Each vertex can be influenced by a maximum of 4 bones, which is why it’s a vec4.

I have an “out” variable in the vertex shader that passes the colour of the mesh to the fragment shader (it’s called “passColour”).

When I set passColour to be equal to boneIndices (which is a vec4 variable), the mesh is completely black, indicating that the xyzw values are all either 0 or close to 0.

When I use an if statement to check if the average of the four components [(x+y+z+w)/4] is equal to zero, it returns true.

But it doesn’t make sense for the bone indices to all be zero, because I’ve confirmed that the data is being loaded correctly to the VBO and that the float array of bone indices and bone weights are not full of zeros.

tl;dr I’ve got no idea what’s going on.

I’m so sorry, please don’t kill me.

I just realized that I wasn’t enabling the 2nd, 3rd and 4th vertex attribute arrays. Man, I’m so dumb.

Now I’ve got the same problem as CopyableCougar4. My model is COMPLETELY cray-cray.

gl api is so easy to get wrong. dont worry, happens to everybody all the time. :wink:

I never had a reliable source to learn OpenGL from. Just mix matched articles explaining things (and not why). So after a lot learning from being wrong all the time, I think I’ve gotten pretty good at second guessing the nature of my stuff to get things right the first time. Its saved me a great amount.

Someone was making a MD5 loader with that universal model loader library, check that out. You might be able to adapt and learn from the code there. It was posted on JGO

You should take a look at http://sauerbraten.org/iqm/
It’s the successor of MD5. And the demo is super easy to port to Java.
I would give you mine but it’s some where in my pile and I made weird changes to it.