Documentation / scene / Bloom
Class: Bloom
Defined in: libs/scene/src/posteffect/bloom.ts:14
The bloom post effect
Extends
Constructors
Constructor
new Bloom():
Bloom
Defined in: libs/scene/src/posteffect/bloom.ts:41
Creates an instance of tonemap post effect
Returns
Bloom
Overrides
AbstractPostEffect.constructor
Properties
className
readonlystaticclassName:"Bloom"
Defined in: libs/scene/src/posteffect/bloom.ts:15
_enabled
protected_enabled:boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:118
Inherited from
_layer
protected_layer:PostEffectLayer
Defined in: libs/scene/src/posteffect/posteffect.ts:119
Inherited from
Accessors
disposed
Get Signature
get disposed():
boolean
Defined in: libs/base/dist/index.d.ts:6107
Returns
boolean
Inherited from
maxDownsampleLevel
Get Signature
get maxDownsampleLevel():
number
Defined in: libs/scene/src/posteffect/bloom.ts:58
The maximum downsample levels
Returns
number
Set Signature
set maxDownsampleLevel(
val):void
Defined in: libs/scene/src/posteffect/bloom.ts:61
Parameters
val
number
Returns
void
downsampleLimit
Get Signature
get downsampleLimit():
number
Defined in: libs/scene/src/posteffect/bloom.ts:65
Downsample resolution limitation
Returns
number
Set Signature
set downsampleLimit(
val):void
Defined in: libs/scene/src/posteffect/bloom.ts:68
Parameters
val
number
Returns
void
threshold
Get Signature
get threshold():
number
Defined in: libs/scene/src/posteffect/bloom.ts:89
Luminance above which a pixel starts to bloom.
Remarks
Compared against the value in the color buffer, whose meaning depends on the scene's lighting mode -- the same number is a different physical brightness in each:
legacy: the buffer is display-referred, so the default 0.8 means "near white".physical: the buffer holds camera pre-exposed luminance. 0.8 then corresponds to0.8 / cameraExposurecd/m², which at the Sunny-16 reference is ~30,700 cd/m² -- almost exactly a white surface in direct sunlight (~31,800). Little in an ordinary daylight scene is brighter than that, so only genuine emitters and specular highlights bloom.
Physical scenes that want a more pronounced glow should lower this: ~0.3 makes a white surface bloom, ~0.15 catches everything above mid-gray. Because the buffer is pre-exposed, a fixed threshold tracks the camera -- stopping down dims the scene and reduces what blooms, as it would on a real sensor.
Returns
number
Set Signature
set threshold(
val):void
Defined in: libs/scene/src/posteffect/bloom.ts:92
Parameters
val
number
Returns
void
thresholdKnee
Get Signature
get thresholdKnee():
number
Defined in: libs/scene/src/posteffect/bloom.ts:96
Bloom threshold knee
Returns
number
Set Signature
set thresholdKnee(
val):void
Defined in: libs/scene/src/posteffect/bloom.ts:99
Parameters
val
number
Returns
void
intensity
Get Signature
get intensity():
number
Defined in: libs/scene/src/posteffect/bloom.ts:103
Bloom intensity
Returns
number
Set Signature
set intensity(
val):void
Defined in: libs/scene/src/posteffect/bloom.ts:106
Parameters
val
number
Returns
void
filterRadius
Get Signature
get filterRadius():
number
Defined in: libs/scene/src/posteffect/bloom.ts:119
Radius of the 3x3 tent filter used when upsampling the pyramid, in source texels.
Remarks
1 is the natural width and what the Call of Duty presentation uses. Raising it spreads each level further and softens the halo, at the cost of the tent's taps drifting apart: past ~2 the three lobes stop overlapping and the filter reintroduces the very grid pattern it exists to remove. Lowering it toward 0 collapses the filter back to a plain bilinear tap and the blocky banding returns.
Returns
number
Set Signature
set filterRadius(
val):void
Defined in: libs/scene/src/posteffect/bloom.ts:122
Parameters
val
number
Returns
void
karisAverage
Get Signature
get karisAverage():
boolean
Defined in: libs/scene/src/posteffect/bloom.ts:135
Whether the first downsample weights its taps by 1 / (1 + luma) (the "Karis average").
Remarks
Suppresses the fireflies a single blown-out specular texel produces: without it, such a texel dominates its 2x2 group and flickers as the surface moves, since whether a normal map lands on NdotL ~ 1 changes frame to frame. The trade is a slightly dimmer, slightly tighter halo, because the weighting deliberately holds the brightest samples back. Turn it off for a static scene that wants maximum reach and has no high-frequency speculars to stabilize.
Returns
boolean
Set Signature
set karisAverage(
val):void
Defined in: libs/scene/src/posteffect/bloom.ts:138
Parameters
val
boolean
Returns
void
enabled
Get Signature
get enabled():
boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:130
Whether this post effect is enabled
Returns
boolean
Set Signature
set enabled(
val):void
Defined in: libs/scene/src/posteffect/posteffect.ts:133
Parameters
val
boolean
Returns
void
Inherited from
layer
Get Signature
get layer():
PostEffectLayer
Defined in: libs/scene/src/posteffect/posteffect.ts:137
Whether this post effect will be rendered at opaque phase
Returns
Inherited from
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
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
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
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
AbstractPostEffect.dispatchEvent
dispose()
dispose():
void
Defined in: libs/base/dist/index.d.ts:6108
Returns
void
Inherited from
requireLinearDepthTexture()
requireLinearDepthTexture():
boolean
Defined in: libs/scene/src/posteffect/bloom.ts:142
Checks whether this post effect requires the linear depth texture
Returns
boolean
true if the linear depth texture is required.
Overrides
AbstractPostEffect.requireLinearDepthTexture
requireDepthAttachment()
requireDepthAttachment():
boolean
Defined in: libs/scene/src/posteffect/bloom.ts:146
Checks whether this post effect requires the scene depth buffer
Returns
boolean
true if the scene depth buffer is required.
Overrides
AbstractPostEffect.requireDepthAttachment
setup()
setup(
s):RGHandle
Defined in: libs/scene/src/posteffect/bloom.ts:156
Declare this effect's passes on the render graph.
The default implementation wraps AbstractPostEffect.apply into a single graph pass, so effects only overriding apply() work unchanged. Multi-pass effects override this method to declare each internal step as its own pass, calling PostEffectSetupContext.createOutput inside the final pass.
Parameters
s
Build-time setup context.
Returns
The effect's output color handle.
Overrides
apply()
apply(
ctx,inputColorTexture,_sceneDepthTexture,srgbOutput):void
Defined in: libs/scene/src/posteffect/bloom.ts:300
Apply the post effect
Parameters
ctx
inputColorTexture
Texture2D
The previous scene color texture
_sceneDepthTexture
Texture2D
The linear scene depth texture
srgbOutput
boolean
Whether the result should be gamma corrected
Returns
void
Remarks
The frame buffer of the post effect is already set when apply() is called.
Overrides
needFlip()
needFlip(
device):boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:145
Check if the post effect should be rendered upside down.
Parameters
device
AbstractDevice
The device object
Returns
boolean
true if the post effect should be rendered upside down
Inherited from
requireMotionVectorTexture()
requireMotionVectorTexture(
_ctx):boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:166
Checks whether this post effect requires the motion vector texture
Parameters
_ctx
Returns
boolean
true if the motion vector texture is required.
Inherited from
AbstractPostEffect.requireMotionVectorTexture
requireHiZTexture()
requireHiZTexture(
_ctx):boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:170
Checks whether this post effect requires the Hi-Z depth pyramid.
Parameters
_ctx
Returns
boolean
Inherited from
AbstractPostEffect.requireHiZTexture
requireHiZNearest()
requireHiZNearest(
_ctx):boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:181
Checks whether this post effect requires the Hi-Z pyramid's nearest-depth channel, which answers "how close is the nearest surface in this screen region" rather than the farthest-depth channel's occlusion question.
Implies AbstractPostEffect.requireHiZTexture; an effect that needs the nearest channel does not have to request the pyramid separately.
Parameters
_ctx
Returns
boolean
Inherited from
AbstractPostEffect.requireHiZNearest
requireSceneNormalTexture()
requireSceneNormalTexture(
_ctx):boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:185
Checks whether this post effect requires opaque-scene world normals.
Parameters
_ctx
Returns
boolean
Inherited from
AbstractPostEffect.requireSceneNormalTexture
requireSceneRoughnessTexture()
requireSceneRoughnessTexture(
_ctx):boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:189
Checks whether this post effect requires opaque-scene roughness data.
Parameters
_ctx
Returns
boolean
Inherited from
AbstractPostEffect.requireSceneRoughnessTexture
requireShadowMask()
requireShadowMask(
_ctx):boolean
Defined in: libs/scene/src/posteffect/posteffect.ts:200
Checks whether this post effect requires the screen-space shadow mask.
When true and the mask was produced this frame, the effect can sample DrawContext.shadowMaskTexture in its apply() body; the graph keeps the mask alive for the effect's pass.
Parameters
_ctx
Returns
boolean
true if the shadow mask is required.
Inherited from
AbstractPostEffect.requireShadowMask
passThrough()
protectedpassThrough(ctx,inputColorTexture,srgbOutput,renderStates?):void
Defined in: libs/scene/src/posteffect/posteffect.ts:344
Parameters
ctx
Draw context
inputColorTexture
Texture2D
Input color texture
srgbOutput
boolean
Whether the result should be gamma corrected
renderStates?
RenderStateSet
Returns
void
Inherited from
AbstractPostEffect.passThrough
drawFullscreenQuad()
protecteddrawFullscreenQuad(renderStateSet?):void
Defined in: libs/scene/src/posteffect/posteffect.ts:363
Draws a fullscreen quad
Parameters
renderStateSet?
RenderStateSet
Render states that will be used when drawing the fullscreen quad.
Returns
void
Inherited from
AbstractPostEffect.drawFullscreenQuad
onDispose()
protectedonDispose():void
Defined in: libs/scene/src/posteffect/posteffect.ts:376
Returns
void