Physic - Stellar-Blade-Modding-Team/Stellar-Blade-Modding-Guide GitHub Wiki
Overview
[!IMPORTANT] In this document we will be scripting how to make physic with your custom model or modified in game model for Stellar Blade. There are two different methods for Physic editing which are Cloth System(Apex/nvcloth) and Bone physic(Kawaii/AnimDynamics). However the game is using chaoscloth In Unreal Engine, cloth simulations can be attached to bones of a skeletal mesh using the Chaos Cloth system. There are also spring controller for jiggle physic which will be covered as well in this document.
Required Tools & Plugin
For Cloth Simulation it's an inbuild feature in UE which means you only need to have the engine installed.
For bone physic, currently we don't have kawaii addon working for Stellar Blade so we will be introducing AnimDynamics which is also an inbuild feature in UE.
Cloth Simulation
[!NOTE] In UE game development, both AnimDynamics and cloth systems are used for creating realistic movement, but they serve different purposes. AnimDynamics is a low-performance physics solver for secondary animation, while cloth simulation simulate the behavior of fabric, like clothing, often using more complex simulations. AnimDynamics is useful for items like necklaces or wires, while cloth systems are used for more complex, deformable objects like clothing. You can also use both methods to reach the result you want for your mods.
Workflow in Blender
For in game model
In game models often have everything parented and weighted properly since the game use both bone and cloth system as a combination. We will use CH_P_EVE_09
Diving Suit as example, the "wings" that were wrapped around the arms will lost physic during reimport in UE since its using Chaos Cloth. We will manually paint the physic back on the wings in UE to show you how it works with cloth simulation.
*Example CH_P_EVE_09
https://github.com/user-attachments/assets/358d32d9-7ef5-4423-a861-217d79498394
For custom model
You will need to have your "ready for physic" mesh pieces parented to the Armature. If its for a dress for example, You are going to add cloth physics to main part of the dress later in UE . So, In blender you should assign the correct vertex weights and Hip bone on your dress since we need cloth physics below the hip 'Bip001-Pelvis
. That means your dress will follow the movement of your characters Hip bones.
Workflow in UE
For in game model
We have made a video to show you the process of making Clothing Simulation (not included collision and proxy) in UE. This is an simplified example for beginners and the painting was in a rush so try not to follow that part and test with different values and options yourself in clothing tab. We will cover more details in custom model physic section.
https://github.com/user-attachments/assets/50c0e3e3-c73a-4557-9c6d-a7f498fa226f
Once you imported model in UE, move everything to the right folder and make sure names are correct by Inpsecting asset info.
Double click on the skeleton mesh. Enable Select Section
.
Select the mesh part you want to add cloth physic with> Right click and create cloth data from section
Right click again and Apply Clothing Data
> Select the Clothing Data you created for your Skeleton Mesh> Assign PhysicsAsset in the tab if it didn't
Once its assigned with the Clothing Data, navigate to Clothing Tab and click Activate Cloth Paint
The paint value is the key to how the physic behaves in game. In tool settings, you can change Paint Value
from 100
to 0
. At the bottom of the wings it should be assigned with higher value since it doesn't attached to the body. From the top part of the wing it should have lower value since its getting closer to the actual body. For the part that gets directly attached to the body, you can leave it as not painted so it won't simulate with the cloth physic.
In visual we will use this image as example.
Black is value 0 and white/grey is increased weight.
For the wings you can paint from bottom till the top for value 100
to 70
to 40
to 10
and so on.
Use value 10
to 0
where the cloth is directly attached to the body. Since it will have movement with shoulder bones we don't need it to have cloth physics assigned. So the cloth physics will mostly be noticeable for the rest part of the wings.
Once you finished Painting, Click Save
and Click Deactivate Cloth Paint
in cloth tab.
[!WARNING] Make sure your PhysicsAsset is named properly for your Skeleton Mesh by Inspecting PhysicsAsset Info. We will need to assign it to PrimaryAssetLabel for collision data later. Make sure you changed
Physic Type
in PhysicsAsset toKinematic
following by this solution. Otherwise your model will behave as a ragdoll and sink under the floor.
For custom model
Work in progress.
Chaos Cloth System
[!NOTE] The cloth system doesn't directly use bones for simulating cloth physics. Instead, it utilizes a particle-based system called Chaos Cloth, which simulates the behavior of cloth by treating it as a collection of interconnected particles. While bones are used for the underlying skeletal mesh and its animation, the cloth simulation itself is independent and interacts with the skeletal mesh through collision and influence.
You can create a proxy mesh (low poly object) for the part that's gonna uses for Cloth System as cloth asset. Later we need to assign it to the Chaos Cloth component in UE.
If there is no proxy mesh, you should be able to create the cloth data from the part you are trying to use chaos cloth on. (7th diving suit wings, for instance)
If there is a proxy mesh, you need to make sure that when you create the cloth data, you remove it from the mesh.
By using Cloth System it allows for realistic draping and movement of clothing on animated characters. The process involves creating a cloth asset, configuring its properties, and then binding it to a specific bone or set of bones within the character's skeleton.
Step 1: Creating a Cloth Asset
Import or create a cloth mesh:
This can be a separate mesh or a part of an existing character mesh.
Alternatively, use the Clothing Tools in the Editor:
This workflow enables direct authoring of clothing assets within the engine.
Step 2: Binding the Cloth to a Skeletal Mesh
Add a Chaos Cloth Component:
This component is added to the skeletal mesh actor in the level.
Assign the Cloth Asset:
You select the cloth asset you created earlier and assign it to the Chaos Cloth component.
Configure Collision:
You can set up collision between the cloth and other objects in the scene, including the character's own body.
Adjust Simulation Parameters:
The Chaos Cloth component provides various parameters for controlling the cloth's behavior, such as stiffness, damping, and collision settings.
Step 3: Bone Binding
Define Bone Influence:
The cloth simulation can be influenced by specific bones in the skeletal mesh. This is typically done through skin weights, which define how much each bone affects the cloth's movement.
Collision with Bones:
You can also set up collision between the cloth and individual bones, or groups of bones, to prevent the cloth from penetrating the character's body.
Step 4: Testing and Iteration
Simulate in Editor:
Use the editor's play mode to test the cloth simulation in real-time and make adjustments to the cloth asset or its parameters.
Optimize for Performance:
Consider optimizing the simulation for performance, especially for real-time applications. Techniques like LOD (Level of Detail) and caching can help.
By following these steps, you can effectively integrate cloth simulations into your UE projects, creating more realistic and dynamic character clothing for your mods.
Work in progress.
AnimDynamics
[!NOTE] In Unreal Engine's AnimDynamics, bones are used as reference points for applying simulated physics to objects, such as accessories or clothing on a character. The AnimDynamics node allows you to select a bone on a skeletal mesh and apply dynamic motion to it, controlling how it reacts to the character's animation and other forces. For that to work in the first place, you would need to have your mesh assigned with bones for physics.
Workflow in Blender
*Example AP_CapeR02
https://github.com/user-attachments/assets/83afa606-f666-4343-9e31-df79f6ed7d18
AnimDynamics in UE relies on a character's existing bone structure to simulate dynamic secondary animations. It uses the bones as a framework for creating chains and applying constraints, allowing for realistic movement and collisions. As long the model have its "physics" part assigned with vertex weights and bones it will work in UE for AnimDynamics.
Workflow in UE
[!TIP] Here is a short introduction of every settings and options. Each options has its own roles within AnimDynamics in UE.
Reference Point
: AnimDynamics uses a bone as a reference to determine where the dynamic motion should be applied. For example, you might select a character's arm bone as the reference for a dynamic shoulder pad.
Bounding Box
: You can define a bounding box around the selected bone to control the area where the physics simulation will be active.
Local Joint Offset
: This offset determines the reference point for the constraints applied to the dynamic object, relative to the selected bone's joint.
Constraint Settings
: You can adjust constraint settings like stiffness and damping to control how the dynamic object reacts to movement and collisions.
Dynamic Motion
: By adjusting these settings, you can create effects like clothing that reacts to wind or a character's movement, or a weapon that bounces realistically.
Continuous Dynamic Chains
: You can also use AnimDynamics to create continuous dynamic chains of bones, where the motion of one bone affects the motion of the next.
Work in progress.
Misberave)
Spring Controller for Jiggle bone physic ( wrote byThis is a tutorial on how to enable jiggle physics for breast and literally everything you want. It works universal for UE engine games so you can now use this method for Stellar blade.
https://github.com/user-attachments/assets/b4862ad5-2d19-4b70-938e-8e0e6d06e449
-
First you need to create an animation Blueprint on your mesh which will be assigned to the skeleton automatically ONLY, you cannot duplicate or reuse it for another skeleton later, it is strictly bound to the one you created it for.
-
Then you create the nodes from the video, and one "Spring Controller" for each Bone you want to assign jiggle movement to.
The Jiggle will only affect the weight painted areas that are assigned to the bones
- After that you set up the values.
The Values for each Bone are as followed:
Spring Stiffness: The more, the stiffer
Spring Damping: Damps the jiggle, the higher, the sooner the jiggle will end, the lower, the longer the jiggle will "swing"
Max Displacement: Determines how far awar from the bone the mesh will move away from, best to set it to 1,5-3 max.
For Breasts you should start with 400 stiffness, 10 Damping and 3 max displacement. Brings good results in lobby and then adjust from there.
These are the only settings you need to change. Keep in mind for ingame you need to crank up the damping alot more cause the movement is way more than in the lobby. I set it to 120 for my Squirrel Girl mod.
-
After you created the nodes, you can test the jiggle a bit when you press "Compile" in the left preview window multiple times, thats the only preview you get in the engine.
-
The last step is to add the Blueprint as "post processing animation blueprint" inside the settings for your Mesh.
Make sure you package the animation blueprint with your mod and thats it.
Known Bugs and Issues
Missing physics after import & solution:
Original unmodded model before import in game :
https://github.com/user-attachments/assets/d730d351-ec56-42f1-a89b-afc71f8c8be1
Imported model with missing physics on cloth in game:
https://github.com/user-attachments/assets/f34b9a65-9551-40ed-a9b5-9c05413fb551
[!NOTE] The model might missing some part of physics after importing to game since some part of the model are using chaoscloth for physics. This has nothing to do with either assigning AnimBP or PhysicsAsset.
The part of the missing physics might already have been rigged. However, being rigged doesn't mean that game devs can't use chaoscloth with it.
Method 1: Activate Cloth Paint
To bring the physic back from missing, you'll have to weight-paint that part of the mesh with this UE inbuild Acitive Cloth Paint
feature.
By weight painting on the part that has physics missing in UE, it means the new physics you made wont have the same result as what the original physic game has on the mesh part. By making your own customized cloth sim physic on the cloth, it will at least not be static anymore.
Minervha)
Method 2: Assign dummy Animation Blueprints(found by Swood Aneue/kesshin7/The simple fix for missing cloth physic is by creating a dummy AnimBP and assign it to your skeleton mesh in UE. Do not assign chunk or add the dummy AnimBP in PrimaryAssetLabel. However, this method works only for bone based physics. For suits like Crimson Wings that use Chaoscloth which is a different physics implementation, you will have to create chaos cloth physics manually.
https://github.com/user-attachments/assets/4a4b4852-3e2e-4464-89be-3fbce5ac8276
Import .uemodel with "Import Sockets" disabled
Export .fbx using Njaecha and ByLemi21's FBX importer (Invert Bones Fix enabled)
Import .fbx to UE
Right-click model and create new Animation Blueprint
Rename and move AnimBP accordingly (check for vanilla path and name in FModel)
Assign dummy AnimBP to model, do not assign it to PrimaryAssetLabel
[!WARNING] If you assign dummy AnimBP to your Skeleton Mesh, you basically can't add your own post process physics so make your own choice what's good for your mods.
Package your project by following this page
Ragdoll bug with PhysicsAsset & solution:
https://github.com/user-attachments/assets/97f09897-33d8-4972-89fe-f5ee02ef832b
[!NOTE] If you have PhysicsAssset renamed correctly according to Fmodel and added it in your PrimaryAssetLabel from step of packaging mods, It might leads to ragdoll bug and being invisible most of time after model sunk underground in game.
Code Breaker Umbra)
Method 1: Kinematic Physic (found byThe bug has been confirmed as to be tied with Physic Type
setting in PhysicsAsset. What you need to do to fix this bug is to go in your Uproject and find your PhysicsAsset:
Click and open PhysicsAsset> Select all of the constraints (green circles on top left)> Find "Physic" tab on the right> Set the physics type to "kinematic"
Click Save
in PhysicsAsset setting.
Click Save all
in UE.
This will prevent it from ragdoll after you assigned PhysicsAsset in PrimaryAssetLabel. Make sure its assigned in your Skeleton Mesh as well.