At the Game Developers Conference (GDC) 2019, Epic revealed their new physics system, Chaos, and the destruction capabilities it brings to the Unreal Engine* 4 (UE4). Working with Epic Games*, game engineers at Intel have added Intel® Implicit SPMD Program Compiler (Intel® ISPC), that allows all current and future Chaos systems to take advantage of every CPU core available.
In this article series, we will go over a collection of optimizations and things to look for when including Chaos in your future UE4 projects. Part 1 focuses on the new Chaos Destruction Systems included in UE 4.23. Please note that working with Chaos requires a source build.
In order to use the techniques mentioned in this article a UE 4.23+ project is needed and all appropriate plugins enabled for the new Chaos systems. The plugins window can be opened by selecting Edit and then Plugins in the editor menu toolbar. Once open, bring up all Chaos plugins by typing chaos in the upper right search bar. Check Enabled boxes for Chaos Niagara, Chaos Solver, and ChaosEditor. The Chaos Cloth plugin is selected in the figure below, but is not required for these tutorials.
Figure 1. Enabled Chaos plugins.
The first step to creating a Chaos Destruction System (Chaos DS) is to select the static mesh desired within your map level in-editor. We will use the asteroid model pictured below for this, but the process is the same with any static mesh you create.
Figure 2. Static mesh in-editor.
Once selected, we can turn our static mesh into a geometry collection. This is done by opening the new Fracture Editor tab in the Editor Modes panel and clicking Generate Geometry Collection Mesh, shown circled in red in Figure 3. After the geometry collection is created, the static mesh selected is automatically removed from the level and replaced with the new destructible meshes.
Figure 3. Fracture Editor Modes tab with Generate Geometry Collection Mesh icon indicated.
Geometry collections are how Chaos DSs are represented in our scene. For this article we created a geometry collection from a single mesh, but you can select multiple meshes in-editor before clicking Generate Geometry Collection Mesh to generate one Chaos DS from all the selected meshes combined.
With the Chaos DS created we are now able to fracture it. Within the Fracture Editor window are the Fracture settings for the destructive system. There are a number of options when fracturing a mesh, but for this article we will use the Uniform Voronoi.
Figure 4. Fracture Editor Mode tab showing Uniform Voronoi configuration.
When setting the random range for the minimum and maximum number of chunks to be generated, we can see a preview of how the mesh will be fractured in the editor viewport.
Figure 5. In-editor Fracture Wireframe mesh view.
Finally, once we are satisfied with how the mesh will be split, fracture the mesh by selecting Fracture at the bottom of the Fracture Editor panel.
Figure 6. Fractured mesh.
Figure 7. Expanded view of a fractured mesh.
The basic Chaos DS created is destructible, but now we can increase the visual fidelity of the destructible with other Chaos features. By clustering a Chaos DS we can improve the performance of the system before it is broken, and get a more realistic visual when it is broken. While clustering does not have a large effect on graphical load, it greatly reduces the physics complexity, and might be something to consider if your scene is already highly CPU-intensive.
To cluster a Chaos DS we will use the auto cluster tool that the engine provides. First, we select all the chunks in our geometry collection by clicking Select All, shown circled in Figure 8.
Figure 8. Fracture Editor Modes tab with Select All icon indicated.
With all the pieces selected, click Auto Cluster and create a new level for the Chaos DS system. To switch between different levels, use the Level select menu, as shown in Figure 9.
Figure 9. The Cluster Level selection menu.
This divides the Chaos DS into a handful of larger sections, each containing the small chunks originally created with the first fracture. These higher level chunks let you better control the overall destructibility as well as providing destructibility of the destructible itself; for instance, a concrete pillar breaking apart, and the chunks of that pillar falling and breaking into even smaller chunks when hitting the floor.
Figure 10. Fracture Level 1 mesh view.
Figure 11. Fracture Level 1 expanded mesh view.
To get started with Chaos, a source build is needed. Please see the Unreal Engine* forums thread here for more information.
© 2019 Intel Corporation
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.