Skip to content

Documentation / scene / OIT

Abstract Class: OIT ​

Defined in: libs/scene/src/render/oit.ts:23

Abstract class for order-independent transparency renderers.

Order-independent transparency (OIT) renderers allow for rendering of transparent objects in any order, regardless of their depth.

This abstract class defines the common interface for all OIT renderers. Specific implementations of OIT renderers should extend this class and provide concrete implementations for the abstract methods.

Extends ​

  • Disposable

Extended by ​

Constructors ​

Constructor ​

new OIT(): OIT

Defined in: libs/scene/src/render/oit.ts:25

Returns ​

OIT

Overrides ​

Disposable.constructor

Accessors ​

disposed ​

Get Signature ​

get disposed(): boolean

Defined in: libs/base/dist/index.d.ts:6107

Returns ​

boolean

Inherited from ​

Disposable.disposed


uniformTag ​

Get Signature ​

get uniformTag(): number

Defined in: libs/scene/src/render/oit.ts:29

Returns ​

number

Methods ​

on() ​

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:630

IEventTarget.on

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

listener ​

EventListener<{ dispose: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

Disposable.on


once() ​

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:634

IEventTarget.once

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

listener ​

EventListener<{ dispose: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

Disposable.once


off() ​

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:638

IEventTarget.off

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

listener? ​

EventListener<{ dispose: []; }>

context? ​

unknown

Returns ​

void

Inherited from ​

Disposable.off


dispatchEvent() ​

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:642

IEventTarget.dispatchEvent

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

args ​

...object[K]

Returns ​

void

Inherited from ​

Disposable.dispatchEvent


dispose() ​

dispose(): void

Defined in: libs/base/dist/index.d.ts:6108

Returns ​

void

Inherited from ​

Disposable.dispose


onDispose() ​

protected onDispose(): void

Defined in: libs/base/dist/index.d.ts:6109

Returns ​

void

Inherited from ​

Disposable.onDispose


uniformChanged() ​

uniformChanged(): void

Defined in: libs/scene/src/render/oit.ts:32

Returns ​

void


getType() ​

abstract getType(): string

Defined in: libs/scene/src/render/oit.ts:40

Returns the type of the renderer.

Returns ​

string

The type of the renderer.


supportDevice() ​

abstract supportDevice(deviceType): boolean

Defined in: libs/scene/src/render/oit.ts:47

Checks whether the renderer supports the given device type.

Parameters ​

deviceType ​

string

The device type.

Returns ​

boolean

True if the renderer supports the device type, false otherwise.


wantsPremultipliedAlpha() ​

abstract wantsPremultipliedAlpha(): boolean

Defined in: libs/scene/src/render/oit.ts:53

Whether this OIT algorithm wants pre-multiplied alpha

Returns ​

boolean

True if the OIT wants pre-multiplied alpha, false otherwise


begin() ​

abstract begin(ctx): number

Defined in: libs/scene/src/render/oit.ts:67

Begins rendering the transparent objects.

Parameters ​

ctx ​

DrawContext

The draw context.

Returns ​

number

The number of passes required for rendering.

Remarks ​

Contract: the caller (the transparent scene pass) must have explicitly bound the transparent scene target framebuffer before calling begin(), beginPass() or endPass(). Implementations may redirect rendering to internal buffers, but must composite into that bound target and restore it before returning.


end() ​

abstract end(ctx): void

Defined in: libs/scene/src/render/oit.ts:73

Ends rendering the transparent objects.

Parameters ​

ctx ​

DrawContext

The draw context.

Returns ​

void


beginPass() ​

abstract beginPass(ctx, pass): boolean

Defined in: libs/scene/src/render/oit.ts:81

Begins rendering for the given pass.

Parameters ​

ctx ​

DrawContext

The draw context.

pass ​

number

The pass number.

Returns ​

boolean

True if the transparent objects should be rendered, false otherwise.


endPass() ​

abstract endPass(ctx, pass): void

Defined in: libs/scene/src/render/oit.ts:88

Ends rendering for the given pass.

Parameters ​

ctx ​

DrawContext

The draw context.

pass ​

number

The pass number.

Returns ​

void


setupFragmentOutput() ​

abstract setupFragmentOutput(scope): void

Defined in: libs/scene/src/render/oit.ts:97

Sets up the fragment output.

Parameters ​

scope ​

PBGlobalScope

The global shader scope.

Returns ​

void

Remarks ​

This method declares necessary uniform variables for OIT rendering and injects it into the object's material.


outputFragmentColor() ​

abstract outputFragmentColor(scope, color, ctx): boolean

Defined in: libs/scene/src/render/oit.ts:107

Do the fragment color output.

Parameters ​

scope ​

PBInsideFunctionScope

The global shader scope.

color ​

PBShaderExp

The calculated fragment color.

ctx ​

DrawContext

Returns ​

boolean

Remarks ​

This method outputs the calculated fragment color for OIT rendering and injects it into the object's material.


applyUniforms() ​

abstract applyUniforms(ctx, bindGroup): void

Defined in: libs/scene/src/render/oit.ts:116

Applies the uniforms for the given draw context and bind group.

This function will be called when ever the transparent material will upload uniform variables.

Parameters ​

ctx ​

DrawContext

The draw context.

bindGroup ​

BindGroup

The bind group.

Returns ​

void


wantsAdditiveLightPassAlpha() ​

abstract wantsAdditiveLightPassAlpha(): boolean

Defined in: libs/scene/src/render/oit.ts:124

Whether additive light passes should keep the material alpha before OIT output.

Returns ​

boolean

Remarks ​

Some OIT algorithms need the original material alpha to weight additive light color, but write zero alpha to their accumulation targets so transmittance is not counted twice.


calculateHash() ​

abstract calculateHash(): string

Defined in: libs/scene/src/render/oit.ts:133

Calculates the hash of the renderer.

Returns ​

string

The hash of the renderer.

Remarks ​

When this hash value was changed, material shader will be forced recreate.


setRenderStates() ​

abstract setRenderStates(rs): void

Defined in: libs/scene/src/render/oit.ts:141

Sets the render states for the renderer.

This function will be called when the transparent object will be rendered.

Parameters ​

rs ​

RenderStateSet

The render states.

Returns ​

void

Released under the MIT License.