Hair Rendering and Simulation Quick Start

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

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

    2_2_ImportGroom.png

  3. In the Groom Import Options window, click Import.

    2_3_GroomImportOptions.png

During the import process, the Groom system will look for attributes and groups that follow the Alembic naming conventions outlined in the Alembic for Grooms specifications page, and import them to a new Groom Asset.

3 - Setting a Skeletal Mesh with a Groom

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 and drag it into your scene. It can be found in the Mannequin > Character > Mesh folder.

  2. With the Skeletal Mesh selected in the scene, use the Details Panel to click the Add Component button and add a Groom Component.

    3_2_AddGroomComponent.png

  3. Select the Groom Component. Then, under the Groom section, use the Groom Asset to assign your imported hair groom to this Skeletal Mesh.

    3_3_AssignGroomToSkelMesh.png

  4. In the same section, enable the flag Bind Groom to Skeletal Mesh. Once enabled, the groom will position and follow the movement of the Skeletal Mesh it is attached 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.

Optional Binding Asset

Creating and assigning a Binding Asset can be done to cache the project datas of the groom for this Skeletal Mesh. If no Binding Asset is provided, the groom projection is done at runtime with an added GPU cost at start up.

Create a Binding Asset following these steps:

  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. A window for Groom Binding Options will pop up. 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.

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