Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

[JAVA][LWJGL] Skinning them bones

$
0
0
Hey DIC!

I'm trying to create a skeletal animation in opengl. So far the skeleton is working!
The problem is trying to figure out how to skin the mesh.

Posted Image

see? The mesh turns into some kind of bio-experiment using nuclear explosions.
The current way I transform the vertices is as follows:
v = Vector3f.sub(v, j.globalpos, v); //substract global joint pos
v = Vector3f.add(v, j.localpos, v); //Add joint offset
				
Quaternion RQ = j.globalrot; //get global rotation (local rotation+parent rots)
v = RQ.times(v); //rotation quaternion * vertex position (No weights, just move the anorexic vertex)
				
//v = Vector3f.add(v, j.globalpos, v); //add global joint pos does not work either way



I expected the vertex to go to the skeleton origin + joint offset + offset of vertex compared to the joint pos. (NOTE: the mesh origin is at the same spot as the skeleton origin!) Then I expect it to rotate by the globalrot. Instead its as if the vertex rotates around another origin that isn't correct.

Could someone help me with this?

And yes... I am aware of the seperated vertexes but that is not the problem. :P

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>