Hair moves in real life. So of course, we expect it to move in our games. Unfortunately, that's actually quite a technical challenge. Today we're going to go over the various options available to us, the pros and cons of each, and in the end, which one we're probably going to be using and why. All of these options are native to Unreal Engine 4. Which is to say, none involve 3rd party software.
This means exactly what it sounds like: we apply the same physics used for cloth to hair. This approach can come the closest to realistic hair movement, and could possibly even be convinced to collide with other clothes rather than clipping through it. Unfortunately hair costs much more computer power than, for instance, our capes, which are a single piece with two sides. While this approach can look fantastic for hair models when done well, when the player has dozens or more other characters in viewing range, as is very common in MMO games, the math needed to calculate it all becomes unmanageable. Despite its aesthetic appeal, we've had to shelve this option for City of Titans.
Bones In Your Hair
Using cloth physics turns the hair model into cloth. To use any other method, we first need to give the hair model the means to move in the first place. Natively, all 3D models are hard pieces without the ability to flex. To make hair animate, we have to do the same thing for it that we do for the character body itself: give it bones, joints and weights. These things give the model the information and features necessary for movement.
This approach uses features built into the Unreal Engine to run highly optimized (i.e., very fast) physics simulations on a selection of the joints that control our hair model. There are several variations for different types of motions: one can make an object bounce or jiggle, the way various 'big hair' styles might for instance. Another can make an object bend and flex like a rope, which suits things like braids and ponytails. If a hairstyle has some of each, each style can be individually applied to the correct joints.
This, from where we currently stand, seems to be the goldilocks method. It produces good-looking results, but still runs reasonably well within our performance limits. When your character jumps or turns suddenly, the hair can react accordingly (see examples).
These physics solvers also work with Level of Detail (LOD) settings automatically. Level of Detail is the system that detects when you are too far away from an object to see details and replaces the model with something much simpler to save memory and performance. Because the hair is LOD compliant, each Titan's client will stop running the simulation when the hair is far enough away from the viewer, another way to control performance and overhead.
If City of Titans were a single player game, we'd be working with cloth physics. Because we are an MMO, we're currently working with joint based animation using Unreal physics solvers. The results are good. But with Unreal 4 we're on the cutting edge, and it's always possible we'll discover a new trick that gets even better results. Until then, we're working on a range of hairstyles.