The frame contract

What every screen-space pass reads, and how an engine adapter fills it.

Every screen-space and hybrid pass reads the same inputs. The core never guesses at an engine's conventions: each choice is an explicit flag, and an adapter fills in the inputs.

InputFormat and conventionNotes
depthThe engine's depth texture, or r32f linearA depthInverted flag says whether it is reverse-Z.
normalWorld space, rgba16f or packedUnpack factors are explicit.
roughnessA channel of a material textureA flag says whether it is perceptual (three: yes) or alpha.
metalness, F0, albedoMaterial textureUsed for the lobe weight and the composite.
motionUV-space velocitymotionVectorScale maps engine conventions.
scene colourHDR, direct and diffuse lighting onlyHit radiance for the tracer. Last frame's colour is allowed, reprojected.
cameraView, projection, previous view-projection, jitterThe same struct the denoiser uses.

The output is a reflection radiance, a hit distance, a confidence and a source map. The hybrid resolve and the denoiser read those.

Why it matters to you

  • Writing an adapter. Fill the inputs and call the core. The Babylon and pixi adapters are examples of this.
  • Using the core directly. @pmndrs/reflections/core runs on a bare GPUDevice. You give it textures that follow the contract. The sssr-core developer page in the examples does this on exact analytic inputs.
  • Debugging. Most "my reflections look wrong" reports are a convention mismatch: reverse-Z, a flipped Y, motion in the wrong scale, or roughness in the wrong space. The adapters set these for their engine. A custom setup must set them itself.

What each adapter handles for you

AdapterWhat it does
threeFrameGBuffer renders your scene once with multiple render targets into the contract.
BabylonMaps handedness, Y-flipped targets, velocity, gloss and F0 from a Babylon geometry render.
pixiBuilds the frame from a pixi-3d View3D's outputs, plus one extra pass for normals and materials.

Three owns the meshes, materials and the capture render. The core owns textures, passes and lookups.

Live examples

Raw WebGPU fills the frame contract with a small renderer written for the page and runs the core on it. Scene kit and G-buffer shows every target of the contract.