Real-time simulation and rendering of realistic hair/fur, consisting of multiple strands, is gettng much attention these days – one can easily name a TressFX solution, developed by AMD.

A competitive response from NVIDIA, new hair and fur simulation technology, which is now officially called NVIDIA HairWorks, was firstly showcased at The Witcher 3 presentation half a year ago and recently used in an actual game title – Call of Duty: Ghosts – to provide “Dynamic Fur” simulation for animal characters.

In comparison to other GPU accelerated physics features, Dynamic Fur was implemented through DirectCompute, which opens it for AMD users as well.

Tae-Yong Kim, physics programmer at NVIDIA, has agreed to answer some of our questions about HairWorks solution in general, and Call of Duty: Ghosts integration in particular.

PhysXInfo.com: Dynamic Fur has recently debuted in the Call of Duty: Ghosts title. What can you tell us about this technology?

Tae-Yong Kim: NVIDIA HairWorks originates from multiple simulation and rendering technologies that NVIDIA has developed in the past. This combines rendering technologies for human hair (shown back in 2008 at GDC as part of directx SDK sample) and various simulation technologies shown in multiple events (most recently, the Apex Fur demo in GDC 2012).

To make the hair/fur technologies a product, NVIDIA engineers have put together these existing technologies as well as adding new techniques to deal with deforming animal character and to make sure the whole authoring pipeline goes smoothly for multiple types of fur and characters.

The fur tech was first demoed at E3 2013 for Witcher 3 wolf creature and has been tested and refined through multiple game engagements including Call of Duty Ghosts, Witcher 3, and others.

The underlying solver is based on algorithms that were published in 2012, but have evolved into a full production ready solver that includes shape preservation, anti-stretching, various dynamic force and inertia controls, multiple GPU skinning supports, etc.

PhysXInfo.com: What are the capabilities of the engine? Can it simulate anything besides fur?

Tae-Yong Kim: The solver can simulate any line/curve geometry such as fur, hair, grass, etc. However, most emphasis so far has been put on fur, and we are still expanding its capability for other types of objects. Currently, it has some simple collision support, but we plan to add more robust collision handling against deformable character mesh in the future.

It also supports wind and various grooming functions such as stiffness, waviness, clumping, length variation etc. through various texture map supports. Combining all these parameters, users are able to simulate wet fur, dry fur, and even transitioning between those.

It is currently implemented as GPU only feature.

PhysXInfo.com: Let’s talk about graphical side of the HairWorks tech. How hard is to render realistic fur or hair?

Tae-Yong Kim: Rendering realistic fur basically requires dealing with huge amount of data (e.g. half million hairs for the CoD characters) in every step of rendering pipeline. We heavily utilized and optimized the rendering algorithms with DX11 tessellation features that allow us to dynamically create most hairs on the fly in the GPU without requiring too much memory for both CPU and GPU.

The tessellation feature is also very useful for LOD control where we can dynamically vary density of hairs depending on game environment.

Once hairs are generated and tessellated, we further modify the shape (e.g. tapering hair width toward the tip) and compute shadows and shading on each hair strand. Special attention has been paid to making sure that hair shading matches underlying skin shading.

PhysXInfo.com: What does it take to create a proper hair/fur asset? Does HairWorks module already have some kind of authoring pipeline in place?

Tae-Yong Kim: Our pipeline doesn’t different all that much from traditional Visual Effects. We provide a series of guide curves, growth mesh, and some textures to control the various attributes. The guide curves can be authored with 3rd party tools, e.g. Shave and a Haircut for Maya or the built in 3dsmax Hair and Fur modifier.

The hair geometry and associated animation data (skinning weight etc.) are exported and then serialized by a cooker program. The runtime engine then loads this serialized data in game and instantiates hairs for multiple characters.

PhysXInfo.com: Can artist somehow control or influence the behavior of the simulation, for artistical purposes (similar to APEX Clothing)?

Tae-Yong Kim: We provide various controls for rendering and simulation. Currently, we provide up to 40 different parameters to control shape of hairs, density, clumping, waviness, simulation stiffness, shape preservation control, gravity, wind, inertia, collision offset, shading etc. We have been adding texture map supports for many of these parameters on as-needed basis. For CoD, we used about 8 such maps to control hair density, color, thickness, etc.

PhysXInfo.com: Can the solver dynamically adapt the quality or quantity of the simulation based on the number of active assets on the screen, in other words, does it have LOD system?

Tae-Yong Kim: We provide LOD on render time through our use of tessellation. Hair density and thickness of each hair can be dynamically adjusted based on distance of hair to camera as well as target hair count and number of characters. CoD uses two different sets of LOD. For normal- to- far away objects, hair density gradually decreases to zero as character moves away. Beyond the farthest LOD distance, fur gets turned off automatically. So, it is very important that our shading closely matches and blends well with the skin rendering.

In another case, we use close-up LOD, where hair density can become arbitrarily high (e.g. Riley getting carried during the Sin City sequence). As a lot of hairs are not visible in close-up, we also provide automatic culling to reduce # of hairs sent to rendering pipeline, again using the dynamic tessellation functionality.

PhysXInfo.com: Let’s get back to Call of Duty: Ghosts. What challenges have to be overcome to implement such new tech into a real game?

Tae-Yong Kim: Since we had already improved our API based on other game integrations e.g. Witcher 3, the fur integration into Call of Duty went pretty smooth. Since Riley changes his armor depending on game level, so we had to make all fur functionality ‘hot swappable’ so that we can seamlessly change assets for fur during game play.

PhysXInfo.com: What are the characteristics of the typical fur asset in COD: Ghosts?

Tae-Yong Kim: Each fur asset has about 400-500K hair strands. Most of these hairs are dynamically created on the fly inside GPU from roughly 10K guide hairs that are simulated and provide basis for further tessellation.

We use about 6-8 texture maps for each hair asset that are shared by hair instances (e.g. multiple wolves in the wolfpack).

PhysXInfo.com: It was really a big surprise to see NVIDIA HairWorks utilizing DirectCompute API, while other NVIDIA hardware physics effects is typically exclusive to CUDA capable GPUs. What was the reasoning behind this decision?

Tae-Yong Kim: One of the goals of NVIDIA GameWorks is to solve hard visual computing problems in a way that balances implementation efficiency and time-to-market, runtime performance, and ease of integration. This requires choosing the right technologies, and sometimes that will lead to CUDA solutions, other times to DirectCompute, and other times to solutions using completely different approaches.

With NVIDIA HairWorks, the balance landed in favor of DirectCompute, partly because the simulation portion of the algorithm is a small part of overall runtime cost, which is dominated by rendering.

PhysXInfo.com: So, can we expect other APEX modules or GPU accelerated PhysX SDK features to be ported to non-CUDA platforms as well, over time?

Tae-Yong Kim: As we implement modules in the future, we will make the decision on a module-by-module basis as to the optimal technology to use.

PhysXInfo.com: Can one hope for HairWorks solution to be ever made available for next-gen consoles – PS4 and Xbox One?

Tae-Yong Kim: We are looking into the feasibility for using NVIDIA HairWorks on next gen consoles, so stay tuned.

PhysXInfo.com: How many game titles can one expect to see with NVIDIA HairWorks support in the future?

Tae-Yong Kim: We continue to work with Call of Duty for their upcoming content updates where we expect to see much more widespread use of fur in the game. We have been working with the Witcher 3 guys for a while now, and they plan to use fur and hair tech very heavily in the game.

We have received tons of interests in using the Fur tech from various other developers. So we are working hard to make this tech as polished as possible for general use. We hope to get this ready in the very near future.