|

Baking

Here, we examine how a completed mark is merged into the canvas.

The mark being drawn is live 3D geometry. As the gesture grows, the renderer rebuilds and redraws it every frame, responding to movement and pen pressure in real time.

To store all previous marks, we use a canvas buffer: a raster image in an offscreen render target. Each finished gesture is flattened into this single image, so the buffer stores the entire drawing as one layer rather than as a stack of individual strokes.

While the user draws with the pen down, the live mark is drawn over the buffer each frame. It is merged (baked) into the buffer only when the pointer is released. Until then, the buffer remains unchanged, and the live mark can still be altered or undone.

This separation keeps the architecture simple and fast. The scene never needs to redraw committed marks, and only one mark is live at a time. The result is a rough approximation, not an accurate physical simulation. Still, the live mark can sample the buffer beneath it to suggest physical effects such as smudging, bleeding, and reflection.

Live stroke and canvas buffer

open full size ↗

Draw with a brush in the left pane. It shows only the current stroke against a transparency grid, with no canvas content behind it. The right pane shows the committed drawing in the canvas buffer before the current stroke is baked in. The current stroke is added to the buffer only when you release the pointer.