AdvancedOptional ReadonlybitsThe bit each scene pass gives its materials so they write the output, keyed by pass name; see RenderPass#materialBits
{ opaque: myBit } is the usual form: opaque surfaces write it, and transparent and glass
surfaces leave what is behind them. Add transparent or transmission for those surfaces to
write it too. Leave bits out for an output only some materials write, through their own bits,
or one a pass draws into. Each bit must declare the output in its outputs.
Blended surfaces blend what they write, so a transparent bit must write a float or normalized
output as a vec4, or the view throws. Integer formats such as r32uint never blend, so a
blended surface overwrites what is behind it: use one for IDs and masks.
A material with a template of its own, or a pass with a shader of its own such as a MeshPass, leaves every output as it was.
Optional ReadonlyclearWhat the texture holds before anything draws into it each frame, as four numbers in the format's channel order; integer formats take them as integers
Pick a value no writer produces, so a reader can tell where nothing drew, such as the far
distance for a depth-like output or 0xffffffff for an object ID.
ReadonlyformatFormat of the output's texture; some formats turn the view's MSAA off, see SceneOutput
ReadonlynameThe field material shaders write as outputs.<name>, and the texture's label
A lowercase letter, then letters and digits, such as objectId. Not color, which is the scene
colour's, or a word WGSL or GLSL reserves.
A texture the scene draw writes besides its colour, such as object IDs, for passes to read
A plain object known by its name, like a ShaderBit: two with the same name and content count as one, and two that differ throw when a view collects them. A view creates and writes the texture only while an enabled pass lists the output in Pass3D#requiredOutputs, or DefaultGraph3DOptions#sceneOutputs does, and passes reach it with RenderGraph#getSceneOutput. Three things write it: its bits, a material's own bits that declare it in
outputs, and a pass that draws into it.Each frame it starts cleared to its clearValue, and a draw that doesn't write it leaves it alone. It lasts only for the frame: to keep it past
render(), copy it into a texture the app owns, for example with a FullscreenPass running passthroughFragment. A pass that only reads it, such as a readback to the CPU, needs PassBuilder#sideEffect.Each output is one more colour attachment on the scene passes, and GPUs cap those. WebGPU allows 8, and 32 bytes per pixel across the colour and every output, where
rgba8unormcounts 8 bytes, asrgba16floatdoes. WebGL allows at least 4. Pick the smallest format that holds the value; a view over the cap throws when it renders.On a canvas with
antialias, the output is multisampled with the scene, which takes four times its texture's memory, and an edge pixel reads the average of its samples, the clear value included where nothing drew. An integer or 32-bit float format turns that off, and so doesrgba8unormon WebGL: while one is attached, the view draws its scene single-sample and its edges go jagged.Example