Documentation / scene / OIT
Interface: 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
IDisposable
Properties
[EventMapType]?
readonlyoptional[EventMapType]?:object
Defined in: libs/base/dist/index.d.ts:549
Type-only event map marker.
dispose
dispose: []
Inherited from
IDisposable.[EventMapType]
disposed
readonlydisposed:boolean
Defined in: libs/scene/src/render/oit.ts:138
Whether this is disposed
Overrides
IDisposable.disposed
Methods
on()
on<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:556
Sets up a function that will be called whenever the specified event is delivered to the target
Type Parameters
K
K extends "dispose"
Parameters
type
K
The event type to listen for
listener
EventListener<{ dispose: []; }, K>
The callback function
context?
unknown
Context object of the listener function
Returns
void
Inherited from
IDisposable.on
once()
once<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:563
Sets up a function that will be called only once when the specified event is delivered to the target
Type Parameters
K
K extends "dispose"
Parameters
type
K
The event type to listen for
listener
EventListener<{ dispose: []; }, K>
The callback function
context?
unknown
Context object of the listener function
Returns
void
Inherited from
IDisposable.once
off()
off<
K>(type,listener?,context?):void
Defined in: libs/base/dist/index.d.ts:569
Removes an event listener function previously registered.
Type Parameters
K
K extends "dispose"
Parameters
type
K
The event type for which to remove an event listener
listener?
EventListener<{ dispose: []; }>
The callback function to be removed
context?
unknown
Returns
void
Inherited from
IDisposable.off
dispatchEvent()
dispatchEvent<
K>(type, ...args):void
Defined in: libs/base/dist/index.d.ts:575
Synchronously invoke the affected event listeners with an event object
Type Parameters
K
K extends "dispose"
Parameters
type
K
args
...object[K]
Returns
void
false if the event was canceled, otherwise true
Inherited from
IDisposable.dispatchEvent
getType()
getType():
string
Defined in: libs/scene/src/render/oit.ts:29
Returns the type of the renderer.
Returns
string
The type of the renderer.
supportDevice()
supportDevice(
deviceType):boolean
Defined in: libs/scene/src/render/oit.ts:36
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()
wantsPremultipliedAlpha():
boolean
Defined in: libs/scene/src/render/oit.ts:42
Whether this OIT algorithm wants pre-multiplied alpha
Returns
boolean
True if the OIT wants pre-multiplied alpha, false otherwise
begin()
begin(
ctx):number
Defined in: libs/scene/src/render/oit.ts:56
Begins rendering the transparent objects.
Parameters
ctx
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()
end(
ctx):void
Defined in: libs/scene/src/render/oit.ts:62
Ends rendering the transparent objects.
Parameters
ctx
The draw context.
Returns
void
beginPass()
beginPass(
ctx,pass):boolean
Defined in: libs/scene/src/render/oit.ts:70
Begins rendering for the given pass.
Parameters
ctx
The draw context.
pass
number
The pass number.
Returns
boolean
True if the transparent objects should be rendered, false otherwise.
endPass()
endPass(
ctx,pass):void
Defined in: libs/scene/src/render/oit.ts:77
Ends rendering for the given pass.
Parameters
ctx
The draw context.
pass
number
The pass number.
Returns
void
setupFragmentOutput()
setupFragmentOutput(
scope):void
Defined in: libs/scene/src/render/oit.ts:86
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()
outputFragmentColor(
scope,color,ctx):boolean
Defined in: libs/scene/src/render/oit.ts:96
Do the fragment color output.
Parameters
scope
PBInsideFunctionScope
The global shader scope.
color
PBShaderExp
The calculated fragment color.
ctx
Returns
boolean
Remarks
This method outputs the calculated fragment color for OIT rendering and injects it into the object's material.
applyUniforms()
applyUniforms(
ctx,bindGroup):void
Defined in: libs/scene/src/render/oit.ts:105
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
The draw context.
bindGroup
BindGroup
The bind group.
Returns
void
wantsAdditiveLightPassAlpha()?
optionalwantsAdditiveLightPassAlpha():boolean
Defined in: libs/scene/src/render/oit.ts:113
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()
calculateHash():
string
Defined in: libs/scene/src/render/oit.ts:122
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()
setRenderStates(
rs):void
Defined in: libs/scene/src/render/oit.ts:130
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
dispose()
dispose():
void
Defined in: libs/scene/src/render/oit.ts:134
Disposes the renderer.
Returns
void
Overrides
IDisposable.dispose