Class: OrderIndependentTransparency
Weighted blended order-independent transparency for one scene, as a frame of passes (render):
- The scene, without its blended band: three's lists draw as always, but each blended draw (and each draw that must come after them) is kept instead of drawn.
- The kept blended draws, into an accumulation target that shares the
scene's depth (tested, not written), each material's own colour
turned into the weighted sums by a render-target output (
mrt) the renderer lays over every material. With a separating surface in view the band draws twice: first what lies behind the surface, composited, then the surface and what lies in front of it. - The composite over the scene.
- The draws that come after the blended layers (additive light, overlays, labels).
The kept draws replay through one marker object's draw, so no pass walks the scene again. Adopted materials draw their ordinary colour in every other render (a shadow cascade, an inventory scene): only the accumulation passes carry the encoder.
Constructors
constructor
• new OrderIndependentTransparency(scene, options, hooks?): OrderIndependentTransparency
Parameters
| Name | Type | Description |
|---|---|---|
scene | Object3D<Object3DEventMap> | The scene whose renders accumulate. |
options | OrderIndependentTransparencyOptions | - |
hooks | Object | - |
hooks.beforeAfter? | (renderer: Renderer, camera: Camera) => void | Between renders, with the scene's target bound, before the draws kept for after the blended layers (their composite is done, or there were none): a draw among them that needs a pass of its own first, into another target, makes it here. |
hooks.beforeComposite? | (renderer: Renderer, camera: Camera, layers: Texture<unknown, TextureEventMap>) => void | Right before the closing composite, with the scene's target bound: whatever lies behind the blended layers and could not draw before them (a deck of cloud marched after the scene) draws here, under them. layers is the weight target: per pixel, the layers' weighted alpha (r) and that times their view depth (g). |
hooks.onOpen? | (renderer: Renderer, target: RenderTarget<Texture<unknown, TextureEventMap>, RenderTargetEventMap>) => void | The scene's colour as blended layers are about to draw over it: once as the accumulation opens, and again after a split, when it also holds what lies behind the separating surface. |
hooks.separator? | OrderIndependentSeparator | - |
Returns
Properties
stats
• Readonly stats: OrderIndependentStats
uniforms
• Readonly uniforms: Object
Type declaration
| Name | Type | Description |
|---|---|---|
phase | ValueUniform<0> | OIT_PHASE_*: which side of the separating surface a pass keeps. It changes between the passes of one render, so it lives in the render's shared group and moves it on (setPhase): one small write a pass. In an object's own group every blended draw rewrote its buffer twice a frame, ~350 writes over a lake. |
separatorBias | ValueUniform<0> | - |
separatorDepth | TextureNode<"vec4"> | - |
weight | ValueUniform<Vector4> | (scale, near distance, far distance, unused) of the depth weight. |
weightRange | ValueUniform<Vector2> | The depth weight's clamp. |
Accessors
isOpen
• get isOpen(): boolean
Whether this frame's blended layers are accumulating right now.
Returns
boolean
Methods
accumulationPass
▸ accumulationPass(target): Object
Where the accumulation draws for a scene drawn into target: its
targets and the outputs it lays over every material. For a warmup that
builds the blended pipelines before their first frame.
Parameters
| Name | Type |
|---|---|
target | RenderTarget<Texture<unknown, TextureEventMap>, RenderTargetEventMap> |
Returns
Object
| Name | Type |
|---|---|
mrt | MRTNode |
target | RenderTarget<Texture<unknown, TextureEventMap>, RenderTargetEventMap> |
adopt
▸ adopt(material): boolean
Whether material draws in the blended band. The answer is kept per
material; nothing about the material changes.
Parameters
| Name | Type |
|---|---|
material | Material<MaterialEventMap> |
Returns
boolean
adoptBeforeCompile
▸ adoptBeforeCompile(material): boolean
adopt, for a warmup.
Parameters
| Name | Type |
|---|---|
material | Material<MaterialEventMap> |
Returns
boolean
bandOf
▸ bandOf(object, material): number
The band of a transparent item of this scene (see OIT_BLENDED_RENDER_ORDER), or undefined to place it by its own render order: an item of another scene, the sky, an overlay.
Parameters
| Name | Type |
|---|---|
object | Object3D<Object3DEventMap> |
material | Material<MaterialEventMap> |
Returns
number
dispose
▸ dispose(): void
Returns
void
render
▸ render(renderer, scene, camera, target): void
Draws scene from camera into target (which must hold a depth
texture), its blended layers order-independent. A target that cannot
share its depth draws them in list order, and says why once.
Parameters
| Name | Type |
|---|---|
renderer | Renderer |
scene | Scene<Object3DEventMap> |
camera | Camera |
target | RenderTarget<Texture<unknown, TextureEventMap>, RenderTargetEventMap> |
Returns
void
setWeights
▸ setWeights(weights): void
Parameters
| Name | Type |
|---|---|
weights | OrderIndependentWeights |
Returns
void