Saturday, October 17, 2015

shaders - Problem when animating MD5 model (GPU Skinning)


I'm trying to implement a GPU skinning version of the md5mesh.js by @tojiro (demo with CPU skinning) in WebGL (live demo of the project here, use WASD to move the camera around).


The main concept is as follows: I modified the Vertex buffer object in order to fit the information of bones indices and bone weights, then for every frame of the animation I modify the bone matrix (an array of transformation matrices for each bone) with the appropiate matrix (for each joint I create an identity matrix and multiply it by it's orientation and position, then I multiply the result by the inverse of the bind pose and it's ready to go to the shader).


This works OK when the boneMatrix array is filled with identity matrices (by concept it should render the bindPose and it does). However when I try to load an animation the movements appear messed up and clipped. I discarded a wrong/corrupt version of the md5mesh / md5anim by loading them in an MD5 viewer.


Here there is an example of what happens when the boneMat array is filled with identity matrices:


Looks good to me


I think this is the way the model should look, but when I try to animate it...


mesh is messed


The general movement of the mesh is correct but some vertices move with an strange direction / orientation which forces a lot of clipping to occur.


Maybe someone experienced in the matter can spot the problem directly from the image, if not I' willing to provide any part of my modifications on the md5Mesh lib.



In order to implement all of this I've followed this tutorial and took a lot of ideas from this implementation.


Any help will be appreciated, I've really hit a wall with this!


Thanks in advance.




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...