TressFX 4 introduces a number of improvements. This blog post focuses on three of these, all of which are tied to simulation:
- Bone-based skinning
- Signed distance field collisions
- Sudden shock handling
We’ve also have a couple of bonuses in the sample code. Although not directly part of TressFX, you may find them useful. They are:
- Compute-based skinning
- Marching cubes
TressFX 3 introduced fur support, which essentially means that each hair root can move with the underlying skinned mesh. This was done by streaming out post-skinned triangles, then using those triangles to compute transforms for root hairs. This method is great in that it’s pretty general – it doesn’t matter how the vertices were skinned, and it could also handle blend shapes for example. The drawback is that it relied on knowing which triangle controlled which hair, which was assigned during export of the hairs from Maya®. If the mesh changed or reordered, or split differently due to material assignments, the hair indices would need to be remapped as well. There was also a fair amount of runtime cost associated with deriving transforms from the triangles for use on the hair.
In TressFX 4, we switched to a more direct skinning model, as was used in Monster Hunter Online. When exporting the hair, you select the mesh as before, but instead of exporting a list of triangle assignments you are exporting bone indices and weights for each hair root. Additionally, there is a table of bone names so they can be easily remapped to the engine’s bone indexing.
Signed Distance Field (SDF) Collisions
Our biggest feature addition for simulation is the introduction of a dynamic signed distance field collision system. This enables high-fidelity collision with dynamically animated, skinned meshes.
The included demo generates three signed distance fields – one for the body, and one for each hand of our skinned character. Breaking it up this way allows us to focus resolution where needed. We wanted to show response to individual fingers, for example. Each signed distance field is updated every frame.
Sudden Shock Handling (SSH)
SSH is another new feature in TressFX 4. The main purpose of this is to handle fast moving animations. When the character changes its speed or direction, it generates a high acceleration and consequently a big external force. Since TressFX hair simulation uses an iteration-based constraint solver, when a high acceleration gets applied, hair can easily lose its physically-correct shapes and shows unpleasant elongation.
Sudden shock handling mitigates these issues by propagating acceleration from the root of the hair to the tip according to a weighting factor. The weighting factor varies between zero and one. At one, the fur will move completely rigidly – thus giving an alternative to full simulation for a form of simulation level of detail. In addition to the weight, there’s a threshold setting to only enable it under fast motion.
The sample code includes a few extra tidbits as well. One is a compute-based skinning system, including a Maya exporter that will export mesh geometry, along with skinning weights. We used this to skin the mesh that serves as input to the signed-distance field system.
To help visualise the signed distance field, we have also included a compute-based marching cubes visualisation system.
We’ve covered quite a bit of the changes to simulation in TressFX 4, from changes to existing approaches (bone-based skinning), new features (SDF collisions and sudden shock propagation), and some related bits in the sample code (compute-based skinning and marching cubes). There’s still quite a bit more we’ve changed and added that we hope to cover in later posts.