Cloth Simulation using Nvidia Apex
With Golaem 188.8.131.52 comes the Apex Cloth behavior using Nvdia Apex technology for Cloth simulation.
Here is how to setup your Golaem Character for cloth simulation using Apex, in 3 simple steps:
- Fast configuration using automatically generated Apex assets
- Complete configuration using an Apex (.apx) file
- Adding the collision rig
1. In a new scene create a new EntityType and load your gcha.
2. Click on the Population Tool icon then click in the center of the scene to place population around it. Adjust the placement settings and click the Create button to emit your particles.
4. Go inside the Motion Behavior attributes load a motion.
5. Go inside the attributes of the Apex Behavior and map the Clothing Assets (use the dropdown icon to help you select mesh assets from your entity types, and separate them with a "," if you want to configure several mesh assets)
In the same interface, map the bones on which skinned vertices should be simulated with cloth (vertices skinned to none of these bones will be considered with no cloth at all). Here also, the dropdown button on the right side helps you to select bones from your entity types (and several bones are separated by a ",").
6. Play your simulation:
Notice: This part of the tutorial assume that you have installed the Nvidia Maya DCC plugin for physX 3-3-4 (Windows only) (files from more recent version won't work)
1. Open maya and load both the Golaem plugin and Physx plugin. Open your source character file.
2. Select the geometry you wish to simulate as cloth and click on the Create Physx Clothing button in the Apex shelf.
3. Go inside the apexClothing attributes and click on the paint button to paint the Apex weights.
4. Switch the Paint Attributes to max Distance and change the brush value to something greater than zero , then paint the maxDistance values of the Apex cloth (zero stands for rigid thus sticky parts of the cloth must stay to zero value).
5. Click on the "Play Simulation" button in the apex shelf to test on your cloth.
6. Once you are happy with your cloth simulation select the cloth geometry and go to file/export Selection to export your Apex file. Set the file type to PhysX and enable the Export Physx Assets under the Physx Clothing tab, also don't forget to change the File format to APX. Save your file in a safe place.
To make sure your Apex file is exported at the right scale enable the custom scaling option and set the value to the one you will be using on your EntityType min/max scale.
For example, if your lookdev scene is in meter, and your simulation scene is in meter, use 1 (if using default values, your EntityType min=0.9 / max =1.1). But if your lookdev scene is in meter and your scene in cm, you need to adjust this value accordingly (use 100) otherwise your simulation may explode or freeze.
While activating the validate scene option some error messages might be displayed, please refer to the FX FAQ to know how to solve those errors.
7. Open the Character Maker and load your previously created gcha (if your gcha isn't mapped already please refer to this documentation page to know how to create a Golaem Character file). Go inside the Geometry Tab and select the Cloth Mesh Asset Node . Map the previously created apex in the Asset Properties of the Mesh Asset Node and save your gcha.
8. In a new scene create a new EntityType and load your gcha.
9. Click on the Population Tool icon then click in the center of the scene to place population around it. Adjust the placement settings and click the Create button to emit your particles.
11. Go inside the Motion Behavior attributes load a motion.
12. Go inside the attributes of the Apex Behavior and map the Clothing Assets (if there is more than 1 asset you can separate them with ";")
11/ Play your simulation:
Some characters will require that you create and export a collision rig in order to avoid interpenetration between the cloth and character's geometry, here is how to do so:
1. Create and paint the Apex attributes (maxDistances) as described above.
2. Select your character's root and click the "Ragdoll Option" button in the Physx shelf.
3. All the bones of your character are listed, remove the unwanted ones from the list.
4. Edit the Ragdoll shapes of your character to match the character's geometry.
5. To test the character ragdoll with apex click the Play Simulation button in the Physx shelf.
6. Once you are happy with the simulation click the Cloth geometry and Export the Selection in apx file format. Click the option box to Include Collision Rig and save your apx file in a safe place.
8. Play your simulation , your collision rig is now taken in account by the Apex cloth.