You are viewing the documentation for Deformable v0.1.0, an older version. Read the latest, v0.9.0
Maya Plugin
Playback, caching and baking
Play a simulation in Maya, the frames the plugin keeps in memory, Cached Playback, Simulate Frame Range, Bake Simulation and its folder, rendering with motion blur, and copying frames out as plain meshes.
On this page
A simulation runs as you play the Time Slider. The plugin keeps each frame it simulates, so you can scrub back and watch it again. This page covers playing, the frames kept in memory, baking, rendering, and the actions of the Deformable Scene menu: Simulate Frame Range, Bake Simulation, Free Simulation and Extract Output Shapes.
Play
- Go to the start frame: click Go to start of playback range, or press Alt+Shift+V (Option+Shift+V on a Mac).
- Click Play forwards, or press Alt+V (Option+V on a Mac).
At the start frame, every object shows its rest shape. Each later frame steps the simulation once. The rules, from How the engine works:
- Play from the start frame. Jumping ahead does not simulate the frames in between.
- After you change a setting, return to the start frame and play again.
- Play every frame. The playback speed must be Play every frame: a real-time speed skips frames to keep up, and a skipped frame is never simulated. Create Scene and every create action set it for you. To set it yourself, choose Windows > Settings/Preferences > Preferences, and in Time Slider set Playback speed to Play every frame.
When a tool of a simulated object is still running, Play from the start frame waits for it first, so the simulation starts from what the tool makes. Meanwhile Maya shows its busy cursor and the plugin says Deformable: Play waits for the start frame to compute, with the tools it waits for, then plays on. Going back to the start frame while a tool runs says Deformable: deformableScene1: the start frame waits for the tools to finish, with the tools.
The plugin tells you when a rule stops the simulation, or when nothing can simulate. Each message shows once, on the Command Line and in the Script Editor, and a playback that loops shows it once. A scene’s own messages also stay in its Status Message, in the Attribute Editor, while they hold.
| Message | What to do |
|---|---|
| Deformable: deformableScene1: Play from the start frame | Go to the start frame and play. |
| Deformable: deformableScene1: Set Playback speed to Play every frame: a dropped frame is never simulated | Set Playback speed to Play every frame, then play from the start frame. |
| Deformable: deformableScene1: Return to the start frame to apply changes | A setting changed during play. Go to the start frame and play again. |
| Deformable: deformableScene1: A substep would be longer than 0.04 s: raise Substeps | Raise Substeps on the Deformable Scene. See Substeps. |
| Deformable: No Deformable Scene: choose Deformable Scene > Create Scene | The Maya scene has deformable objects and no Deformable Scene to simulate them. Choose Deformable Scene > Create Scene. |
| Deformable: Add to a Deformable Scene to simulate: pCube1 | No Deformable Scene takes the named objects. Select them with a scene and choose Edit Deformable > Move to Scene. See More than one Deformable Scene. |
The frame cache
The plugin keeps each frame it simulates in memory, per Deformable Scene. Scrubbing back replays these frames, and nothing simulates again. Scrubbing forward past the last kept frame does not simulate: play from the start frame instead.
Going to the start frame keeps the frames too: play from the start frame, or scrub to any kept frame, and the frames show without simulating. Playing on past the last kept frame simulates from there, and the cache grows. The plugin keeps the frames while nothing the world is built from changes. Once you change something, such as an object’s mesh, the scene’s Gravity or a region’s place, the next play from the start frame simulates again.
The frames are gone when you open or make another file, and Free Simulation frees them.
Frame Cache Limit
The frames take memory: a scene whose tetrahedral meshes have 100,000 vertices in all takes about 1.2 MB a frame, and up to about 5 MB on a frame where something breaks. Each Deformable Scene keeps at most Frame Cache Limit of frames, 2 GB by default. Past it, new frames are not kept, and the scene says once Deformable: deformableScene1: The frame cache is full at frame 180: bake the simulation to scrub past it. The simulation plays on, but scrubbing back past that frame cannot replay it.
To keep more frames, raise Frame Cache Limit in the Deformable Preferences, or bake the simulation: a bake keeps every frame on disk.
Cached Playback
Maya’s Cached Playback cannot cache a simulation that steps one frame after the other, so the plugin turns it off while the Maya scene holds a Deformable Scene or a Deformable tool node. It is off for the whole Maya scene, the other animation in it included, as long as a Deformable node exists. Maya’s Cached Playback enters its safe mode, with the reason Deformable Scene keeps its own frame cache and the advice Bake the Deformable Scene to play it back fast. With only tool nodes, such as an Autocage Mesh, the reason is Deformable tool nodes compute their outputs on Maya’s main thread only.
So scrubbing other animation in a scene with deformable objects evaluates every frame, as Maya did before Cached Playback. The plugin’s own frame cache and its bake keep the simulation fast to replay.
Simulate Frame Range
Deformable Scene > Simulate Frame Range, or Simulate Frame Range on the shelf, plays every frame from the start frame to the end of the playback range, as fast as your computer can simulate them, and fills the frame cache of every Deformable Scene. It starts at the earliest Start Frame of the scenes. The viewport shows each frame as it simulates, and a progress window shows how far it got, such as Simulating frame 12 / 48 · 2.4 s a frame · about 1 min left · Esc to stop.
Press Esc to stop it between two frames. It also stops by itself when a scene says something that stops the simulation, such as Return to the start frame to apply changes after you change a setting, or when its frame cache is full. Advice, such as Add to a Deformable Scene to simulate: pCube1, is shown while the other objects simulate on. At the end, it says how long it took, such as Deformable: Simulated frames 1–48 in 1 min 55 s, or where it stopped and why, such as Deformable: Stopped at frame 23: Return to the start frame to apply changes.
It needs no selection: it plays the whole Maya scene.
Bake Simulation
A bake stores the simulated frames in a folder beside the scene file. A baked frame plays back without simulating, in any order, and Maya renders any frame of it.
- Save the file. The action refuses an unsaved file with Save the file first: the bake is stored beside it.
- Choose Deformable Scene > Bake Simulation, or click Bake Simulation on the shelf.
- Save the file again, so it keeps the record of the bake.
It bakes every Deformable Scene that has a deformable object, every one of its objects, whatever is selected: a Deformable Scene simulates its objects together, so a bake of some of them would take as long. It finishes every tool first, then runs every frame from the scene’s start frame to the end of the playback range, with the same result as playing, in a progress window: Esc stops it. A bake has no simulation state to resume from, so a stopped bake keeps nothing, and says so, such as Deformable: Stopped at frame 23: nothing was baked. A bake that ends says nothing.
Over a bake on disk, it first asks Overwrite existing bake data?. Click Overwrite to bake again, or Cancel. A script that runs the action bakes over it without asking.
Two files can bake into one folder. Two files with the same name and another type, such as shot.ma and shot.mb
side by side, share the folder shot_deformableBake, and two files that set the same Bake Directory share it too.
The bake in it belongs to the file that made it, for as long as that file exists. Before it bakes over the other
file’s bake, the question names that file, such as shot_deformableBake/deformableScene1 holds the bake of shot.ma,
another file. To keep that bake, click Cancel and give the Deformable Scene a Bake Directory of its own (see
below). A script does not bake over another file’s bake: it says so, unless it gives overwrite=True. Free Simulation
leaves the other file’s bake alone, and a file that opens never takes it for its own.
A baked Deformable Scene plays its bake: scrub to any frame, or play from any frame, the start frame too, and the baked frames show without simulating. A render and an export read the bake the same way.
The plugin records what Bake Simulation baked, on the Deformable Scene. A baked scene stops playing its bake, and simulates again as before, when you change what it simulates after the bake: an object’s mesh or a tool, a setting, a key on any animation it reads, a painted weight of a deformer it reads. It says so once: Deformable: deformableScene1: The bake no longer matches the scene: bake again or free it. Undo the change, and the bake plays again from the next time you play or go to the start frame. A bake of keyed material values plays on every frame; a change to one of their keys turns it off too, so bake after your last change.
When a file opens and when a render starts, a bake folder that the scene holds no record of, such as after you saved the file before the bake, is taken up when its own index says it was made from the scene as it is now.
To simulate again after a bake, free it with Free Simulation.
The bake folder
Each Deformable Scene bakes into a folder of its own, beside the scene file:
shot.ma
shot_deformableBake/
deformableScene1/
meta.json
frame_1.bin
frame_2.bin
…meta.json is the bake’s index, and each frame_<n>.bin holds one frame of every object of the scene. A scene from a
referenced file bakes into a folder named with its namespace, the : written as %3A, such as
shot_deformableBake/props%3AdeformableScene1.
To bake somewhere else, set Bake Directory in the Bake section of the Deformable Scene’s Attribute Editor. It is the folder that holds each scene’s folder: a relative path starts at the scene file’s folder.
A bake plays wherever Maya opens the file, as long as the folder stays where the file expects it: copy the file and
its _deformableBake folder together to move the scene or to render it on another computer, such as a render farm.
With a relative Bake Directory, copy the file and that folder together, keeping where each sits from the other;
the copied bake is then the copied file’s.
Free Simulation
Deformable Scene > Free Simulation, or Free Simulation on the shelf, frees every Deformable Scene’s simulation and frame cache, and deletes its bake folder and its record, whatever is selected. It says how many objects it freed, such as Deformable: Freed 2 objects. Use it to start clean, to remove a bake, or to free memory. A scene from a referenced file keeps the referenced file’s own bake: Free Simulation deletes only the bake made beside the open file. A copy of a baked file, saved with File > Save Scene As beside it, as Maya Binary too, or copied in the Finder or Explorer, plays the original’s bake until you bake or free it; Free Simulation in the copy leaves the original’s bake alone. Once the original file is gone, its bake is the copy’s. The same holds for a bake that another file made in a Bake Directory both files set.
After Free Simulation, go to the start frame and play again.
Extract Output Shapes
Deformable Scene > Extract Output Shapes, or Extract Output Shapes on the shelf, copies what the selected deformable objects show at this frame into new, plain meshes, at the same place:
| New mesh | What it holds |
|---|---|
<object>_ |
The deformed render surface, or the tetrahedrons of a bare object, with its shading face by face and its UV sets. |
<object>_ |
The simulated tetrahedrons, 4 triangles each, joined where the object is whole and apart where it cracked, with the colour sets island and strain, in Maya’s default shading. |
The tetrahedrons are extracted only on a whole frame the simulation just reached by playing. At the start frame, or on a frame replayed from the cache or from a bake, only the surface is extracted.
The report names the new meshes, such as Deformable: Extracted 2 objects: pCube1_extractedSurfaceMesh, pCube1_extractedTetrahedralMesh. When it extracts only the surface of an object, it adds Tetrahedrons are extracted only on a frame just reached by playing. A scene that plays its bake does not simulate when you play, so there it adds A baked scene plays its bake, so tetrahedrons are extracted only after Free Simulation and playing.
Use the extracted surface to model on a broken shape, or as a start for another simulation. A
<object>_extractedTetrahedralMesh mesh can become a deformable object again, in its shape at that frame: select it
and choose Deformable Object > Create Bare Object > From Tetrahedral Mesh. Each piece it had cracked into is a piece
of the new object. Do not merge its vertices: its tetrahedrons already share their points, and a merge can rejoin
cracked pieces or flatten small tetrahedrons, which the new object refuses. A mesh extracted while it lay on another
object starts inside it: move it up a little first, or its small pieces can sink through.
Render
A render reads the simulation as it plays. Before each frame, the plugin finishes any tool still running and checks the bakes, in every renderer, Arnold included: Create Scene adds a line for it to Render Settings > Common > Render Options, in Pre render frame MEL and Post render MEL. Leave it there.
To render an animation, render the whole range from the start frame, such as with Render > Render Sequence. The render simulates each frame in order, so it needs no cache. A baked scene renders its bake and does not simulate.
To render one frame, or a part of the range, bake first and save the file. Without a bake, a frame after the start frame renders with the simulation only when you just played up to it, so its frame is kept in memory. Otherwise its objects render at rest, or where they last stood, and the first frame of each render says so, naming the objects that Bake Simulation has not baked:
Deformable: deformableScene1: Frame 10 renders pCube1 without the simulation: render from frame 1, or bake firstAn Arnold IPR session says it once, when it starts.
Motion blur
Motion blur samples the time between two frames. Those samples never simulate: they read the bake, or the frames kept in memory, blended between the two frames. So bake the simulation before you render with motion blur, such as with Motion Blur and Deformation on in Arnold’s Render Settings.
On a frame where an object breaks, its surface gains faces between one frame and the next. A renderer needs the same faces across its samples, so on such a frame the object holds the earlier frame through the samples, and that frame shows no deformation blur. Camera and transform blur still show.
An Alembic or other cache export reads the frames the same way: bake first, then export the range.
Render from the command line
A batch render with Maya’s Render command simulates or reads the bake as the interactive render does. See
Render from a terminal.