Skip to content

Documentation / scene / DualDepthPeelingOIT

Class: DualDepthPeelingOIT

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:39

Dual depth peeling OIT renderer.

Remarks

This implementation follows the official dual depth peeling pass structure: an initialization pass writes the nearest/farthest transparent depth pair, then each peel pass ping-pongs the depth pair while accumulating front and back colors.

It requires MRT, per-target blending, min/max blend equations and blendable floating-point color targets. If those capabilities are missing, supportDevice() returns false and the transparent pass falls back to sorted alpha blending.

Extends

  • Disposable

Implements

Constructors

Constructor

new DualDepthPeelingOIT(numPeels?): DualDepthPeelingOIT

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:62

Creates an instance of DualDepthPeelingOIT.

Parameters

numPeels?

number = 8

Number of peel iterations after the initialization pass.

Returns

DualDepthPeelingOIT

Overrides

Disposable.constructor

Properties

type

readonly static type: "ddp" = 'ddp'

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:41

Type name of DualDepthPeelingOIT

Accessors

disposed

Get Signature

get disposed(): boolean

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

Whether this is disposed

Returns

boolean

Whether this is disposed

Implementation of

OIT.disposed

Inherited from

Disposable.disposed


numPeels

Get Signature

get numPeels(): number

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:75

Number of front/back peel iterations after the initialization pass.

Returns

number

Set Signature

set numPeels(val): void

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:78

Parameters
val

number

Returns

void

Methods

on()

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

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

IEventTarget.on

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

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

context?

unknown

Returns

void

Implementation of

OIT.on

Inherited from

Disposable.on


once()

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

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

IEventTarget.once

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

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

context?

unknown

Returns

void

Implementation of

OIT.once

Inherited from

Disposable.once


off()

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

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

IEventTarget.off

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener?

EventListener<{ dispose: []; }>

context?

unknown

Returns

void

Implementation of

OIT.off

Inherited from

Disposable.off


dispatchEvent()

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

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

IEventTarget.dispatchEvent

Type Parameters

K

K extends "dispose"

Parameters

type

K

args

...object[K]

Returns

void

Implementation of

OIT.dispatchEvent

Inherited from

Disposable.dispatchEvent


dispose()

dispose(): void

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

Disposes the renderer.

Returns

void

Implementation of

OIT.dispose

Inherited from

Disposable.dispose


supportDeviceCaps()

static supportDeviceCaps(deviceType, caps): boolean

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:89

Checks whether dual depth peeling can run with a capability snapshot.

Parameters

deviceType

string

The device type.

caps

DeviceCaps

The device capabilities.

Returns

boolean

True if dual depth peeling is supported.


getType()

getType(): string

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:110

Returns the type of the renderer.

Returns

string

The type of the renderer.

Implementation of

OIT.getType


supportDevice()

supportDevice(deviceType): boolean

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:117

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.

Implementation of

OIT.supportDevice


wantsPremultipliedAlpha()

wantsPremultipliedAlpha(): boolean

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:129

Whether this OIT algorithm wants pre-multiplied alpha

Returns

boolean

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

Implementation of

OIT.wantsPremultipliedAlpha


wantsAdditiveLightPassAlpha()

wantsAdditiveLightPassAlpha(): boolean

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:136

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.

Implementation of

OIT.wantsAdditiveLightPassAlpha


begin()

begin(ctx): number

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:143

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.

Implementation of

OIT.begin


end()

end(ctx): void

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:156

Ends rendering the transparent objects.

Parameters

ctx

DrawContext

The draw context.

Returns

void

Implementation of

OIT.end


beginPass()

beginPass(ctx, pass): boolean

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:170

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.

Implementation of

OIT.beginPass


endPass()

endPass(ctx, _pass): void

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:198

Ends rendering for the given pass.

Parameters

ctx

DrawContext

The draw context.

_pass

number

The pass number.

Returns

void

Implementation of

OIT.endPass


setupFragmentOutput()

setupFragmentOutput(scope): void

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:205

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.

Implementation of

OIT.setupFragmentOutput


outputFragmentColor()

outputFragmentColor(scope, color, ctx): boolean

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:218

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.

Implementation of

OIT.outputFragmentColor


applyUniforms()

applyUniforms(_ctx, bindGroup): void

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:276

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

Implementation of

OIT.applyUniforms


calculateHash()

calculateHash(): string

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:285

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.

Implementation of

OIT.calculateHash


setRenderStates()

setRenderStates(rs): void

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:292

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

Implementation of

OIT.setRenderStates


onDispose()

protected onDispose(): void

Defined in: libs/scene/src/render/dualdepthpeeling_oit.ts:443

Returns

void

Overrides

Disposable.onDispose

Released under the MIT License.