Unreal engine 4 blueprints
If the cloth mesh is drastically different when it is simulated, the player will always see this transition. The problem with this method comes from the simulation reset that occurs when the simulation is switched back on.
The ”Was Recently Rendered” function in the switch blueprint. This will stop the cloth simulation when the actor is no longer rendered.įigure 4. To do this, call the “Was Recently Rendered” function, and attach its return to the switch branch (Figure 4). If a more automated approach is desired, Occlusion Culling can be used as the switching variable. This event could be called on a trigger entered to begin simulating the cloth meshes in the next area, and again when the player leaves that area to stop those simulations, or any number of methods, depending on the game level.įigure 3. By creating an event (or function), we can branch using a Boolean switch between simulating the cloth (LOD 0) and not simulating the cloth (LOD 1). Now that we have a switch, we can setup a simple blueprint to control it. Using this to our advantage, we can create a LOD 1 that is the same in every way as our LOD 0 (minus the cloth apex file), and use it as a switch for whether we want to use the cloth simulation (Figure 2).įigure 2. If the mesh is ever switched off of LOD 0, the cloth simulation will no longer take place. When creating a skeletal mesh and attaching an apex cloth file to it, that cloth simulation will always be tied to the zero value of the Level of Detail (LOD) of that mesh. By adding an increasing number of cloth meshes to the level, the number of simulations the CPU can handle at once becomes apparent. Keeping these two numbers within a reasonable level to your target platform helps prevent a loss of frame rate due to the CPU being loaded down with processing cloth. While there is a lot of information available, we need only worry about the first two (Cloth Total and Cloth Sim) for the purposes of this paper.Ĭloth Total represents the total number of cloth draws within the scene, and Cloth Sim (simulation) represents the number of active cloth meshes currently simulated.
To remove it, just enter the same command into the console. To get a better understanding of cloth simulation and its effect on a game and system, we can use a console command Stat PHYSICS in Unreal.Īfter entering Stat PHYSICS at the command line, the physics table overlay appears (Figure 1). Do not rely on the Disable Cloth setting for optimizing simulated cloth, as this only works in the construction, and has no effect while the game is in play. Disabling Cloth SimulationĬloth simulations in Unreal are in the level they will be simulated, whether they can be seen or not.
UNREAL ENGINE 4 BLUEPRINTS HOW TO
Incorporating these simulations into Unreal Engine* 4 is easy, but as it is a taxing process on the CPU, it’s good to understand their performance characteristics and how to optimize them. Using PhysX* Clothing* is one way to do this without the need of hand animating. Realistic cloth movement can bring a great amount of visual immersion into a game.