Chaos Flash Tutorial
https://dev.epicgames.com/community/learning/tutorials/BEby/unreal-engine-chaos-flesh
Chaos Flesh
The Chaos Flesh provides high-quality, real-time simulation of deformable (soft) bodies in Unreal Engine. Unlike rigid body simulation, the shape of soft bodies can change during simulation based on their properties. The Chaos Flesh system supports the simulation of Static and Skeletal Meshes with a variety of parameters - giving artists unprecedented control over the end result. However, the system’s main focus is on the simulation of a character’s muscle deformation during skeletal animation. The Chaos Flesh system achieves high performance by simulating low-resolution geometry at runtime along with cached results from an offline simulation of high-resolution cinematic-quality geometry. Learn more about the Chaos Flesh system by following along in this tutorial series.
Brice Criswell
Epic Games
-
Brice Criswell
직원
4월 20, 2023•마지막 업데이트: 5월 12, 2023
•
애플리케이션
UE 5.2
자신만의 커뮤니티 튜토리얼을 만들고 싶으신가요? 튜토리얼 만들기
Chaos Flesh
Quick Start
The Flesh system implements a volumetric preserving simulation using a tetrahedral support structure. The tetrahedra are evaluated by the solver and provide supporting forces which prevent the character's surface from collapsing under its own weight. This example describes how to create tetrahedral geometry from a closed static mesh and then simulate the asset within the Unreal Engine.
[~7 min]
Play Video
Flesh Asset Setup
Simulation of the tetrahedron involves creating a deformable solver that resolves the forces and positions of the tetrahedron based on its interaction with the environment. The solver is executed independently from Unreal’s rigid body solver in a similar manner to the cloth system. While the current intention of the Chaos Flesh system is to provide highly accurate simulation results that can be cached and then used to train a GPU based ML-Deformer, the 5.2 release will also support in-game deformations of low resolution tetrahedron.
This example we'll go through the steps needed to set up the starfish asset that will be used throughout this tutorial.
[~8 min]
Link : FBX Static Starfish Asset
Link: FBX Animated Starfish Asset
Play Video
Constraints
Kinematics
Kinematic constraints allow the artists to control vertices through animation. The kinematics are defined on the vertices of the tetrahedron. When a vertex is defined as kinematic, the mass properties for that vertex will be set to infinite mass, and it will not be simulated. Kinematic vertices can be used as boundaries for the dynamics, where connected vertices that are not infinite mass will be enslaved to the motion of the kinematics. This example describes how to kinematically constrain a selected particle so that it stays fixed in space, relative to the components position.
[~7 min]
Play Video
Per-Particle Attributes
Many of the simulation properties used by the tetrahedral solver are per-particle based. For example, the mass can be varied across the mesh, and will be saved on the vertex of the simulated tetrahedron. This can allow tetrahedral meshes with varying uniformity to have a uniform distribution of mass across the volume of the mesh. Mass is just one example of a per-particle property, and it illustrates how every property that is stored on the particle can be configured within the asset’s setup. This demo will illustrate the use of fields to set per particle properties on the tetrahedron.
[~13 min]
Play Video
Skeleton Bindings
Skeletal mesh transforms can also be used to define kinematics. A typical use case involves attaching a FleshComponent to a skeletal mesh. The Flesh component does not need to be a part of the Skeletal Mesh geometry, but will need to be co-located within the skeletons local space. When properly aligned, the transforms from the skeleton mesh can be used to define kinematic attachments. This example shows how to define kinematic vertices based on nearby skeletal transforms.
[~5 min]
Play Video
Animated Skeleton
When the kinematic vertices are constrained to an animated skeleton the tetrahedral geometry will be enslaved to the motion of the skeleton. For these setups the flesh component will be created as a child of the Skeletal Mesh Actor. This example shows the setup involved with driving a flesh mesh from an animated transform hierarchy.
[~10 min]
Play Video
Position Targets
Position targets, or weak constraints, are another way we can constrain geometry to a target position. The difference between position targets and kinematic targets is that the constraint has a stiffness which allows for a slight slip from the actual target. This can be important in environments that are over constrained, or the constraint configuration does not have a actual solution. By introducing soft constraints into an over constrained environment, the simulation can find a reasonable state that can remain visibly acceptable.
[Starfish.anihttp://m.v1.3.fbx]
[~12 min]
Play Video
Collisions
World Collisions
The tetrahedral solver is executed independently from the primary world solver. In a manner similar to the Chaos Cloth solver, any collisions against the tetrahedral geometry will need to be added during the simulation. This demo will illustrate how to add collision bodies at the start of the simulation using a collision manager that is attached to the Flesh solver.
[~4 min]
Play Video
Streaming Collisions
Collisions against world geometry are currently implemented via a streaming system. The tetrahedral solver can respond to a limited set of collision types which should be loaded and released based on the proximity to the tetrahedral simulation. Collisions against the tetrahedral solver are implemented as vertex-based collisions against the rigid body volume, so as the resolution of the tetrahedron increases so will the computational cost of the collision response.
Currently the solver supports convex and a few analytic types (sphere, cube, plane), and the collision is only one-way, from the rigid body to the tetrahedron. This means that the tetrahedron will not affect the state of the rigid body, and the rigid body is effectively a kinematic, infinite mass, interaction. Typically, the position and velocity of the rigid body will be calculated on the primary rigid body solver, and the flesh will only react to the motion of the rigid bodies.
[~17 min]
Play Video
Rig Bound Raycasts
Rig bound raycasts allow certain types of objects to interact with static geometry in the environment. The raycast approach is NOT a general environmental collision setup, but under specific setups will allow a deformable body to respond to scene geometry. For example, this setup was used in the Electric Dreams Demo to allow the tires to react to scene geometry. [link]
There are a few requirements that need to be met for this approach to be useable. The raycast vertices will need to be convex about a transform location in the model, the tetrahedral component will need to be contained in a skeletal mesh blueprint, and the asset needs to be kinematically constrained to a skeleton. Due to the way the collision response is implemented, the raycast origin must originate from an interior point of the model, and the collision response will translate the vertex towards the interior origin, against the direction of the raycast.
[Rotation Rig FBX]
[~20 min]
Play Video
Gameplay
Skeletal Mesh Deformation
Flesh assets can deform skeletal meshes. Use the “GenerateSurfaceBindings” node in the flesh asset dataflow graph to build correspondence data between a skeletal mesh’s render surfaces and a tetrahedral mesh. Then use the “DG_FleshDeformer” on the skeletal mesh to apply the deformation of the tetrahedral mesh to the skeletal mesh.
[~13 min]
Play Video
If the deformer doesn’t seem to be working, check the log for clues. One potential issue emerges if the actor has multiple flesh components, and the deformer needs to be told which skeletal mesh is to be deformed by which flesh asset. Disambiguation is accomplished by setting the name of the skeletal mesh in the flesh asset (rest collection) “Target Skeletal Mesh” (in Release-5.2; in main the “Target Deformation Skeleton” is used). The other thing to check is the flesh asset (rest collection) has bindings to the right skeletal mesh via “GenerateSurfaceBindings”. Of course, if the topology of the render surface or the tetrahedron mesh changes, the bindings need to be regenerated. Render points that have no bindings will be skinned. If the deformer leaves points behind, either they have no binding, or they’ve been masked out (which currently is only done if there is no binding, but there will be dataflow nodes for masking in the future).
Blueprint Creation
Flesh assets can be spawned during blueprint operations as well. The Blueprint Actor will work in a manner like the Skeletal Mesh Actor, where you create a Flesh component and associate it with a Flesh Asset. The Spawn and Destroy Actor blueprint nodes can then be used to dynamically add and remove blueprint actors to the simulation.
[~6 min]
Play Video
Sampling Simulation Results
While the render display for the Flesh Component shows the result of the entire tetrahedral simulation, sometimes it might be useful to just sample a subset of the deformations from the simulation. For example, the world position offset (WPO) rendering of the Nanite mesh in the Electric Dreams Demo was implemented by sampling positions near the surface of the tire, and mapping that into a texture which displaced the tire geometry on the GPU. [link]
This demo will illustrate how to define a sample set from the deformation results that can be accessed during gameplay.
[Rotation Rig FBX]
[~9 min]
Play Video
Offline Simulations
Caching Simulations
Flesh simulations can be expensive. While a low resolution asset can be made to perform within a game, in order to achieve results on high resolution geometry, the tetrahedron will not be able to run in real time. The caching system will allow artist to record the results of a simulation and play them back in game or within sequencer. This example illustrates how the caching system is used to capture the results of the simulation.
[~8 min]
Play Video
Core Solver
Simulation Properties
Simulation properties are set in several places throughout the Chaos Flesh system. The Tetrahedral Solver will have properties that affect the entire simulation system, for example, allowing users to configure time stepping and threading properties, as well as general debugging controls to disable features across multiple actors. While the properties on the Flesh Actor allow for specific configurations of an individual instance of an asset the Dataflow-based properties configure the asset itself. This demo goes through a few of the more important properties of the simulation and will give you an overview of where you might expect to find specific types of controls.