﻿---
title: Playback, caching and baking
description: Play and cache a simulation, fill the cache in one go, bake it into the file or to disk, render it, and copy frames out as plain meshes.
url: https://help.tangerina.io/deformable/v0.5.0/user-guides/blender/playback-and-baking/
---

# Playback, caching and baking – Blender Plugin – Deformable v0.5.0

A simulation runs as you play the timeline. Blender caches each frame, so you can scrub back and watch it again. This
page covers playing, the cache, baking, rendering, and the actions in the last group of **Object > Deformable**:
**Simulate Frame Range**,
**Bake Simulation**,
**Free Simulation** and
**Extract Output Shapes**.

## Play

1. Go to the start frame: press **Shift+Left Arrow**.
2. Press **Space** to play.

At the start frame, every object shows its rest shape. Each later frame steps the simulation once. The rules, from
[How the engine works](https://help.tangerina.io/deformable/v0.5.0/user-guides/engine/how-the-engine-works/#the-start-frame):

- 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. In the Timeline, **Playback > Sync** must be **Play Every Frame**: the other choices skip frames to
  keep up, and a skipped frame is never simulated. **Create
  Scene** sets it for you.

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 the pointer shows that Blender is busy and the status bar says **Deformable:
Play waits for the start frame to compute**, with the tools it waits for. The tools of an object with modifiers above
its Deformable modifier compute at the start frame, so Play waits for them too. Going back to the start frame also waits
for any tool still running, with the same busy pointer and **Deformable: the start frame waits for the tools to finish**
in the status bar.

The status bar tells you when a rule stops the simulation, or when nothing can simulate:

| Status bar | What to do |
|---|---|
| **Deformable: Play from the start frame** | Go to the start frame and play. |
| **Deformable: Set Playback > Sync to Play Every Frame: a dropped frame is never simulated** | In the Timeline, open **Playback** and set **Sync** to **Play Every Frame**, then play from the start frame. |
| **Deformable: Return to the start frame to apply changes** | A setting changed during play. Go to the start frame and play again. |
| **Deformable: A substep would be longer than 0.04 s: raise Substeps** | Raise **Substeps** on the Deformable Scene. See [Substeps](https://help.tangerina.io/deformable/v0.5.0/user-guides/engine/simulation-settings/#substeps). |
| **Deformable: No Deformable Scene: choose Object > Deformable > Create Scene** | The scene has deformable objects and no Deformable Scene to simulate them. Choose **Object > Deformable >** **Create Scene**. |
| **Deformable: Add to a Deformable Scene's Objects collection to simulate: Cube** | No Deformable Scene takes the named objects. Add them to the **Objects** collection of one. See [More than one Deformable Scene](https://help.tangerina.io/deformable/v0.5.0/user-guides/blender/how-the-plugin-works/#more-than-one-deformable-scene). |

Each new status-bar message also goes, once, to the Info log and to the terminal, such as
**Deformable: Scene: Play from the start frame**. A playback that loops reports it once.

## The start and end frames

The simulation runs from the scene's **Frame Start** to its **Frame End**, on the Output properties. To simulate
another range, such as a run-up before the shot, open **Scene properties > Simulation**, turn on **Simulation
Range**, and set its **Start** and **End**. The simulation then starts at that Start, wherever the scene's frame range
starts. After its End, the objects hold the End frame: nothing simulates there.

## The cache

Blender caches each frame it simulates, inside the modifier of each deformable object. Scrubbing back replays the
cache, and nothing simulates again. Scrubbing forward past the last cached frame does not simulate: play from the
start frame instead.

![A timeline of frames cached from the start frame to the last cached frame: scrubbing back replays the cache, and scrubbing forward past it does not simulate.](../../images/playback-cache.svg "Scrubbing only replays the cache. To simulate past the last cached frame, play from the start frame.")

Going to the start frame keeps the cache too. Blender itself clears its cache there, so the plugin keeps a copy of
every frame it simulated and shows it again: scrub to any cached frame, or play from the start frame, and the frames
show without simulating. Playing on past the last cached frame simulates from there, and the cache grows.

The plugin keeps the cache while nothing the simulation reads changes. Once you change something, such as moving an
object, editing a key, a node or a modifier value, or changing the start frame or the frame rate, the next play from the
start frame simulates again from the start. Selecting objects changes nothing. A setting changed during play still asks
you to return to the start frame.

The cache lives in memory, and the plugin's copy takes memory too, for each simulated frame. Both are gone when you
close the file, and **Free Simulation** frees them.

## Simulate Frame Range

**Object > Deformable >** **Simulate Frame
Range** plays every frame from the start frame to the end frame, as fast as your computer can simulate them, and fills
the cache. The viewport shows each frame as it simulates, and the status bar 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 the status bar shows a Deformable message
that stops the simulation, such as **Return to the start frame to apply changes** after you change a setting, and
when you change the frame yourself. Advice, such as **Add to a Deformable Scene's Objects collection to simulate:
Cube**, stays in the status bar while the other objects simulate on. At the end, the Info log says how long it took, such as **Simulated frames 1–48 in 1 min 55 s**, or where
it stopped and why, such as **Stopped at frame 23: Return to the start frame to apply changes**.

It works in Object Mode and needs no selection: it plays the whole scene.

## Bake Simulation

A bake stores the simulated frames, in the file or in a folder beside it. A baked frame plays back without
simulating, and Blender renders any frame of it.

1. Save the file. The action refuses an unsaved file with **Save the file first: the bake is stored in it or
   beside it**.
2. Go to the start frame.
3. Choose **Object > Deformable >**
   **Bake Simulation**.

It bakes every deformable object of the scene, whatever is selected: a Deformable Scene simulates its objects
together, as Blender's Rigid Body World does, so a bake of some of them would take as long and leave the scene
simulating anyway.

The bake runs every frame from the start frame to the end frame, with the same result as playing. It runs in the
background, as Blender's own **Bake** button does: the status bar shows its progress, **Esc** stops it, and Blender
locks the interface until it ends, so the scene cannot change under it. By default, Blender packs the bake into the
.blend file, so the file grows: a sphere that breaks over 48 frames adds about 7 MB.

Over a bake on disk, it first asks **Overwrite existing bake data?**, as Blender's own **Bake** button does. Once you
confirm, it deletes the old bake of the scene's deformable objects and bakes again in the background, with the
progress bar and **Esc**.

A saved bake replays wherever Blender opens the file: 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. A saved bake
renders on another computer too, such as a render farm, as in
[From the command line](https://help.tangerina.io/deformable/v0.5.0/user-guides/blender/playback-and-baking/#from-the-command-line).

The plugin records what **Bake Simulation** baked, on
the Deformable Scene. A Deformable Scene simulates again, as it did before the bake, when one of its objects is not
baked (a new one, or one whose bake folder is gone), or when you change its objects or settings after the bake. The
baked objects still show their bake meanwhile in the viewport. After a change, a render from the start frame shows the
new simulation instead. A bake of keyframed material values plays on every frame; a change to one of their keys
simulates again too.

A bake to disk that the plugin has no record of, such as one made with Blender's own **Bake** button, plays and
renders as baked too. The plugin takes it up when the file opens and when a render starts.

Editing a value inside a baked object's node tree, or duplicating the object, drops its bake. Bake after your last
change.

If you stop a bake with **Esc**, the frames baked so far stay. After the last of them, the baked objects hold still
on it, so bake again to fill the whole range.

To simulate again after a bake, free it first with
**Free Simulation**.

Bake and free with the actions in **Object > Deformable**. The plugin does not see Blender's own **Bake** and **Delete
Bake** buttons, on the modifier or in the Physics properties. After you use one of them on a baked object, choose
**Free Simulation** before you play or bake again.

### Bake to disk

A big scene makes a big bake: a scene of 150,000 vertices adds about 5 MB a frame. To keep the .blend file small,
bake to a folder beside it instead:

1. Select a deformable object and open **Modifier properties**.
2. On its Deformable modifier, open **Bake** and set **Bake Target** to **Disk**.
3. Repeat for every object to bake, then bake as above.

Leave **Bake Path** empty to use Blender's default folder beside the file, `blendcache_<file name>`, with one folder per
object and modifier: **Bake Simulation** fills it in
and the Info log names it. A bake to disk replays and renders like a packed one, as long as the folder stays beside the
file: copy both to move the scene or to render it on another computer.

## Free Simulation

**Object > Deformable >** **Free Simulation** frees
the scene's simulations and deletes every cached and baked frame of its deformable objects, selected or not. Other
simulations in the scene, such as another Geometry Nodes simulation, keep their bakes. The Info log says how many
objects it freed, such as **Freed 2 objects**. Use it to start clean, to remove a bake, or to free memory.

After Free Simulation, go to the start frame and play again.

## Extract Output Shapes

**Object > Deformable >** **Extract
Output Shapes** copies what the selected deformable objects show at this frame into new, plain mesh objects, at the same
place:

| New object | What it holds |
|---|---|
| `<object>_extracted_surface_mesh` | The deformed render surface, or the tetrahedrons of a bare object, with materials and UV maps. |
| `<object>_extracted_tetrahedral_mesh` | The simulated tetrahedrons, 4 triangles each, joined where the object is whole and apart where it cracked. |

![A deformable object copied into two plain meshes: its surface, and its tetrahedrons.](../../images/playback-extract-output-shapes.svg "The surface is always extracted, the tetrahedrons only on a frame the simulation just reached by playing.")

The tetrahedrons are extracted only on a 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 objects, such as **Extracted 2 objects: Cube_extracted_surface_mesh,
Cube_extracted_tetrahedral_mesh**. When it extracts only the surface of an object, it warns that the 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 says to choose **Free Simulation** first, then
play.

Use the extracted surface to model on a broken shape, or as a start for another simulation. A
`<object>_extracted_tetrahedral_mesh` mesh can become a deformable object again, in its shape at that frame: select it
and choose **Object > Deformable >** **Create
Bare Object > From Tetrahedral Mesh**. Each piece it had cracked into is a piece of the new object. It needs no **Merge
by Distance**: 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 render, the plugin waits for any tool still running, such as
a Tetrahedralize.

**Create Scene** turns on **Render > Lock Interface**,
because the plugin writes data while a render runs. Leave it on.

To render an animation, render the whole range from the start frame (**Render > Render Animation**). The render
simulates each frame in order, so it needs no cache. A baked scene renders its bake and does not simulate.

An Alembic or USD export of a scene that is not baked simulates the same way, from the start frame, when its
**Evaluation Mode** is **Render**, the default. In **Viewport** mode it reads only the frames that playing has cached.

To render one frame, or a part of the range, bake first and save the file. Without a bake, a render that starts after
the start frame does not simulate, unless you just played up to the frame before it. Such a render says so in the Info
log, and in the terminal on the command line, naming the objects that
**Bake Simulation** has not baked:

```text
Deformable: Scene: Frame 10 renders Cube without the simulation: render from frame 1, or bake first
```

### From the command line

To render an animation without opening Blender's window, run Blender in background mode. The plugin must be
installed and enabled in that Blender, and the scene needs a camera:

```sh
blender -b scene.blend -a
```

The plugin prints a line for each frame it simulates, with how long each Deformable Scene's step took and the mean
step so far, and one for the whole range at the end frame. A baked scene prints none: it reads its bake.

```text
Deformable: Scene: frame 2 of 48 in 0.53 s · Deformable Scene step 0.49 s, mean 0.49 s
Deformable: Scene: frame 3 of 48 in 0.61 s · Deformable Scene step 0.57 s, mean 0.53 s
…
Deformable: Scene: 47 frames simulated in 31.20 s
```

The `-s` and `-e` options set the scene's **Frame Start** and **Frame End**. A new Frame Start also moves the start of
the simulation, unless a custom **Simulation Range** is on. So this command simulates from frame 10:

```sh
blender -b scene.blend -s 10 -e 60 -a
```

To render frames 10 to 60 of a simulation that starts at frame 1, bake it and save the file first. The render then
reads those frames from the bake:

```sh
blender -b scene.blend -s 10 -e 60 -a
```
