keywords: UE5, Groom, Hair, Fur, Performance Optimization

Cases

How to change groom material at run-time

Add matertial slots in the Material tab of Groom Asset editor, then switch material by index.

if (AActor* Actor = UGameplayStatics::GetActorOfClass(this, ACharacter::StaticClass()))
{
	if (UGroomComponent* Groom = Cast<UGroomComponent>(Actor->GetComponentByClass(UGroomComponent::StaticClass())))
	{
		const TArray<FHairGroupsMaterial>& MatGroup= Groom->GroomAsset->HairGroupsMaterials;
		if (Index >= 0 && Index < MatGroup.Num())
		{
			if (UMaterialInterface* Mat = MatGroup[Index].Material)
			{
				Groom->SetMaterial(0, Mat);
			}
		}
	}
}
How to switch groom LOD at run-time

Add LOD group in the LOD tab of Groom Asset editor, then switch groom LOD by index.

UGroomComponent* Groom = ...;
Groom->SetForcedLOD(2);

Performance Optimization

Groom Asset Performance Optimization

Reduce Curve Decimation and Vertex Decimation in Interpolation detail panel.

Disable Voxelize and Use Stable Rasterization in Strands details panel.

Use Attach Parent Bound

Enable bUseAttachParentBound.

UGroomComponent::bUseAttachParentBound

Issues

Issue: How to fix the flickering in groom hair [UE4]

Enable Cast Deep Shadows in light actors.

Origin:
https://www.youtube.com/watch?v=4d7H3bEaXsw

Issue: The target skeletal mesh could be missing UVs
LogHairStrands: Error: [Groom] Binding asset could not be built. The target skeletal mesh could be missing UVs.
LogHairStrands: Error: [Groom] Binding asset could not be built. Some cards guide roots are not close enough to the target mesh to be projected onto it.
LogHairStrands: Error: [Groom] The binding asset (11_2_head_Binding) couldn't be built. This binding asset won't be used.

Reason:
The origins of the coordinate axes of the hair and the character are not match.
Need to assign the Source Skeletal Mesh when creating Groom Binding asset.

Groom disappears after assigning Binding Asset

Solution:

  1. Skeletal Mesh -> Skin Cache Usage -> Enabled.
  2. Project Settings -> Engine -> Rendering -> check Support Compute Skin Cache.

Origin: Unreal Engine 5 Groom disappears after assigning Binding Asset
https://www.youtube.com/watch?v=QunXwmuxAf0

Misc

References

Hair Rendering and Simulation
https://dev.epicgames.com/documentation/en-us/unreal-engine/hair-rendering-and-simulation-in-unreal-engine

Groom Asset Editor User Guide
https://docs.unrealengine.com/5.3/en-US/groom-asset-editor-user-guide-in-unreal-engine/

XGen Guidelines for Hair Creation
https://docs.unrealengine.com/5.3/en-US/xgen-guidelines-for-hair-creation-in-unreal-engine/

Create Hair in Unreal Engine 5 | Groom Tutorial Works in UE5
https://www.youtube.com/watch?v=gxp0FxyTflc

How to Create Hair in Unreal Engine 5 - Groom Tutorial
https://www.youtube.com/watch?v=ODkhcRvcaso

Groom (Hair & Fur), a brief overview of how Groom (hair & fur) works in Unreal Engine 4.
https://dev.epicgames.com/community/learning/tutorials/p4BG/unreal-engine-groom-hair-fur

Assets

Cyberpunk Hair is a groom game-optimized pack ready to a vast amount of styles
https://www.unrealengine.com/marketplace/en-US/product/cyberpunk-hair-for-game

Tools

Ornatrix UE5 plugin. Hair and fur editing suite inside Unreal Engine!
https://ephere.com/plugins/epic/ue/ornatrix/

gFur is a free shell based fur solution for Unreal Engine.
https://www.unrealengine.com/marketplace/en-US/product/gfur-5
https://github.com/GiM-GamesInMotion/gFurPro


In a group of many words, there is bound to be a mistake somewhere in them. -Chinese Proverbs