Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (855)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Skeletal animation problem(s)  (Read 3456 times)
0 Members and 1 Guest are viewing this topic.
Offline ShadedVertex
« Posted 2016-07-14 09:56:33 »

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 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

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.
Offline ShadedVertex
« Reply #1 - Posted 2016-07-15 10:05:24 »

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.
Offline ShadedVertex
« Reply #2 - Posted 2016-07-15 12:20:27 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline basil_

« JGO Bitwise Duke »

Medals: 418
Exp: 13 years

« Reply #3 - Posted 2016-07-15 15:52:53 »

gl api is so easy to get wrong. dont worry, happens to everybody all the time. Wink
Offline Hydroque

JGO Coder

Medals: 25
Exp: 5 years

I'm always inspiring a good time.

« Reply #4 - Posted 2016-07-16 03:55:50 »

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 think I haven't been monitoring the chat? is a compilation <3
Offline KudoDEV

JGO Ninja

Medals: 79
Exp: 6 years

Game Dev Hobbyist

« Reply #5 - Posted 2016-07-16 13:32:50 »

You should take a look at
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.

Pages: [1]
  ignore  |  Print  

EgonOlsen (1574 views)
2018-06-10 19:43:48

EgonOlsen (1658 views)
2018-06-10 19:43:44

EgonOlsen (1145 views)
2018-06-10 19:43:20

DesertCoockie (1573 views)
2018-05-13 18:23:11

nelsongames (1174 views)
2018-04-24 18:15:36

nelsongames (1665 views)
2018-04-24 18:14:32

ivj94 (2421 views)
2018-03-24 14:47:39

ivj94 (1631 views)
2018-03-24 14:46:31

ivj94 (2719 views)
2018-03-24 14:43:53

Solater (884 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!