Layered Simulations

Hair Layered Over ClothingAnother problem with my simulator has become apparent when trying to run a layered simulation where one cloth items drapes over another.

My plugin is a deformer and not a physics solver.  The accurate simulations are run by getting Carrara to slowly advance the time sequencer.  The current tests I’ve been doing included attempts to combine dynamic hair with a dynamic costume – where the hair would drape as a second layer over the costume.  The simulation is normally saved at the scene’s frame rate, so when the higher fps was used on the hair the costume would not move in slow steps but jump to the next set of stored data only when at a time multiple of the scene frame rate.

A number of separate cloth mesh objects can go into the one simulation but hair and different layers and different types of cloth will need different properties.

To get this to work better I set both the dress and the long hair into record mode and then ran the simulation from one of them to get the high frame rate.  This caused an immediate crash and an impossible to find bug.  I had to give up trying to find how and where it was happening because no single specific part of the code was causing it.  I believe that there is no easy way to fix it and the code is not ‘thread safe’.  Therefore only one simulation should be set to record and run at any time.

The solution for the layered cloth is simple enough.  A new setting and change to the plugin is required so that the costume simulation can be run first and all of the frames are then saved.  If the simulation is set to run at 150fps with a scene rate of 25fps then all 150 snap-shots of the cloth will be saved per second for use in the next simulation that layers over it.  This does make for a much larger file size so some kind of management of the stored data to discard the extra frames could also be added.

The next release of the cloth plugin will have this high definition recording and playback feature.  I will also need to add a similar feature to the Jiggle plugin for it to work consistently with my cloth.  It might also help when combining cloth with the Carrara physics solver or strand based hair.  I have not tested that yet.

Leave a Reply