Chaos Scene Queries and Rigid Body Engine in UE5

Michael Lentine, Director, Physics Engineering |
May 4, 2022

Goal

With Unreal Engine 5.0, our internal physics engine Chaos ships as the default physics engine. This enables us to evolve physics technology within Epic and the game industry as a whole, and build high-impact systems such as networked physics, large world coordinates, vehicles, and destruction. We also aim to fully support all previous use cases of rigid body physics at performance parity with Unreal Engine 4. 

We have done quite a bit of testing leading up to the release of UE5, and have been working on improving the performance as our highest priority. In some cases, we have achieved significant improvements while in others, there is still work to be done in order to make up for the added cost of features such as large world coordinate support, which uses double-precision floats. This document will cover the current state of UE 5.0 physics and touch on the ongoing work that will be done for 5.1. In order to assess our progress, we compared test builds of a pre-released version of Unreal Engine 5.0 prior to LWC (large world coordinate) support using PhysX 3, the default physics engine in UE4 (Teal Configuration) and the Unreal Engine 5.0 release using Chaos (Blue Configuration).

We tested three different examples. The first is a tumbler test where we placed 512 dynamically simulated convex objects into a spinning convex object. The second is a ragdoll test where we dropped 64 ragdolls onto a flat convex plane. The third is a test with complex terrain, 100k static objects placed in the world, and 512 dynamic convex objects dropped onto the heightfield terrain. During each of these tests, we measure performance of the solver as well as of each type of scene query performed against the world.

Please note that this document only covers rigid bodies and scene queries. Physics in UE 5.0 also includes systems for cloth dynamics, hair dynamics, and fluid dynamics; you can find out more information about those systems in the UE 5.0 documentation.

Scene Queries

Scene Queries cover sweeps, overlaps, and raycasts.

Sweeps

Tumbler Test (Average Times: Teal Configuration - 11.64ms, Blue Configuration - 4.42ms)
Chaos Scene Queries Unreal Engine 5 Scene Queries Tumbler Test
Ragdoll Test (Average Times: Teal Configuration - 0.05ms, Blue Configuration - 0.07ms)
Chaos Scene Queries Unreal Engine 5 Sweeps Ragdoll Test
Landscape Test (Average Times: Teal Configuration - 0.55ms, Blue Configuration - 0.13ms)​​​​​​​
Chaos Scene Queries Unreal Engine 5 Sweeps Landscape Test

Overlaps

Tumbler Test (Average Times: Teal Configuration - 2.09ms, Blue Configuration - 2.58ms)​​​​​​​
Chaos Scene Queries Unreal Engine 5 Overlap Tumbler Test
Ragdoll Test (Average Times: Teal Configuration - 0.03ms, Blue Configuration - 0.04ms)​​​​​​​
Chaos Scene Queries Unreal Engine 5 Overlap Ragdoll Test
Landscape Test (Average Times: Teal Configuration - 1.76ms, Blue Configuration - 2.76ms)​​​​​​​
Chaos Scene Queries Unreal Engine 5 Overlap Landscape Test

Raycasts

Tumbler Test (Average Times: Teal Configuration - 0.21ms, Blue Configuration - 0.18ms)Chaos Scene Queries Unreal Engine 5 Raycast Tumbler Test
Ragdoll Test (Average Times: Teal Configuration - 0.04ms, Blue Configuration - 0.06ms)Chaos Scene Queries Unreal Engine 5 Raycast Ragdoll Test
Landscape Test (Average Times: Teal Configuration - 0.34ms, Blue Configuration - 0.67ms)
Chaos Scene Queries Unreal Engine 5 Raycast Landscape Test

Rigid Body Simulation

Performance

Tumbler Test (Average Time: Teal Configuration - 3.17ms, Blue Configuration - 4.76ms)
Chaos Scene Queries Unreal Engine 5 Rigid Body Tumbler Test
Ragdoll Test (Average Times: Teal Configuration - 5.30ms, Blue Configuration - 8.18ms)​​​​​​​
Chaos Scene Queries Unreal Engine 5 Rigid Body Ragdoll Test
Landscape Test (Average Time: Teal Configuration - 10.82ms, Blue Configuration - 5.34ms)
Chaos Scene Queries Unreal Engine 5 Rigid Body Landscape Test

Stability

While there is more work to be done on performance to make up for some of the extra computation we pay for various features, we do not only get the benefits of those features, but also a number of improvements related to stability.

UE5 Release:
Chaos Scene Queries Unreal Engine 5 Chaos

UE4 Release:
Chaos Scene Queries Unreal Engine 5 Physx
 

Future Work

The major areas of improvement that we are focusing on are raycasts and overlaps with large landscape heavy scenes, and convex rigid body simulation with highly dynamic scenes. With both raycasts and overlaps, much of the cost comes down to the quality of the acceleration structure and the extra cost that is taken with double precision. As an example, here is a comparison of the landscape test using direct traces without the acceleration structure search both in Teal Configuration (0.22ms) and Blue Configuration (0.15ms).​​​​​​​
Chaos Scene Queries Unreal Engine 5 Future Work
While this means that the result can vary a lot depending on the quality of the structure, our current focus is to accelerate the use of the acceleration structure regardless of what the map looks like. With highly dynamic convex scenes, the two biggest costs are in searching the acceleration structure and gathering data in a cache-coherent format. For the data transfer, we are focusing on optimizing how quickly that data transfer can happen. Additionally, while it’s a lower priority than those two efforts, we have not spent much time on optimizing the multi-threaded version of our algorithms and while the two solvers scale similarly on multi-threaded platforms, we plan on focusing more on better parallelization in 5.1.

    Get Unreal Engine today!

    Get the world’s most open and advanced creation tool.
    With every feature and full source code access included, Unreal Engine comes fully loaded out of the box.