Good morning folks! My name is Guilherme and this is a special day because after almost a month having problems, I finally managed to fix and get the armature skinning up and running.
What kind of problems did I had? Well, it's a long story but I'll summarize it for you in a few sentences.
If you take a look at my previous videos, you'll see some weird parenting behaviours everywhere, like the bone rotating around the center instead of the local space, all bones placed in the center of the object and, of course, some weird mesh deformation that was due to my desperate attempts to transpose all the matrices during the process.
Transposing the matrices?
Yes. Assimp, the model loader that I'm using, uses transposed matrices by default. My game engine and OpenGL, does not. So when I import everything, I first have to transpose the matrices in order to make it fit. Somewhere in these days ago I tried to transpose the matrices as well by default, just to make sure that the problem wasn't there. And it wasn't there. Good news, I guess.
Due to all these problems, I decided to give up on using assimp as the model loader and started to write my own BPY Blender exporter. I was doing great until I discovered that Blender stores armature dat in an extremly weird way.
And here we go again to assimp.
Back to the bone parenting issues, I decided to rewrite my parenting system. No success at all. Then I rewrote the entire game engine transform system, following a VQS approach and again, no success.
C'mon, at this point you may imagine my frustration. Just to give you an idea, right now the system is working and the whole system, excluding the importer, is about two hundred lines of code. An entire month lost because of two hundred lines, fuck, I'd say that I can easly write the entire engine from scrath again in this same time period.
So what happened that I managed to get it working?
Well, yesterday I was brushing my teethes to go do bed and had an eureka moment: For some reason, assimp was adding a blank node between every two bone connections, like between every bone parent and children that I wasn't being able to figure out why or how it works. So my approach at this moment was just ignore and skip these blank nodes. What if I try other file format? Then I got back to my office in the middle of the night, turned the computer on and tried collada.
Guess what? it fixed 90 percent of the problems. The last problem that I fixed today morning is due to the rotations: For some reason, glm, the library that I'm using for math, doesn't handles quaternion to matrix conversions very well every time, or it's just me not knowing how to use it, who knows. In the end, I just replaced the VQS transform approach with the Vector Matrix and Vector approach, just loike Blender Game Engine does, using Vector3 to store position and scale and a matrix 3 by 3 to store the rotation. And it works.
I know that this video in the background does not seem to be a huge deal, but this pose was actually a keyframe in the animation, I just need to create the timeline now. And yes, I'm rotation an individual bone in the video to test it.
Well guys, that's it for today, I'm so happy that now I'll finally be able to keep going to the engine.
Thanks for watching, don't forget to subscrobe to the channel, leave a comment and I see you in the next time.
························································
● My main channel in portuguese (Uniday Studio):
http://bit.ly/uniday-studio-youtube
························································
► Uniday Studio
By: Guilherme Teres Nunes