Thursday, 7 May 2015

nCloth Matching Mesh Constraint

If you want a high resolution nCloth, it can be very slow to simulate. One method is to generate a low resolution nCloth to produce the large scale movement that you require and then simulate a high resolution nCloth which follows the low resolution mesh on the large scale but will display small scale details of its own.

Here is one way to set up this systerm.

  1. Create a low resolution nCloth and simulate the large-scale motion. I will call that low resolution nCloth mesh "cloth_L0"
  2. Cache cloth_L0
  3. Smooth cloth_L0 using Mesh > Smooth. Be careful of having too many divisions as very high subdivision levels will cause significant slowing down of the simulation. I usually choose 1 to start with and then repeat the process if I need more detail.
  4. Export the smoothed cloth_L0 as Alembic using Pipeline Cache > Alembic Cache > Export Selected to Alembic. If you want to preserve UVs, remember to tick the check box in the options box.
  5. Import the Alembic file bac in to your scene. Rename that imported mesh as "Alembic_Import_L1"
  6. Duplicate Alembic_Import_L1. Rename the duplicate "cloth_L1"
  7. Create an nCloth from cloth_L1
  8. Select cloth_L1 and shift-select Alembic_Import_L1, then create an Attract to Matching Mesh constraint using nConstraint > Attract to Matching Mesh 
  9. In the constraint, choose a Dropoff Distance that makes sense in your scene. You want cloth_L1 to be able to deviate just enough from Alembic_Import_L1 to add some good detail, but not so much that it no longer the follows the large scale motion of the original simulation.
  10. In the Strength Dropoff ramp, create a profile that has a value of 0 in the left and 1 on the right. An exponential curve will work well.
  11. Tune the forces acting on cloth_L1 to give a variation over the movement of cloth_L0.
You should now have a high resolution nCloth which follows a low resolution cloth but has extra details. This process can be applied any number of times, depending on the power of your workstation.


In my example above I have chosen to use a division level of 2 because the original mesh was so low resolution I knew I would require quite a lot more resolution to get more detail.

No comments:

Post a Comment