January 27, 2020
An early look at next-generation real-time hair and fur
While our Siren showcase was a breakthrough when it debuted in 2018, her virtual hair leveraged a traditional card-based technique, relying on textured meshes to give the approximate shape of a much larger number of individual hairs. This approach was the best option back then even with its tradeoffs for achieving fine-strand detail, accurate shading, and physically-based simulation. NVIDIA HairWorks helped move the conversation forward, but its official support ended back with Unreal Engine 4.16. The time has come for first-class real-time hair and fur implemented natively in Unreal Engine.
With our new strand-based workflow, each individual strand of hair is rendered with accurate motion, resulting in dramatically improved visual quality. Unreal Engine 4.24 introduces a full hair shader and rendering system with multiple scattering from light sources, ray-traced shadows and dynamics integration using visual effects editor Niagara.
This hair groom was rendered with our multi-scattering approach to generate a more realistic look.
Import PipelineUnreal Engine 4.24 focuses on hair rendering and simulation with easy integration into an existing pipeline using the Alembic file format. We provide a naming convention based schema, which facilitates the import of static grooms from DCC applications like Ornatrix, Yeti, and XGen into Unreal Engine, and offers a straightforward pathway to tie in with proprietary studio hair tools.
Our schema allows the transfer of attributes such as “width” and “color” into Unreal Engine, along with “guide” attributes that are identified for the simulation of interpolated hairs. Multiple hair groups within a single alembic are supported via “group_id.” We partnered with the talented teams behind beloved hair grooming applications Ornatrix and Yeti to provide built-in support and each offers the ability to natively export to our Alembic protocol into Unreal Engine 4.24. Guidelines for using XGEN with our alembic schema can be found in the documentation.
Once imported, the hair and fur can be attached to a Skeletal Mesh, binding each hair root to the closest triangle on the mesh. This enables morph and skinning deformation, which are critical to constraining hair and fur to skin animation.
Ostrich groom created in Yeti by Character Artist Yuriy Dulich of Biotic Factory and rendered in Unreal Engine.
Shading & RenderingRendering hair strands implies facing three distinct challenges: aliasing, light interacting with a single hair fiber, and light bouncing in-between fibers.
A human head has hundreds of thousands of hair strands, each with an average diameter of about 100 micrometers. Generating a picture with hair requires rendering multiple visible hair strands within each pixel. For rendering with our workflow, the imported hair strands are converted into individual polylines and rendered as thin triangle strips facing the camera.
One complication that results from creating thousands of hair strands is that we need to take into account how much more complex light scattering behavior will be within this system, which we addressed with our own physically based hair shading model. This provides a more realistic appearance of single hair strands.
To accurately evaluate the light transmitted through each hair strand, we use a mixture of Deep Opacity Maps and a runtime voxelization. Once we know how much light has traveled through the volume of hair, local light scattering is evaluated using the dual scattering approximation as an estimation for multiple scattering. This enables Unreal Engine to more faithfully render hair, especially light blond hair, which has been traditionally more challenging.
This groom was generated in XGen and imported to Unreal Engine. It contains approximately 50k curves.
SimulationHair simulation is implemented as part of Niagara and is available on the GPU. Once a physics asset is created, the simulation solver handles body collisions. Niagara handles self collisions and computes them based on an average velocity field. Adjustable parameters such as bend, stretch, and thickness can be accessed without opening the Niagara editor.
PerformanceHigh-density grooms can easily contain hundreds of thousands or even millions of strands. And each strand can contain dozens of Control Vertices (CVs). The combination of these two factors will affect performance for import, rendering, and simulation. For reference, in order to achieve real-time on a high-end PC, we’ve been generating grooms with an average of 50k strands for long hairs with a relatively higher CV count, and an average of 200k strands for short hair with comparatively lower CV count.
ConclusionWe couldn’t be more excited about our curve-based implementation in Unreal Engine 4.24 as it represents a huge milestone for real-time hair and fur. But, this is only the beginning. Going forward, our mission is to continue improving the system’s quality and performance.
For shading and rendering, we plan to enhance our hair BSDF by offering extra parametrization to produce a better and more accurate lighting response with hair fibers. While our multiple scattering approach conveys the appearance of light-colored hair in a real-time environment better than ever, we will push the engine to further refine hair quality.
In addition, collision response upgrades, better elastic Materials, and finer artistic controls for the simulation system will be developed. Optimizations to support larger and denser grooms will be implemented in future releases and to ensure scalability on all platforms, we are also considering card generation for lower-end devices.
Above all else, we are committed to building a hair-and-fur system that helps our clients ship amazing projects and would love to hear your feedback on how we can best serve your needs. This experimental feature is available for you to try now and to get started, download Unreal Engine today and check out our Hair Rendering and Simulation documentation.