Graphics Reference
In-Depth Information
Figure 1.6. Authoring Lara Croft's hair in Autodesk Maya.
content creation) tools. Once the hair strands are authored as splines, a custom
python script exports them as poly lines. In the TressFX demo, hair is divided
into four groups as front, top, side, and ponytail and each group is saved as a
separate file.
1.8 GPU Implementation
TressFX uses compute shader in DirectX 11 to run hair simulation in the GPU.
There are a total of five compute shader kernels. Listing 1.1 shows the Simulate
Hair_A kernel, which handles integration and GSC. This kernel computes one ver-
tex per thread. Since GROUP_SIZE is defined as 64, one thread group can compute
four hair strands if one strand has 16 vertices. With maxPossibleVertsInStrand ,
it is possible to control how many strands can be computed in one thread group.
Since GROUP_SIZE is 64, the maximum number of vertices in a strand is 64. By
changing GROUP_SIZE to 128 or 256, we can have more vertices. However, more
vertices could take a longer time to enforce ELC and LSC. Therefore, it is rec-
ommended to use 16 or 32 vertices per strand for real-time purposes.
Listing 1.2 shows the SimulateHair_A kernel, which does LSC. This kernel
computes one strand per thread and thus there is a for loop. strandType is a
variable showing to which group the strand belongs. With this, we can assign
different simulation parameters such as stiffness or damping to hair groups.
The SimulateHair_C kernel computes one vertex per thread, enforces ELC,
and applies wind. Finally, SimulateHair_D takes care of collision and computes
tangents of line segments for the rendering pipeline.
Search WWH ::




Custom Search