Animation: Unreal Engine 5.4, Chaos Cloth, DAZ Studio and Marvelous Designer
This is a quick record of how DarkAelf Studios is (November 2024) bringing cloth assets created by the 3D apparel designer Faezeh Najafi into Scarborough 1264 (one of the films DarkAelf is working on). This area is changing fast - the information here will fall out of date fast.
Creating Chaos cloth (realistic cloth dynamics in animations) is a memory intensive process and it is still in its infancy. Crashes happen. Protect yourself before proceeding. Don't leave actors hanging around on cinematic sets - if they crash, you may not be able to reload a level, particularly if they are impacted by Engine changes (eg, material substrate).
By way of simple comparison, the USD process (workflow A, below) is simple and holds out greater opportunities for accurate simulation. A test model resulted in a blueprint actor that shows a size of 850+Mb in memory. The static mesh process (workflow B, below) will generate nonfatal skinning errors, will take a lot more time to prepare (decimation and delays inside the cloth physics graph) but can be optimized inside the Engine. Under Workflow B, an equivalent model (optimized with a separated chaos cloth element and a follower element) resulted in a 490+Mb blueprint actor. Both of these figures probably understate the real load on memory. Workflow A produces a better visual outcome*. Workflow B might be necessary having regard to memory considerations (if you have a lot of actors on scene). (*in recent tests, after preparing this article, we encountered weird displacement issues with some of the materials created by Unreal Engine in USD - if you suddenly find actors arms going through bodies - you may need to create simple material substitutes.)
The rest of this post considers the two different workflows:
WORKFLOW A: USD Workflow for DAZ Genesis 8/8.1 characters in Unreal Engine
USD is a file format used by recent versions of Marvelous Designer for apparel. It contains within it a range of information about the quality of cloth (stiffness/tension/surface structure) used in the apparel - and which can simulate the cloth during animation in Unreal Engine.
1: Ensure that the USD file you want to convert into Chaos cloth was created using a DAS 8/8.1 skel AND was constructed using a rigged body which has the same rigging and shape as the actor you plan using it with. (Generally, this means the same shape as a base genesis actor). Organize your USD files into a handy permanent directory (if you move them downstream, things may break).
2: Bring a base G8.1 male/female into UE 5.4+. (Image 1) We bring the character in using David Vodhanel's Daz to Unreal Bridge with some guidance from Jay Versluis. We import the character 'Right Facing' which has implications in step 7 below. We remove all clothing/hair/shoes/items from the model (these are recombined in step 13 below using a Blueprint). Often time we will also modify a base actor to remove surface skin that will be hidden under clothes.
3: Right click the skeletal mesh in the content browser and press Create:PhysicsAsset:Create (Image 2) and then create a new Physics Asset using a "Single Convex Hull" as the primitive type (Image 3). Give the new asset a name you will remember.
Image 2 |
4: Right click in the context browser and create a new Physics:Cloth Asset (Image 4). Name it, and then open it. (Image 5).
Image 4 |
Image 5 |
Image 6 |
Image 7 |
6. Dont touch anything!. Save All.
7: When loaded, you will see the dress pattern appear. (Image 8).
Image 8 |
You can toggle the appearance here (Image 9 & 10).
Image 9 - @ top right |
Note the facing of the asset (here front facing right). Resist the urge to rotate around it! If you imported your base G8.1 character "right facing" we have to change the facing of the clothing. Click on the second node "TransformPositions" (Image 11) then go to the node details tab and make the 4 changes indicated (Image 12). Each change takes a little time. Save All. if you get a crash here, try again with the maximum amount of memory you can spare. If you keep crashing, try a smaller USD file :( If you dont crash, you will see that the dress has changed orientation without you touching the camera. (Image 13) If is pointing a different direction - you changed the wrong parameter. Go back to the start of this instruction.
Image 11 |
Image 12 (tick Transform 3Dsi.. and Transform Render then add -90 in the two positions indicated. |
Image 13 |
8: Click on the next node (Transfer Skin Weights NOT the preview mesh pane). Go to the Node Details and add your skel mesh (Image 14). There will be a delay as it evaluates. Save All.
Image 14 |
9: Now check we have everything in the right place. Go to the preview tab and add your skel mesh to the Preview Pane. You may very gently back the camera out until the dress and figure come into view. Add a simple anim to the pane and check the cloth is following the skel. (Image 15). Stop the animation - it causes crashes. If everything fits, great. If not, then theoretically you can use the 'TransformPositions" node to nudge/grow the clothes into place, but dont count on it. (* note that if you cannot see the asset in the preview screen, the item may have been transfered at the wrong size. Trying to resize inside the clothing graph is buggy and it may be better to retrace your export process from Marvelous Designer.)
Image 15 (showing the actor's foot in the preview pane) |
Image 15 - Camera backed out a little. Note that an anim here might kick the actor and clothing into a different facing - that is not an issue - just make sure they are working together. |
10: Now move along the Graph to a yellow blotch and a node called Set a Physics asset (Image16). Add the physics asset we created in step 3 in Node Details. You can crash here if you try creating a new one on the fly. If you skipped step 3, dont risk it - use the default one and come back and change it when everything is finished and saved.
Image 16 |
11. Almost done. Go back to the node called "Addweightmap_MaxDistances". When you click it you get new panes to help you paint where the cloth should distort. (Image17) Toggle the view option so you are looking at the dress plan. (Image18)
Image 17 |
Image 18 |
Note that everything is black - black stuff doesnt move - white stuff does. Here I want the bottom of the dress to move - slightly. Increase the brush size to '1'* - check the white draw brush that will appear when you mouse over the dress pattern (*the size of the draw brush can change from time to time - sometimes you will need to set it low, sometimes high - this may be dependent on the number of particles in the cloth you are working with). Reduce strength to '0.2'* (*ok - this is experimental and depends on the cloth you are working with - dont hesitate to go down low to get a balance between the shirring and creases in your cloth asset and distortion caused by movement - i am presently trying '0.05' with one cloth) . These numbers might be different for you - this is a place you need to come back to experiment. Then paint the bottom of the dress so: Image18. Then Brush:Smooth between the black and the grey we just painted. Image19. (IN time you may come back and try a much more nuanced paint covering more (but not all) of the dress.) And Save All (we get crashes with this if someone three desks down sneezes.)
It is worth playing around with the mesh visibility settings in this pane. With one recent asset we found cloth was surrounded by an attractive piece of cloth piping - asking the cloth to flap at the edge simply breaks the model.
Another Image 18 |
Image 19 - note smoothing between black and white.. |
12. Press Accept and in your preview pane the dress will move slightly. Save and quit before it crashes. If you get to this point and save successfully, it will never crash again. Well, hardly ever.
13. Create a Blueprint actor. In the Component Tab, add your skeleton mesh to the DefaultSceneRoot, and then a Chaos cloth node to it. (I add optimized static mesh hair and shoes at this stage as well)
Comments