Hair Rendering

An overview of strand-based hair import, rendering, and simulation.

Windows
MacOS
Linux

Traditionally, hair that has been created for use in real-time engines has been created using card-based techniques, or other similar approximation. Card based workflows use a large number of flat sheets (or cards) to give the approximate shape, and motion, of a much larger number of individual hairs. Using the Groom system and tools of Unreal Engine enables you to render each individual strand of hair, which significantly improves visual fidelity of simulated hair in real time.

While no standard format currently exists for hair grooms, the groom system provides a naming convention-based scheme using Alembic (.abc) files to ingest data exported from your modeling application. It provides support for multiple hair groupings within a single file, such as head, vellus, beard, eye lashes, and brows, a hair shader and rendering system, and dynamic physics integration driven by Niagara.

The groom system provides a minimal viable implementation of strand-based hair importing, editor, rendering, and simulation. The system does not provide a hair grooming solution. Hair shaping, or grooming, needs to be performed in your external modeling application, such as XGen within Maya, Ornatrix, Yeti, Shave and a Haircut, or Houdini.

Enabling Hair in your Project

Enable the following plugins and settings to get started using Hair Grooms in your project.

An Editor restart is required for each of these to take effect.

Project Setting

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

HairProjectSettings.png

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

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.

Groom Asset

Groom Assets represent your imported Alembic (.abc) file's hair groom and they are stored in your Content Browser. Double-clicking the Groom Asset opens the Groom Asset Editor.

GroomAssetEditor.png

The Groom Asset Editor enables you to manage and edit parts of your groom. You'll be able to:

  • Assign Materials

  • Create Levels of Detail Meshes that represent strands, cards, or a mesh

  • Enable and configure physics settings

  • Debug your groom with different view modes

Right-clicking the Groom Asset in the Content Browser provides several additional Groom Actions that enable you to:

GroomAsset_ContextMenu.png

  • Rebuild the selected groom's build settings from the Groom Import Options.

  • Create Binding to generate a Binding Asset used to attach a groom to a Skeletal Mesh.

  • Create Textures for Follicle and Strands using the selected groom.

For more information, see Groom Asset Editor.

Generating Strands Textures

The Groom Asset enables you to create textures based on the strands data from your imported grooms. You can generate a follicle mask for your skeletal mesh to better blend hair with its mesh surface. You can also create multiple strands textures that can be used to create a hair mesh or hair cards.

Your groom can be used to generate textures which can be applied to meshes.

DepthTextureOutput.png

TangentTextureOutput.png

HairMeshResult.png

Depth Texture

Tangent Texture

Hair Mesh with Generated Textures

For more information, see Generating Groom Textures.

Setting up a Hair Material

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 for the first time, 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.

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.

Enabling Physics Simulation

Enable physics on your groom by opening the Groom Asset Editor and from the Physics panel, check the box next to Enable Simulation under the Solver Settings.

HairPhysicsGroomSettings.png

Once enabled, you can explore the various physics settings that affect the groom component. See the Hair Properties Reference for details about each property.

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 - Cluster 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 that it's being run on. For example, you should expect a 30Hz or higher framerate with an RTX-2080Ti for a human-like groom at 1080p. Higher quality settings result in a significant performance drop.

  • Grooms do not yet support proper precomputed (Static/Stationary) lighting.

  • Depth of Field is supported but may still produce some artifacts.

HairWorks Users

For those using NVIDIA's hair solution HairWorks, which consists of DCC tool integration and real-time rendering and simulation for hair, Unreal Engine has deprecated HairWorks since version 4.16 of the engine. The long term plan is for the Groom system features to help provide a migration path for those who are currently using the HairWorks integration.

While the last official NVIDIA version of HairWorks made available for UE4 through their GitHub branch is version 4.16, various patches and upgrades have been created and are available online but are not official supported.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss