Skip to content

Frame order

  1. Particle simulation. Reads the original positions, writes the current ones. Skipped entirely when scene speed is zero.
  2. Grid clear and insert, merged into one pass. See The spatial grid.

The swapchain texture is acquired once, before this pass, and every pass that draws to the screen reuses it — see Two rules from iOS Safari.

In order: particles, then any extra particle layers, then axes, then text.

Text draws here deliberately, so it lands in the background copy and refracts behind glass.

With no glass in the scene, there is no split. Everything continues in the same render pass — one beginRenderPass, no texture copy.

When glass is present, pass 1 ends and the swapchain is copied into the background texture. Then, in order:

  1. Shape pre-pass — opt-in, only when enableReflection or enableRefraction is set and a non-glass shape is visible. Draws the non-glass SDF shapes into their own texture and depth target at prepassScale × the canvas, so glass can sample them: fast shapes, the <Fast> halo with its depth when a wrapper has one, the effect shapes’ depth, then the effect shapes. Both flags share this one pass, and it runs on the flag alone, whether or not a glass shape reads it.
  2. Mip generation — up to two chains, each built only if something reads a level above zero. The background chain runs for roughness, anisotropy or anisotropyBlur on a glass material. The shape chain runs after the pre-pass, for reflectionRoughness, or for that same blur when enableRefraction is on.
  3. Back-face position pre-pass — mesh glass only, to find where a ray exits the model.
  4. Pass 2 begins, clearing depth rather than loading it — see Two rules from iOS Safari.

Fast SDFs → mesh → glass SDFs → the <Fast> halo → effect SDFs → the rig gizmo, against one shared depth attachment. See Depth and z-sort.

The split, the copy, the pre-pass and each mip chain are all conditional. A scene with no glass pays for none of them. A scene with glass but neither reflection nor refraction pays for the copy but not the pre-pass. Turning on both flags costs barely more than turning on one, because they share the pass.