Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
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 2870 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 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.
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? http://pastebin.java-gaming.org/c47d35366491fHere 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 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.

Pages: [1]
  ignore  |  Print  
 
 

 
Ecumene (107 views)
2017-09-30 02:57:34

theagentd (134 views)
2017-09-26 18:23:31

cybrmynd (244 views)
2017-08-02 12:28:51

cybrmynd (236 views)
2017-08-02 12:19:43

cybrmynd (237 views)
2017-08-02 12:18:09

Sralse (251 views)
2017-07-25 17:13:48

Archive (863 views)
2017-04-27 17:45:51

buddyBro (1006 views)
2017-04-05 03:38:00

CopyableCougar4 (1564 views)
2017-03-24 15:39:42

theagentd (1372 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org 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‑gaming.org
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!