Hair Simulation and Rendering Quick Start Guide

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

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.

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 using the Third Person template.

  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 the Support Compute Skin Cache option.

    Enable Support Compute Skin Cache in Project Settings

    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.

    Enabling Groom Plugins

    In the search bar start typing groom and enable the following plugins:

    • Alembic Groom Importer

    • Groom

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

    Restarting the Unreal Editor

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 Unreal Engine 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 Unreal Engine with proper naming conventions.

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

    From your Content Drawer, click Import

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

    The Groom Import Options Window

    • 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 SKM_Manny 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 SKM_Manny Skeletal Mesh found in the Characters > Mannequins > Meshes folder and drag it into the scene.
    Drag the SKM_Manny into the Scene

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

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

Creating a Binding Asset

  1. In your Content Drawer, locate your Groom Asset. Right-click it and select Create Binding.

    Create a Binding Asset

  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.

    Assigning a Target Skeletal Mesh for the Groom Binding Asset

  3. This will open your Groom Binding Asset. Save it and close the window.

    Groom Binding Asset Details

  4. Select the Skeletal Mesh in your level. Use the Details panel to select the Groom Component in the Components panel. Under the Groom section, use the Binding Asset slot to assign the Binding Asset you created.

    Assigning a Binding Asset to the Skeletal Mesh

4 - Setting Up Your Hair Material

By Default, Unreal Engine contains a simple Hair Material with HairDefaultMaterial.

The steps below are optional for this guide since Unreal Engine 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 Drawer, click the Add button and select Material.

    Create new Material

  2. Give your Material Asset a name and open it.

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

    Select Hair for the Shading Model Property

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

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

    Basic Hair Material Node Setup

    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.

  5. Save and close the Material Editor.

  6. 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.
    Applying the hair Material through the Details Panel

    Groom Asset Actor (Details panel)

    Applying the hair Material in the Groom Asset Editor

    Groom Asset (Groom Asset Editor)

5 - Setting Up Hair Physics

In this step, you'll enable physics simulation for your Groom Asset.

  1. In your Conent Drawer, locate your Groom Asset and open it in the Groom Asset Editor.

  2. Go to the Physics tab and check the box next to the Enable Simulation option.

    Enabling Simulation from the Physics window in the Groom Asset Editor

Once enabled, the properties in the Physics tab 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.