Hair Rendering and Simulation Quick Start

A guide to getting started using hair rendering and simulation with characters in your project.

Choose your operating system:

Windows

macOS

Linux

The focus of the Hair Rendering and Simulation guide is to walk you through the basics of working with your hair grooms on skinned meshes in Unreal Engine 4 (UE4).

After going through this tutorial, you will know how to:

  • Set up a project for hair rendering and simulation.

  • Set up a groom for use with an animated skeletal mesh.

  • Set up a basic Hair material.

  • Enable and control physics for hair.

1 - Required Setup

  1. Create a new project using the Unreal Project Browser using the Third Person template project.

  2. In the editor, go to the Main Menu and select Edit > Project Settings to open the Project Settings window. Under the Rendering > Optimization category, enable Support Compute Skin Cache .

    1_1_ProjectSettings.png

    You can ignore the Restart Now popup that appears in the bottom right of the editor window since the next steps also require you to restart the editor.

  3. Go to the main menu again and this time select Edit > Plugins to open the Plugins browser window.

    1_2_Plugins_a.png

    Use the search bar to search the term "groom," or use the left panel to select the Geometry category, and enable the following plugins:

    • Alembic Groom Importer

    • Groom

  4. Restart the editor for changes to the Project Settings and Plugins to take effect.

    1_3_Restart.png

2 - Creating and Importing your Groom

Grooms for a character—even a simple one—can contain different types of hair, such as that for heads, beards, brows, and more. Each of these types of hair could have its own Material and physics settings. There are also types of hair within each group, such as hairs that are to be used during simulation. This information can be defined during grooming in your DCC application, and UE4 looks at this information to define guides.

  1. In your preferred DCC application, create your Groom and then export it to Alembic (.abc) file format.

    Use the Alembic for Grooms Specification to prepare your groom for UE4 with proper naming conventions.

  2. In the Content Browser, click the Import button to import your Alembic file with your groom, or drag and drop your Alembic file into the Content Browser.

    2_2_ImportGroom.png

  3. In the Groom Import Options window, consider the following options:

    2_3_GroomImportOptions.png

    • Modify the initial Rotation that is baked into the groom, which avoids some extra runtime cost.

    • Use the Override Guides check box to replace the imported guides with a set of strands selected from the imported strands. The amount of guides depends on the Hair to Guide Density value.

    • Use the Interpolation Quality and Interpolation Distance to modify how the pairing between guides and the strands is handled for transferring the guide motion.

    • The Randomize Guide and Unique Guide checkboxes affect how a guide influences a strand is handled; whether only a single or multiple guides should influence a strand.

  4. Click Import .

During the import process, the Groom system looks for attributes and groups that follow the Alembic naming conventions outlined in the Alembic for Grooms specifications page, and imports them to a new Groom Asset. Among these attributes, the RootUV attribute fetches the UV of the underlying surface, such as a skin surface, which allows for the creation of some spatial variation across the groom.

3 - Attaching a Groom to a Skeletal Mesh

The Groom component enables you to attach a Groom Asset and bind a groom to a Skeletal Mesh's surface. An optional Binding Asset caches the projected data of the groom onto the Skeletal Mesh, which saves GPU costs of doing this at startup when one is not created and assigned.

Setting up the Groom Component

For this part of the guide, we'll use the SK_Mannequin found in the Third Person template. If you do not have this, you can add it to your project from the Content Browser by clicking Add New > Add Feature or Content Pack , and selecting the Third Person template.

Also, note that this same setup can be applied inside of a character Blueprint.

  1. In the Content Browser , locate the SK_Mannequin Skeletal Mesh found in the Mannequin > Character > Mesh folder and drag it into the scene.

  2. With the Skeletal Mesh selected, use the Details panel to click the Add Component button and add a Groom Component. 3_2_AddGroomComponent.png

  3. Select the Groom component and use the Groom Asset slot to assign your imported groom to this Skeletal Mesh. 3_3_AssignGroomToSkelMesh.png

  4. Enable the Bind Groom to Skeletal Mesh . This allows for the groom position to follow the movement of the Skeletal Mesh it is assigned to. 3_4_EnableBindingToSkelMesh.png

    To enable this property, the project setting for Support Compute Skin Cache must be enabled. Otherwise, this property is grayed out.

The binding information between the groom and the Skeletal Mesh is computed when the Bind Groom to Skeletal Mesh flag is set.This operation can cause a temporary freeze as it's being computed. To avoid this issue, create a Binding Asset (see below).

Creating a Binding Asset

  1. In your Content Browser, locate your Groom Asset. Right-click the groom and use the context menu to select Create Binding .

    3A_1_MenuCreateBinding.png

  2. The Groom Binding Options window will open. To create the asset, it's required that you assign a Target Skeletal Mesh and you can optionally specify a Source Skeletal Mesh that shares similar topology as the Target Skeletal Mesh. With these slots assigned, click Create .

    3A_2_GroomBindingOptions.png

  3. Select the Skeletal Mesh in your level. Use the Details panel to select the Groom Component in the Components panel. Under the Groom section, ensure that the flag Bind Groom to Skeletal Mesh is enabled, and use the Binding Asset slot to assign the Binding Asset you created.

    3A_3_AssignBindingAsset.png

When a Binding Asset is assigned to a Groom Component, the flag Bind Groom to Skeletal Mesh is automatically set and cannot be disabled while a Binding Asset is in place.

4 - Setting Up Your Hair Material

By Default, UE4 contains a simple Hair Material with HairDefaultMaterial .

The steps below are optional for this guide since UE4 includes a default hair material. However, if you've not set one up before, the steps below will guide you through the properties and setting required to do so.

  1. In the Content Browser, click the Add New button, and select Material from the dropdown menu, and give the Asset a name.

    4_1_AddNewMaterial.png

  2. In the Material Editor, use the Details panel to set the following:

    4_2_MatShadingModel1.png

    • Shading Model: Hair

    You also need to enable Use with Hair Strands . When the material is applied to a groom component, this checkbox should automatically enable itself and recompile the material. If it doesn't, you can enable it from the Usage category of the Details panel in the Material Editor.

  3. In the Material Graph, use the following node setup for a basic hair material:

    4_3_MatGraphSetup.png

    Use a Constant4Vector for the Base Color and a Constant to control the Roughness.

    If you're setting up more complex hair materials, use the HairAttribute expression in the Material Graph to access the hair attributes such as UV, Dimensions, RootUV, and Seed.

  4. Save and close the Material Editor.

  5. You can apply your hair material in one of two ways; directly on the Groom Asset component through its Details panel in the Level or Blueprint, or by opening the Groom Asset from the Content Browser. Assign your hair material to the Material element slot.

    4_5b_MatGroomActor.png

    4_5a_MatGroomActor.png

    Groom Asset Actor (Details panel)

    Groom Asset (Content Browser)

5 - Setting Up Hair Physics

In this next step, we'll enable physics simulation for our Groom Asset.

  1. In your Conent Browser, locate your Groom Asset and double-click to open its property editor.

  2. In the Hair Physics category, check the box next to Enable Simulation .

    HairPhysicsGroomSettings.png

Once enabled, the properties in under the Hair Physics category can be used to control the physics properties of the hair.

See the Hair Rendering and Simulation Settings reference page for more information on these Groom Asset properties.

Once enabled, you should see physics applied to the hair while working in the editor and when using play-in-editor (PIE) or simulate-in-editor modes.

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