Documentation / scene / ABufferOIT
Class: ABufferOIT
Defined in: libs/scene/src/render/abuffer_oit.ts:28
per-pixel linked list OIT renderer using ABuffer.
Remarks
The ABuffer OIT renderer only supports WebGPU device.
Extends
Disposable
Implements
Constructors
Constructor
new ABufferOIT(
numLayers?):ABufferOIT
Defined in: libs/scene/src/render/abuffer_oit.ts:56
Creates an instance of ABufferOIT class
Parameters
numLayers?
number = 16
How many transparent layers, default is 16
Returns
ABufferOIT
Overrides
Disposable.constructor
Properties
type
readonlystatictype:"ab"='ab'
Defined in: libs/scene/src/render/abuffer_oit.ts:30
Type name of ABufferOIT
usePremultipliedAlpha
readonlystaticusePremultipliedAlpha:true=true
Defined in: libs/scene/src/render/abuffer_oit.ts:31
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
Inherited from
Disposable.disposed
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
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
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
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
Inherited from
Disposable.dispatchEvent
dispose()
dispose():
void
Defined in: libs/base/dist/index.d.ts:6066
Disposes the renderer.
Returns
void
Implementation of
Inherited from
Disposable.dispose
getType()
getType():
string
Defined in: libs/scene/src/render/abuffer_oit.ts:75
Returns the type of the renderer.
Returns
string
The type of the renderer.
Implementation of
supportDevice()
supportDevice(
deviceType):deviceType is "webgpu"
Defined in: libs/scene/src/render/abuffer_oit.ts:81
Checks whether the renderer supports the given device type.
Parameters
deviceType
string
The device type.
Returns
deviceType is "webgpu"
True if the renderer supports the device type, false otherwise.
Implementation of
wantsPremultipliedAlpha()
wantsPremultipliedAlpha():
boolean
Defined in: libs/scene/src/render/abuffer_oit.ts:87
Whether this OIT algorithm wants pre-multiplied alpha
Returns
boolean
True if the OIT wants pre-multiplied alpha, false otherwise
Implementation of
wantsAdditiveLightPassAlpha()
wantsAdditiveLightPassAlpha():
boolean
Defined in: libs/scene/src/render/abuffer_oit.ts:93
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/abuffer_oit.ts:99
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.
Implementation of
end()
end(
ctx):void
Defined in: libs/scene/src/render/abuffer_oit.ts:150
Ends rendering the transparent objects.
Parameters
ctx
The draw context.
Returns
void
Implementation of
setupFragmentOutput()
setupFragmentOutput(
scope):void
Defined in: libs/scene/src/render/abuffer_oit.ts:157
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
beginPass()
beginPass(
ctx,pass):boolean
Defined in: libs/scene/src/render/abuffer_oit.ts:170
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.
Implementation of
endPass()
endPass(
ctx,pass):void
Defined in: libs/scene/src/render/abuffer_oit.ts:228
Ends rendering for the given pass.
Parameters
ctx
The draw context.
pass
number
The pass number.
Returns
void
Implementation of
calculateHash()
calculateHash():
string
Defined in: libs/scene/src/render/abuffer_oit.ts:290
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
applyUniforms()
applyUniforms(
ctx,bindGroup):void
Defined in: libs/scene/src/render/abuffer_oit.ts:296
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
Implementation of
outputFragmentColor()
outputFragmentColor(
scope,color):boolean
Defined in: libs/scene/src/render/abuffer_oit.ts:312
Do the fragment color output.
Parameters
scope
PBInsideFunctionScope
The global shader scope.
color
PBShaderExp
The calculated fragment color.
Returns
boolean
Remarks
This method outputs the calculated fragment color for OIT rendering and injects it into the object's material.
Implementation of
setRenderStates()
setRenderStates(
rs):void
Defined in: libs/scene/src/render/abuffer_oit.ts:351
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
onDispose()
protectedonDispose():void
Defined in: libs/scene/src/render/abuffer_oit.ts:478
Returns
void
Overrides
Disposable.onDispose