Monday, 15 June 2015

DOP Multiple Cloth Objects using Copy SOP

Multiple Cloth Objects can be created using the Cloth Object DOP, where the Initial Geometry contains multiple pieces of geometry, e.g.. Grids. (In many cases this geometry would be created by way of the Copy SOP). Actually to be more specific the key is Primitive Groups not so much pieces of Geometry, although those usually coincide.

Before continuing, I have to mention that although this process technically does as it says. The aim was to constrain each Cloth Object individually and dynamically(number of Cloth Objects). I have found it didn't give me the outcome I was looking for, ie. Constraints only work on a single Cloth Object, however I do think the may be a way, possibly using Copy Data DOP.

On the Creation tab of the Cloth Object DOP changing the following parameters:-

  • Number of Objects : This would contain an expression that equates to the number of copies required, this will depend on your particular setup. 
    • Pointing to the Number of Copies parameter of the Copy SOP using ch("your_copy_sop_location/ncy") would be one way.
    • Using the npoints("your_copy_sop_location") expression could also be used when there are Copy SOP Template Points being used
  • Object Name : "name_prefix" $OBJID   note : Quotes aren't required for the name_prefix 

Now this setup so far will create x number Cloth Objects with exactly same Geometry! So the trick is to isolate the Geometry for each Cloth Object based on the Primitive Groups created in the SOP context, in this case by way of the Copy SOP. As you'll notice there isn't any Group or Primitive Group parameters on the Cloth Object. You can however add the appropriate parameter, by editing the parameter interface of the Cloth Object DOP you can add a parameter - Primitive Group. It can be found via the Create Parameters - From Nodes tab, expand +Cloth Object + clothconfigureobject1 + sopgeo_initialgeometry1(Geometry) + Primitive Group (primgroup). move the parameter to the Cloth Object Creation tab. Finally in the Primitive Group parameter place an appropriate group name followed by the object id variable : "your_primitive_group_name"`$OBJID`   note : $OBJID could be affected by other simulation objects

The following screenshots show the Cloth Object and Geometry Data before and after the changes. Notice the standard setup Cloth Object contains all the copied geometry points, apposed to the altered setup, has multiple objects which only contain a subset of geometry based on the primitive group/s.