Attached an example hip of the production workflow I am trying to improve.
Import asset USD file (proxy):The set comes from the asset department, a mix of maya and houdini usd prims and instances. ( ie. trees, bushes, houses lightpost, shacks etc )
Import the USD in SOP:Unpack the USD to the desired level in order to get 1 packed usd per item that I want to sim.
Create a "usd_prim_unique" attribute with a combo of usdIndex and usdSrcPrimPath ( this will be unique for each instance, check vex code below )
These items will go into a large scale RBD sim. ( no fracturing, 1 item will be 1 packed prim in DOP )
OUT_usd_packed_prims_restUnpack the USD to Polygons:configure for RBD, sim, extract sim points from RBDsolver.
Transform original USD in SOP:Use Transformpieces on the
OUT_usd_packed_prims_rest with the RBD sim points.
Now I have USD packed prims animated in SOP.
Export in LOP:Import original asset USD from disk.
Use "modify point instance" to add transforms on the instances, using the USD packed prims animated in SOP (match by usd_path_unique)
Use "sop import" to add transforms on the non-instance usd prims, using the USD packed prims animated in SOP
(match by path)
DONEs@usdPrimPath=primintrinsic(0,"usdPrimPath",@primnum);
s@usdSrcPrimPath=primintrinsic(0,"usdSrcPrimPath",@primnum);
i@usdIndex=primintrinsic(0,"usdIndex",@primnum);
s@usd_path_unique = s@usdPrimPath + "_" + s@usdSrcPrimPath + "_" + itoa(i@usdIndex);
This workflow
WORKS.
I am wondering if there are any more efficient ways to do it.
I also have a few questions:
1-a faster method to collect all instancers present in the USD ( at the moment I am using the Python code posted in previous post)
2-How can I prune a selection of USD instances based on some sort of ID?
The idea is that if I blast some of the USD packed prims in SOP , I do not want to export those in LOP, hence prune them.
Is there a way to extract the usdIndex in LOP ? That would do the trick I think.
Thanks in advance for any help or ideas