Ollin

Rendering

These examples show how the frame composites. Every frame is built in a linear floating-point canvas, and a final pass tone-maps that canvas to the screen. Because the canvas is linear and floating-point, light can sum past white and blend modes add as light. Marks can also accumulate across frames instead of clearing, which is the "sandpainting" track. See the Drawing, HDR & tone mapping, Accumulation, and Retained batches references.

ExampleWhat it shows
Accumulationa persistent canvas that builds up over frames: slow pens and a soft mouse spray add faint light to a surface that is never cleared (noClear())
ToneMappinglamps that sum as HDR light in float and are tone-mapped onto the screen instead of clipping, with a flat .normal control for comparison (toneMap(_:), blendMode(.add))
ColorOutputcolors outside sRGB and highlights brighter than white (colorOutput, Color(displayP3:))
DepthOfFielddepth of field that comes from scattered light: each pass sends a million samples through a bokeh ball and deposits them as light (drawParticles(style: .light)) into a running mean (Accumulator), which converges instead of getting brighter, and the result is printed with developed (drag to change the focus distance)
LineSpraya sphere of a hundred and fifty rings of light seen through a real lens: LineSpray scatters points along every line through a Bokeh ball into a running mean until bokeh appears, the camera, the lens, and the print are parameters, and Drift re-bends the forty thousand lines every frame across every core through noiseFields
RetainedBatch150k stars recorded once into a Batch and replayed at no cost, plus a rosette stamped at many placements (makeBatch/drawBatch; flip the parameter to see the per-frame cost)
InstancedMesh12,400 pillars that move with a wave, drawn from one mesh and one draw call (drawMesh(_:instances:); flip the parameter to see the per-copy cost)
MeshField240,000 solids across a foggy plain, culled on the GPU per copy (MeshField/drawMeshField; flip the parameter to see what culling saves)
Grassland500,000 blades of grass built inside the draw call, which sway and receive shadows (StrandField/drawStrands; flip the parameter to see distance grading)
ViewBoxesone piece under six seeds on one canvas: each withViewBox clips and remaps a cell, so the block inside is written as if it owned the window, with its own background and its own mouse

Run one with swift run Example-Rendering-<Name>, for example swift run Example-Rendering-ToneMapping.

↑↓ move ↩ open