I started this tool by going through LearnOpenGL’s tutorials to get an OpenGL window going with a scene, and then wanted to expand upon it.

It began with trying to get the OpenGL window just appearing, which was a process in and of itself. Then going through LearnOpenGL step by step, getting a 2D triangle appearing, shaders and textures working, transformations, to lighting and model loading. Eventually I ended up at skeletal animation, which was quite an interesting challenge.

Ghost Poses and Skeletal Animation

At one point, I was struggling with just getting the animation to play, and the rumba dancing model (from Mixamo) was just in bind pose for a while. I decided to make my own small model with just a one bone rig in Blender to test out the animation transform system and make sure it was actually transforming over time.

I made the tube’s first keyframe be at an angle so I could tell if it was actually reading in the position and rotation correctly and not just stuck at bind pose. I also set the material to be able to tell what the “top” of the tube is when looking at it in the OpenGL window.

One bone tube test. Aka my “test tube”, or “nerf dart.”

This worked in OpenGL! My tube was at an angle! So it was reading in the animation keyframes correctly but it just wasn’t animating it. I printed out the matrices over time to see if they were changing, and lo and behold, they weren’t. Turns out, I had added an extra if statement in the vertex shader that was just resetting all the matrices back to the identity matrix after doing all the transform calculations to get the vertex transform in its final animated pose. Once I removed that, the tube animated!

I graduated on to a multi-bone tube after that success to ensure that it would work with more bones.

Multi-bone tube in Blender

Multi-bone tube in OpenGL

With my findings with the tubes and after some more trials, I was able to get the rumba man dancing.

After getting the model to animate properly, I started working on showing ghosted poses from a few seconds back in the animation. I’m still working on extending this! My next goal is to implement raycasting to be able to choose which joint to see ghosted.

Not without its outtakes, of course.

Previous
Previous

Forest Builder in Houdini

Next
Next

Casita Builder in Maya