Very slow recording/bake

Hi Marcus,

I am simulating a large number of pills, around 4,000 filling an hourglass. The simulation speed is fantastic and very accurate. The issue is in recording this to keys. It takes a long time and gets stuck on 60% Baking after half an hour or more CPU utilisation is only 3% with no further update on progress. I forced a quit and redid it changing to DG mode improved the baking time and completed it in 1123.54 seconds. Hope this is an easy fix.

I realise this is a lot of objects, and maybe that’s the reason for it taking way longer than simulating.

Cheers,
Peter

Hey Peter, unfortunately there’s no easy way around this. Maya is fundamentally bad at handling that many separate objects, your best bet would be to use Maya’s own nParticles for those kind of numbers. We’re working on something similar to nParticles with Ragdoll which can help address this, but it’ll be a while until it’s ready for an audience.

Hi Marcus,

I did work in the end, so I am happy with the result. Ragdoll is a lot more accurate than using bullet solver. For stills, it matters a lot more that the objects don’t end up intersecting.
I can’t get good enough collision detection with Bifrost. I look forward to when you have your new feature to handle this situation.

Cheers,
Peter

1 Like

To add to this, there is also the Snap to Simulation option in the Ragdoll menu, which records just a single frame. Then you could potentially try the Transfer button in the Live Mode UI, that will be much faster and may work in a scene like that, where there isn’t much rig complexity.

If it does, it’s possible we could add an option to Record Simulation using this method, as it would be much faster, almost instant.

The snap to simulation works really well. It takes a short while where it looks like it’s exploding with the wire outline of the markers scattered everywhere over the top of the shaded pills then it takes a moment to display the selected frame in the normal random colours for the markers. I tried this with live mode but writing a key fame for around 4,000 objects is not stable and Maya is unresponsive and had to force a quit. Previously tried writing a single frame with record but that does not work well with such large numbers either. The simulation is very fast I guess it’s just an exponential amount of data that happens when you bake it all, even to a single frame.

If there was a way this could be done or converted to instances it would help a lot in these situations.

Did you try transferring the pose in Live Mode, without setting a keyframe? If the objects already have a keyframe then you could try having Mayas Auto Key on to let it create the new keyframe instead of Live Mode.

At the end of the day, Maya doesn’t like thousands of objects, but the difference between setting values and making new keyframes can be exponential. The reason it still runs reasonably fast in simulation is because we bypass just about all Maya evaluation in our render.

The objects didn’t have a keyframe to start with. The set up was done with Mash to create a very tall group of random rotated grid of pills above a hollowed out shape for the inside of an hourglass set as the environment. The snap to simulation button worked and I have just tested the live mode option and transferred the pose over. It works! Maya just becomes unresponsive and CPU usage is hovering between 0.6 and 2% for a short while.

ragdoll.transfer_live() - Keyframed animation in 156101.1 ms

Super accurate collisions. Very happy with the result.

That looks like the Transfer & Keyframe button, the one next to it called Transfer should print a message like this.

# ragdoll.transfer_live() - Transferred animation in 2.7 ms

image

It should be faster, as fast as humanly possible. If we do add another method for recording, that works in these special circumstances, then this is the limit of the kind of performance we can hope to achieve.

It’ll always only use a small percentage of your hardware though, because Maya can only set attribute values from a single thread/CPU core.

Thanks Marcus! That’s much faster.
4,104 pills.

ragdoll.transfer_live() - Transferred animation in 119077.2 ms

Eeek, still 2 minutes. There is not much else to do unfortunately.

If anyone can think of any way to set Translate and Rotate channels of 4,000 objects in Maya in less than 120 seconds, let me know. Python, MEL, C++, API or anything else. No rules!