ICE instances into Maya
There was a follow up to an old discussion on the Softimage mailing list concerning transferring particle instance orders from Soft into Maya. I thought I’d document what I said earlier.
Step 1: Set up instances in ICE
You will need an attribute to control the order of instances in your ICE tree and then to cache out and pass to Maya. I like to call this “indexPP”, but the name doesn’t matter – it simply needs to be the same on the Soft & the Maya sides of the fence.
Inside of ICE, make indexPP a random number from zero to however many objects are in your instance group. Feed this into the “instance shape” node’s index port. Here’s the ICE tree for the above screencap:
Step 2: Transfer cache to Maya
Cache out to nCache, making sure you export the indexPP attribute as well. If you have to do this more than once, script it. The cache manager window is a little tedious to work with.
I’m not aware of the “send to maya” / ICEflow stuff sending extra attributes, so we’re firmly in the land of manually specifying caches, locations and attributes to transfer. With a few wrapper scripts, this sort of thing can roll into your pipeline quite nicely. Plus, Real Men / Women / Small Furry Animals don’t used canned solutions like “send to maya”, right?
Because of ICE’s “agressive”* optimisation, your indexPP attribute may not make it into the cache if ICE doesn’t think it’s in use. Handy, right? One way to force attributes to be evaluated is to do a “show values” somewhere in the tree – making them available in the viewport is enough to ensure they’re evaluated properly. You can also just display 1% of the values (in the “show values properties” dialog box) to make it faster.
*agressive – Recalcitrant, likely to rip your leg off in the process, but ooooh-so fast.
Step 3: Set up Maya particle system
Make a particle system.
Create a per particle scalar attribute called (surprise!) “indexPP”. In the mailing list discussion, I said some dumb stuff about the data types that were needed. Having reviewed the evidence, Soft needs an integer, and Maya can’t do integers per-point.
Now that this attr exists, the cache can load data into it.
Load the cache (nCache->Attach existing cache).
Set up instances. Make sure they’re listed in the instances node in the same order they appear in Soft.
So that the order of this:
should match the order of this!
Tell the instances node to use indexPP to control the instance order. Sometimes you need to click “allow all data types” to let you use the attr you want.
Advanced Kung-fu: instance rotations
To handle rotations for the instances, I’ve usually created a “rotationPP” attr in ICE, and converted the particle’s orientation to an euler angle (using “rotation to euler”). This then gets put into the cache and pulled into Maya, making sure that you create a corresponding “rotationPP” vector per-particle attribute on your particles before you apply the cache. Just make sure the rotation orders are the same on both ends.
Sending other attributes through nCache isn’t hard, as long as Maya’s dinkly little particle system has a data type that you can hook into, and you get the names the same on both ends.