Skip to content

Documentation / scene / PostEffectSetupContext

Interface: PostEffectSetupContext

Defined in: libs/scene/src/posteffect/posteffect.ts:61

Build-time context handed to AbstractPostEffect.setup.

The context carries everything an effect needs to declare its passes on the render graph. Where the effect output physically lands (intermediate texture, backbuffer or screen) is decided by PostEffectSetupContext.createOutput; effect implementations never deal with final-target selection themselves.

Properties

graph

readonly graph: RenderGraph

Defined in: libs/scene/src/posteffect/posteffect.ts:63

The render graph being built for this frame.


ctx

readonly ctx: DrawContext

Defined in: libs/scene/src/posteffect/posteffect.ts:65

Frame draw context. Read configuration from it, never textures.


blackboard

readonly blackboard: RGBlackboard

Defined in: libs/scene/src/posteffect/posteffect.ts:67

Named frame resources (linear depth, motion vectors, GBuffer, ...).


input

readonly input: RGHandle

Defined in: libs/scene/src/posteffect/posteffect.ts:69

Chain input: color output of the previous effect (or the scene color).


colorFormat

readonly colorFormat: TextureFormat

Defined in: libs/scene/src/posteffect/posteffect.ts:71

Intermediate color format of the post effect chain.


width

readonly width: number

Defined in: libs/scene/src/posteffect/posteffect.ts:73

Render width in pixels.


height

readonly height: number

Defined in: libs/scene/src/posteffect/posteffect.ts:75

Render height in pixels.


history

readonly history: HistoryResourceManager<Texture2D<unknown>>

Defined in: libs/scene/src/posteffect/posteffect.ts:77

Cross-frame history resources, or null when unavailable.


sceneDepthAttachment

readonly sceneDepthAttachment: unknown

Defined in: libs/scene/src/posteffect/posteffect.ts:84

Scene depth attachment for intermediate passes that depth-test against scene depth: either a graph texture handle or a backend depth texture. Pass it as the depthAttachment of intermediate framebuffers; the final pass gets it through createOutput({needDepthAttachment: true}).

Methods

createOutput()

createOutput(builder, opts?): PostEffectOutput

Defined in: libs/scene/src/posteffect/posteffect.ts:108

Create the output target for the effect's final pass.

Must be called exactly once, inside the setup callback of the pass that produces the effect's final color. The compositor decides whether this resolves to an intermediate texture or a direct write to the final target.

Parameters

builder

RGPassBuilder

The pass builder of the effect's final pass.

opts?

Set needDepthAttachment when the pass depth-tests against scene depth.

needDepthAttachment?

boolean

Returns

PostEffectOutput

The resolved output target.

Released under the MIT License.