View Full Version : instancing limit?

06 June 2012, 07:30 PM
I was wondering if there is a maximum number of instances you can have in maya for one object. I have a high-res tree with ~30700 duplicated leaves (each with 46 faces) and I'm now trying to replace those leaves with instanced ones. So basically I want to instance one leaf 30700 times. I wrote a script to do it, and it starts really quickly, but gets slower and slower the further it goes. At around 15000 it's taking like a second per leaf and it gets progressively slower... Is this normal? or is there an easier/faster way to go about it?

here's the code I'm using, (i'm also printing out and hiding the instances)

for ($x= 1; $x< 30700; $x++){

string $newLeaf[] = `instance leaf`;

print ($newLeaf[0]+"\n");

setAttr ($newLeaf[0]+".visibility") 0;


06 June 2012, 12:01 AM
I once did some timed tests (in MEL using timerX) in a for loop where I created 2287 (don't ask) duplicates. it took 5.82 seconds. I then restarted Maya and performed the same test on Instances. It took 1902.61 seconds.

Additionally, using print really slows down script execution exponentially.

CGTalk Moderation
06 June 2012, 12:01 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.