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 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 the following sections, enable these settings:

  • Rendering > Optimizations > enable Support Compute Skincache

  • Animation > Performance > disable Tick Animation on Skeletal Mesh Init

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

Plugins Browser

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

  • 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. Place your Groom Asset in the World (as an Actor or in a Blueprint)

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

  6. Setup and Assign your Hair Material

  7. Assign the Niagara GroomAssetSystem as a child of your Groom Component

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.

Once you complete these steps, you'll have an interactive groom that can be used on attached Skeletal Meshes that are animating.

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

Hair Physics with Niagara

The Groom system requires that for physics to be used, a Niagara system be attached as a child component on the Groom Component; in the Level on an Actor through its Details panel, or as a child component in a Blueprint Components panel.

The UE4 Groom system comes with its own Niagara Particle System that can be used with the Groom component called GroomAssetSystem. It can be accessed when assigning a Niagara System through the Niagara Component.

AssignNiagaraGroomAsset.png

  1. Setup a Niagara component to be a child of the Groom component.

  2. Use the Niagara System assignment box to select a Niagara Particle System.

  3. Select the GroomAssetSystem from the dropdown.

The Niagara GroomAssetSystem is part of the Groom system's plugin and is contained in the Content Plugins folders. If you do not see it in the list after enabling the Groom plugins, use the dropdown to select View Options and enable Show Plugin Content.

ViewOptionsNote.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

  • Decimation based on distance isn't yet implemented.

  • Frame rate depends on the size of the groom, its resolution, and underlying hardware it's been run on. For example, you should expect a 30Hz or higher framerate 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