Skip to main content

Performance Optimization

This guide explains how to optimize KawaiiPhysics performance.

Performance Characteristics

KawaiiPhysics is lighter than typical physics simulations because it doesn't use PhysX.

Processing Cost Factors

FactorImpact
Bone countHigh
Collision countMedium-High
Node countMedium
Curve usageLow

Optimization Techniques

1. Reduce Bone Count

Only make the minimum necessary bones physics targets.

// Bad example: All bones as physics targets
hair_root → hair_01 → hair_02 → hair_03 → hair_04 → hair_05

// Good example: Only important bones as physics targets
hair_root → hair_02 → hair_04

2. Optimize Collision

  • Use simple shapes
  • Remove overlapping collisions
  • Adjust collision count based on LOD

3. Disable Based on LOD

KawaiiPhysics can be disabled based on distance.

// Disable physics at LOD 2 and above
if (GetCurrentLOD() >= 2)
{
bEnabled = false;
}

4. Adjust Tick Rate

Reducing update frequency can reduce load.

5. Using Warm Up Feature

The Warm Up feature allows you to pre-stabilize physics simulation when spawning characters.

Warm Up Parameters

Configuration:

  1. Set Need Warm Up to true
  2. Specify the number of warm-up frames in Warm Up Frame (1 or more)
tip

Larger Warm Up Frame values lead to more stability but increase initialization load. Usually 10-30 frames is sufficient.

AnimNode Functions

Warm Up can also be dynamically enabled via AnimNode functions. See Changelog v1.13.0 for details.

Profiling

Checking with Unreal Insights

  1. Run stat KawaiiPhysics console command
  2. Check processing time

Identifying Bottlenecks

  • Many bones → Reduce bones
  • Heavy collision calculation → Simplify collision
  • Many characters → Use LOD

Benchmark Guidelines

Character CountBones/CharacterApproximate Processing Time
120Under 0.1ms
1020Around 1ms
5020Around 5ms
note

Actual processing time varies by environment. Always profile on actual hardware.