Animation Viewer

Date: May 20'

Platform: PC

Language: C/C++, HLSL

Tools: DirectX 11, FBX SDK
 

Features:

  • Animation with blending tree.

  • Exporting of FBX mesh, texture, rigging, and animation data to a custom file format.

Overview

I built an exporter that converts FBX data to a custom format to be used by my animation viewer. The viewer can render models and play blended animations. After finishing both of them, I added 3rd-person movement, camera control, and terrain collision to get a sense for how the animation would feel when used in a game.

Notable Features

AnimationViewer.gif

Animation Viewer

The viewer uses DirectX 11 to renderer the model. It includes a point light that can orbit the model, a PBR shader, and keyboard controls to move the camera, the model, or to change animations.

Debugging Animation

Implementing animation into the viewer took a considerable amount of time. I had to brush up on my Linear Algebra and I made mistakes by not bringing the joints or triangles into the correct space. A surprising consequence of my errors were bugs were fun to watch. I added a debug view to visualize the joints and bones that made up the model and a way to isolate the individual vertex clusters influenced by each joint. Using the debug view helped to solve all of the issues.

AnimationDebugging.gif
AnimationBlending.gif

Animation Blending

I had walk, run, jump, and idle animations for the model's rig. I also added support to the viewer to play animations in reverse. By referencing an article I read on Gamasutra, I created a blend tree that blended the transitions between idle, walk, and runs based off a velocity value. This resulted in smooth transitions between those animations.

FBX Exporter Tool

Using C++ and the FBX SDK, I built an exporter that extracts mesh, texture, rigging, and animation data from an FBX file and places them into custom binary files. The tool is a simple exe. Multiple FBX files can be dragged and dropped over it to start the export process.

FBXExporting.gif
Controls3rdPerson.gif

3rd-Person Controls

I added controller support to see how well the blended animation would hold up in a game. As in many third-person games, the left stick controls the player, and the right stick controls the camera. If the player isn't actively moving the camera, interpolation is used to move it behind the mage. 

Terrain movement

Wanting to get a real feel for the animation and the blending system I made, I added a terrain for the character to walk on. I added collision to the terrain by assigning each of the terrain triangles an AABB and adding them to a BVH. There is a ray-cast that goes from the character downward. It is used to clamp the character to the terrain when they're not jumping. 

TerrainCollision.gif

What I've Learned

This project taught me a lot about FBX files, how animation works with 3D models, and how helpful debug visuals can be when fixing issues. In the future, I'd like to dive more into the FBX SDK to support other features. I would also like to explore combining IK with animations to place the mage's feet nicely on the terrain slope.