🎯General Mesh Garment Imported into UE for Simulation and Rendering
Asset Handling in DCC Software
Garment Assets:
Areas with thickness edges and structural thickness cannot be directly simulated. So we need to create a low-poly model for simulation, then use it to drive the movement of the original high-poly model.
1. Creating Low-Poly Solution Model
1.1. Mesh Topology Specification
Ensure that the low-poly model has no thickness structure and its topology is as uniform as possible.
Try to avoid dense topology, as it may cause issues when converted to the solution mesh in UE.
1.2. UV Specification
1.2.1. UV Unfold
In general, UV unfold should conform to the Pattern-making specification.
The sleeves need to be separated from the main body of the garment at the armhole. (in this case, there is no connection between the sleeves and the body of the garment, so another model will be used for demonstration)
The garment UVs need to be cut from the side, separating the front and back UVs.
The sleeve UVs need to be cut along the seam of the model.
Typically, pants UVs need to be split into four sections by cutting them both vertically and horizontally, dividing the UV into 4 sections.
For other cylindrical models, the UVs can be cut directly from the back, the inner side, or from the left or right sides.
1.2.2. Other Specifications
The UVs should not exhibit distortion or stretching. If using Maya, simply use the Unfold mode.
Avoid straightening UVs for efficiency gains; UVs can be arranged across multiple quadrants but must not overlap.
Click on the top-left corner for shading display. Blue is normal, while red indicates inverted UVs. Inverted UVs should not appear.
1.3. Material Specification
Low-poly models use different materials to distinguish physical properties such as stretch and bending. In UE, garments with the same material will have the same physical properties during simulation. Therefore, in Maya or other DCC software, areas that need to exhibit different physical properties should be assigned different materials.
1.4. Low-Poly Rigging
Bind the low-poly solution model to the character skeleton and transfer the skin weights from the high-poly mesh.(From version 2.3 onwards, there is a GoalShape constraint feature that attach any area to a specified target shape during cloth simulation. If the low-poly solution model does not have the weight information copied, other than the inability to use the GoalShape constraint feature, there are no other differences.)
1.5. Paint Vertex Colors
Paint vertex colors to the low-poly solution model that need to be fixed. Typically use only red, green, and blue colors. This is similar to point constraints in nCloth or attach constraints in Qualoth.
2. High-Poly Redering Model Handling
2.1. Material Specification
Because UE cannot select points, edges, or faces individually like DCC software, you cannot directly set up proxies for each independent object. Therefore, the current method for proxying high-poly models with low-poly models in UE is by using different materials to define different regions. Models under different material slots do not affect each other when used as proxies.
When models are close together and share the same material, proxy relationships can be incorrect, resulting in broken faces or stretching, as shown in the following example:
When models are close together but have separate materials, the effect is as follows:
Therefore, for easier proxying, high-poly models should have multiple materials assigned, with closely regions assigned different materials. (Note: The model's UVs may already be divided into multiple quadrants, so when assigning materials, ensure that models with the same material also have UVs in the same quadrant.)
2.2. High-Poly Rigging
If the high-poly model is already rigged, no modifications are needed, and you can use it directly. If the high-poly model is just an OBJ file, you will need to bind the model to the character's skeleton, but there is no need to paint weights.
3. Export the FBX File
Need to export 3 FBX files:
The FBX file of the low-poly model for simulation.
The FBX file of the high-poly model for rendering.(Note: Accessories in front of the belt do not need simulation; they are exported as part of the character.)
The FBX file of the character model without the clothing.
General Mesh Simulation in UE
1. Garment Assets Adjustment
1.1. Importing FBX Assets
Import 3 FBX assets and assign materials to high-poly rendering model. (Note: First import the character FBX, then import the other two garment files, inheriting the character's skeleton.)
1.2. Create Style3D Garment Assets
Make sure the simulation plugin is logged in correctly. Select the low-poly solution Skeletal Mesh, right-click on Style3D Actions, choose Create Style3d Asset, and in the pop-up window, click Create Piece from Connection. Next, change the option Attach Strength Weight Color Channel to Red, as the vertex color was previously painted in red. Finally, click Create to generate the simulation garment asset.
1.3. Attach Painting
Double-click to open the details window of the garment asset. In the 2D view on the right, you'll see the 2D Patterns of the garment. You can left-click to move these overlapping Patterns apart. The white areas on the Patterns represent vertex colors painted in DCC softwares, which are later referred to "attach".
Click on the Brush icon in the top-left corner to enter painting mode. Navigate to the Paint Property window in the top-right corner to adjust brush settings: Brush Mode for different painting methods, Attribute Value for brush color value, and Strength for brush strength. White color indicates fixed areas, while black represents areas that can be simulated normally. Hold Shift for soft painting, or change the Brush Mode to "Smooth". After painting, click on the Brush icon again to exit this mode and save your work.
Check if "Enable Attach" is selected for all Patterns that require Attach painting.
1.4. Proxying the High-Poly Model
Fill the high-poly rendering Skeletal Mesh into the "Proxy Mesh" under "Render Proxy." The indexes under "Mesh Section Wrap Map" represent segments of the high-poly model's material. In "Piece Indices", fill the indexes of the low-poly cloth pieces. This indicates that the high-poly mesh is controlled by these low-poly cloth pieces. You can find the cloth piece numbers at the top right when the Pattern is selected.
After filling in the high-poly model, the "Piece Indices" will automatically recognize and fill in the cloth piece numbers. However, these are often inaccurate, so you need to manually check and correct them. After verifying and modifying all the indices, click "Bind" to save.
"Cloth Piece" toggles the visibility of the low-poly model, while "Render Proxy" toggles the visibility of the high-poly model. After completing the proxy settings, uncheck "Cloth Piece" to hide the low-poly model.
2. Actor BP Creation
2.1. Create an Actor Blueprint
Add a Blueprint Class and select the first option, Actor class
In the Blueprint, add the character's Skeletal Mesh, then add the Style3D component under it.
2.2. Style3D Component Parameter Settings
Each cloth piece has its own default collision thickness. The Extra Thickness in the Style3D component is added on top of the original thickness of the cloth piece. Here, you can lower the Extra Thickness to 1.
Fill in the name of the character's root bone in the "Ref Bone Name". This allows the clothing to support animations where the character moves hundreds of meters per second or rotates dozens of times per second.
3. Garment Simulation Effect Adjustment
3.1. Garment Binding
Drag the Actor Blueprint into the scene, attach the garment file under the Style3D component, then click Bind, Group, and Save to bind the garment. If you haven't modified the character model vertices, added child collisions, or altered the body mask, there's generally no need to click the Bind, Group, Save buttons again.
3.2. Real-Time Simulation Effect Inspection
Add the Style3DInteraction Actor component to the scene. Change the CollisionBodyType mode under the Style3D component to "Box". Ensure that the runtime mode is set to Garment Simulate. Finally, simulate. You can drag the clothing to check if the high-poly proxy is accurate and to inspect for any stretching or broken faces. (Note: During "Selected Viewport", you can drag the clothing, but during "Simulate", dragging the clothing is not allowed.)
3.3. Physical Property Setting
The garment details window allows adjustment of physical properties such as stretch, bend, and weight, which can be fine-tuned to achieve the desired physical effects in real-time simulation. Each property's meaning can be referenced in the official documentation on the website.
When adjusting physical properties of garment, it's generally advisable to keep the values of the first six attributes under 60. If you need to achieve a very stiff effect, you can try Strengthen or Solidify.
4. Using Cache in Sequencer
There are two methods for recording simulation caches: one is Garment Cache, the other is Using Cache in Sequencer. The former is typically used for real-time and interactive projects, while the latter is generally used in episodic content creation. Here provide an explanation of how to Using Cache in Sequencer.
4.1. Creat Level Sequence
Creating a Level Sequence, add a character Blueprint to the sequence and include character animation, Style3D track, Garment Cache, cameras, and more.
Right-click on the Garment Cache, expand its properties, and you can modify the cache name under "Garment Cache Name".
Bring commonly used Solver Properties into Sequencer for easier adjustment, generally include Substeps, Iterations, Time Scale, Air Damping, and others.
4.2. Pose Fitting
Check the "Enable Pose Fitting" option. "Pose Fitting Duration" represents the transition time from the default pose to the first frame of the animation. "Finish Hold Duration" indicates the duration for continuing simulation after transitioning to the first frame of the animation. Setting this to 1 allows the character to continue simulating for 1 second, removing the inertia effects during the transition process.
4.3. Rendering Setting
Under the Style3D component, change the runtime mode to "Garment Cache Record". Then, set the record rate scale to 1. This ensures that the FPS displayed during rendering matches the FPS shown in Sequencer. Finally, switch the runtime mode to "Garment Cache Play".
Increasing the FPS can improve the accuracy of character animation, thereby enhancing clothing simulation precision. It's crucial that the increased FPS is a multiple of the character animation frame rate, otherwise, there may be issues where the garment cache and the frames of the character animation do not align correctly.
To increase simulation precision in Sequencer, you can add iterations and substeps
Using the MRQ method to render, default render parameters are sufficient.
4.4. Rendering Simulation
Click "Render(Local)" directly to start rendering and simulation.
After the simulation is complete, the previously red cache bar turns green, indicating that the cache now contains clothing simulation data.
Right-click on the cache bar, expand properties, and under "Mode" there are 4 options:
The first option, "Cache Record", indicates recording mode. In this mode, when rendering the sequence, the garment remains in simulation mode. Even if the garment already has cached data, it will still re-simulate and overwrite the previous cached data.
When "Mode" is set to the second option, "Cache Play", when rendering the sequence, the garment plays back existing cached data without re-simulating.
Once you have satisfactory garment cache data, you can switch the mode to Cache Play. Then, you can render previews or directly render the final shots.
Last updated