Hair Rendering and Simulation

Overview of strand-based hair importing, rendering and simulation within UE4

Windows
MacOS
Linux

Traditionally, hair in real time has been created using card-based rendering or other approximations. In a card-based workflow, a small number of large flat sheets is used to give the approximate shape and motion of a much larger number of individual hairs. Using the new Hair Rendering and Simulation features, the ability to render each individual strand of hair is obtainable. By rendering each individual hair, you can massively improve the visual fidelity of real-time simulated hair.

While no standard file format currently exists for Hair Grooms, this update provides a naming convention-based scheme for using Alembic files to ingest Groom data exported from your DCC tools. This update also provides support for multiple Hair Groups within a single Alembic file (for example head hair, peach fuzz, beard, eyelashes, and brows), a state-of-the-art Hair Shader and Rendering system, and a dynamics integration using Niagara .

This update is intended to provide a minimally viable implementation of strand-based hair importing, rendering, and simulation. This update does not provide a hair grooming solution. Hair shaping, or grooming, will need to be performed in an external DCC tool such as XGen within Maya, Ornatrix , Yeti , Shave and a Haircut , or Houdini .

HairWorks Users

NVIDIA provides a hair solution called HairWorks. HairWorks consists of DCC tool integration and real-time rendering and simulation for hair. HairWorks in UE4 has been deprecated since 4.16, and the long-term plan for the new Hair Rendering and Simulation features is to help provide a migration path for those who are currently using the HairWorks integration.

The last official NVIDIA version of HairWorks made available for UE4 was 4.16, but various patches and upgrades have been created and are available online although none of these are officially supported.

This implementation is not an immediate replacement for HairWorks and is only an interim solution for Rendering and Simulation of hair groomed in external DCC tools.

Enabling Hair in your Project

The following settings and plugins must be enabled to use Hair in your project.

Project Setting

Open the Project Settings by going to Edit > Project Setting. Under Rendering > Optimizations, enable Support Compute Skin Cache.

HairProjectSettings.png

An Editor restart is required for this settings to take effect.

Plugins Browser

Open the Plugins browser window by going to Edit > Plugins. Under the Geometry category, enable these plugins:

GroomPlugins.png

  • Alembic Groom Importer

  • Groom

An Editor restart is required for these plugins to take effect.

Basic Workflow

The flowchart below describes the high-level process of bringing your own Hair Grooms into UE4 and attaching them to a Skeletal Mesh character that can be animated.

HairBasicFlow.png

  1. Create your Hair Groom in your preferred DCC application.

  2. Export your Hair Groom as an Alembic (*.abc) file.

  3. Import your Alembic Groom file into UE4.

  4. (Optional) Create a Binding Asset from the Content Browser for your Skeletal Mesh.

  5. Place your Groom Asset in the World (as an Actor or in a Blueprint).

  6. Attach the Groom Component (Actor) to Skeletal Mesh Socket with Transfer Skinning.

  7. Setup and Assign your Hair Material

Once these steps are completed, you will have an interactive groom that can be used on an attached Skeletal Mesh that is animating.

Follow along with the Hair Rendering and Simulation Quick Start guide to perform all these steps in more detail.

For additional details on setting up your Hair Groom for export and import into UE4, see the Alembic for Grooms Specification reference page that covers the schema that will enable UE4 to import grooms directly.

Hair Attributes Material Expression Example

For Hair geometry to render correctly, it needs a Material assigned whose Shading Model is set to Hair.

Material_Settings.png

You'll also need to have Use with Hair Strands enabled under the Usage category. This should automatically be enabled when applied to a Groom, but if not, you can enable it manually.

The following is an example Hair Material using the Hair Attributes Expression:

Material_HairExample.png

Binding Asset

Binding Assets are used attach and skin a Groom Component to a Skeletal Mesh Component. It's a way to assign a groom to the Skeletal Mesh it has been authored for and to assign it to ones that share the same topology.

It's optional whether you create a Binding Asset for binding a groom onto a Skeletal Mesh. However, if one is not provided, the projection is done at runtime, which implies a large GPU cost at startup time.

BindingAsset.png

Create a Binding Asset by right-clicking on a Groom Asset in the Content Browser and selecting Create Binding from the context menu. Use the Groom Binding Options window to assign a Target Skeletal Mesh and Source Skeletal Mesh to create the binding.

A Target Skeletal Mesh must be specified to create the Binding Asset. Otherwise, no binding is created during this process.

Hair Physics with Niagara

To use physics on your character's hair, open the Groom Asset and under the Hair Physics category's Solver Settings and place a check next to Enable Simulation.

HairPhysicsGroomSettings.png

Debugging Hair

Use the following console variables for debugging hair in your project:

Console Variable

Description

r.HairStrands.DebugMode

Enable one of the following command modes to draw various stats and debug information about hair rendering to the screen:

  • 0 - Off

  • 1 - Cluser info

  • 2 - All DOMs light bounds

  • 3 - Screen projected clusters

  • 4 - Deep opacity maps

  • 5 - Sub-pixel sample count

  • 6 - TAA resolve type (regular/responsive)

  • 7 - Type of hair coverage

  • 8 - Hair density volume

  • 9 - Hair tangent volume

  • 10 - Hair base color volume

  • 11 - Hair roughness volume

  • 12 - Hair mesh projection

  • 13 - Hair coverage

r.HairStrands.StrandMode

Enable this command to render the selected debug mode for hair strands in the scene:

  • 0 - off

  • 1 - Simulation strands

  • 2 - Rendering strands influence

  • 3 - Roots UV

  • 4 - Roots UV UDIM texture index

  • 5 - Hair UV

  • 6 - Hair seed

  • 7 - Hair dimensions

  • 8 - Hair radius variation

  • 9 - Hair vertices color

  • 10 - Hair vertices roughness

Known Limitations

  • Frame rate depends on the size of the groom, its resolution, and underlying hardware it's being run on. For example, you should expect a 30Hz or higher frame rate with a 2080Ti for a human groom at 1080p.

  • View Modes are not yet supported on Hair.

  • Multi-view (hair visible on several open windows) is not yet supported, or can cause artifacts to appear.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback