Skip to main content

Class: OrderIndependentTransparency

Weighted blended order-independent transparency for one scene.

Marker objects bracket the blended band of the scene's transparent list. The opening one (after the sky and the depth writers) hands the scene's colour to whoever samples it mid-render (the water's refraction), switches the render to an accumulation target that shares the scene's depth texture, and forces the accumulation blend state on every adopted material; the closing one switches back and draws the composite. With a separating surface in view, the band first keeps only what lies behind that surface, the split marker composites it and draws the band again for the rest. Adopted materials draw their ordinary colour in any other render, so a material shared with an inventory scene or drawn into a shadow map is untouched.

Constructors​

constructor​

• new OrderIndependentTransparency(scene, options, hooks?): OrderIndependentTransparency

Parameters​

NameTypeDescription
sceneObject3D<Object3DEventMap>The scene whose renders accumulate; it holds open and close.
optionsOrderIndependentTransparencyOptions-
hooksObject-
hooks.onOpen?(renderer: WebGLRenderer, target: WebGLRenderTarget<Texture<unknown>>) => voidThe 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​

OrderIndependentTransparency

Properties​

close​

• Readonly close: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap>


open​

• Readonly open: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap>


split​

• Readonly split: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap>


stats​

• Readonly stats: OrderIndependentStats


uniforms​

• Readonly uniforms: Object

Type declaration​

NameType
uOitActive{ value: number = 0 }
uOitActive.valuenumber
uOitClip{ value: Vector2 }
uOitClip.valueVector2
uOitPhase{ value: number = OIT_PHASE_ALL }
uOitPhase.valuenumber
uOitSeparatorBias{ value: number = 0 }
uOitSeparatorBias.valuenumber
uOitSeparatorDepth{ value: Texture<unknown> }
uOitSeparatorDepth.valueTexture<unknown>
uOitViewport{ value: Vector2 }
uOitViewport.valueVector2
uOitWeight{ value: Vector4 }
uOitWeight.valueVector4
uOitWeightRange{ value: Vector2 }
uOitWeightRange.valueVector2

Accessors​

isOpen​

• get isOpen(): boolean

Whether this render's blended layers are accumulating right now.

Returns​

boolean

Methods​

adopt​

▸ adopt(material): boolean

Wraps material with the encoder if it can accumulate; returns whether it draws in the blended band. Call it before the material first compiles (a warmup), or it compiles twice.

Parameters​

NameType
materialMaterial

Returns​

boolean


adoptBeforeCompile​

▸ adoptBeforeCompile(material): boolean

adopt for a warmup: a material that already compiled is left to the sort. Every blended item this scene draws is adopted before its first draw, so one compiled unadopted was drawn outside the band (the sky, an overlay) or in another scene; wrapping it would only compile it again.

Parameters​

NameType
materialMaterial

Returns​

boolean


arm​

▸ arm(renderer, camera): void

The camera whose renders of the scene accumulate. Renders with any other camera (shadow cascades, a portrait) draw their blended layers in list order. Call it before each frame's render.

Parameters​

NameType
rendererWebGLRenderer
cameraCamera

Returns​

void


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​

NameType
objectObject3D<Object3DEventMap>
materialMaterial

Returns​

number


dispose​

▸ dispose(): void

Returns​

void


setWeights​

▸ setWeights(weights): void

Parameters​

NameType
weightsOrderIndependentWeights

Returns​

void