Baking subframes in a simulation (Maya)

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
Post Reply
csmallfield
Posts: 2
Joined: Mon Aug 22, 2011 12:39 pm

Baking subframes in a simulation (Maya)

Post by csmallfield »

Hello,

I'm a new user of the Bullet Physics Dynamica Plugin for Maya. It's really awesome and provides great results. I have made a simulation that I really like and for rendering purposes need to cache it or bake it out. The tricky part is that the shot is a slow-motion shot. When I playblast the unbaked simulation and change Maya's playback set to 0.1 instead of 1 (thus making 10 images for every 1 frame in the timeline) the simulation plays flawlessly. I have the substeps up pretty high, but when I bake it, it only bakes one frame per frame in the timeline, and I was wondering if there is a way to override this and bake out the subframes too.

I tried just stretching out the keyframes and there is a lot of motion artifacts for fast moving parts with screwed up rotation and incorrect collisions in the subframes. Anyhelp would be greatly appreciated. Thanks!

Chris Smallfield
csmallfield
Posts: 2
Joined: Mon Aug 22, 2011 12:39 pm

Re: Baking subframes in a simulation (Maya)

Post by csmallfield »

Alright, I was able to answer my own question, here is what to do.

Make your simulation, let's say a bunch of cubes falling on an incline.

See what your target FPS is and how slow you want it to be. In my case the final project should playback at 25 fps. I wanted to have it in slow motion, 30x slower than realtime. 25 x 30 = 750. Go to maya options and change the scenes frame rate to 750 fps.

Bake the simulation. Make sure you deselect Optimize Channels. I'll explain in a second*.

Now once baked, change Maya's FPS back to 25 FPS, but make sure you select "Keep keys at current frame". You now have an accurate slow motion sim playing at the native FPS of your scene.

An altarenate thing to do if you have a scene with other animated objects in it that are not in slow motion, would be to not select "Keep keys at current frames" and your high FPS simulation will be put into subframes (IE 23.1, 23.2) and the scene remains a realtime scene. Then if desired you could put it into slow motion using the "By Frame" option in the render globals, which will automatically slow down everything in the scene so you don't have to do any funky keyframe scaling.

*Optimize Channels gave me strange results, it gave me strange noise on the motion and Gimble flipping in some circumstances, it wasn't so noticable in real time but looked freaky in slow motion.

This also lead me to the conclusion that Bullet doesn't like it when you change the rotation order of objects before making them Rigid Bodies. It seems to only like and allow XYZ. If you had a small number of objects it's pretty trivial to duplicate, parent, and rebake on an object with a different rotation order, but with a sim of 5000 RB's, you'd need to do some scripting and a lot of waiting.
mBakr
Posts: 53
Joined: Thu Aug 05, 2010 5:57 pm

Re: Baking subframes in a simulation (Maya)

Post by mBakr »

Thanks for posting a solution to your original question.

Optimize Channels is primarily intended to reduce file size and memory overhead. Behind the scenes, this is accomplished with a curve simplification routine which searches for successive keys with a value difference of less than 0.0001. This effectively removes "duplicates" and static regions of each transform channel and can reduce overhead by 50% or more.

As you have discovered, this does not work well when the key data is scaled dramatically. The solution you found makes perfect sense - record the simulation at a much faster frame rate than the target playback rate. This is exactly how high speed photography (slow motion) footage is captured.
Post Reply