The graphics device.
The number of iterations for blurring the bloom effect, with each level doubling the blur size. Once the blur size matches the dimensions of the render target, further blur passes are skipped. Defaults to 16.
The camera frame the effect is registered with, or null.
The graphics device.
Whether the effect is enabled. An effect can additionally disable itself from its own parameters, see CameraFrameEffect#active.
Whether the bloom is generated from the full resolution scene instead of a half resolution copy of it. This gives a sharper and more stable glow around small bright features, with a slightly stronger core, at a higher performance cost. Defaults to false.
The intensity of the bloom effect, 0-0.1 range. Defaults to 0, making it disabled.
The brightness below which the scene does not contribute to bloom. Zero, the default, blooms the whole scene, which is the physically based behaviour; raising it restricts the glow to the brightest parts, with a soft transition below the threshold. The value is in the scene-referred units the scene is rendered in, before the exposure and tone mapping applied when the bloom is composited, so a scene lit for an exposure far from 1 needs the threshold scaled to match.
Gets whether the effect contributes to the frame. A zero intensity disables it, the intensity being the effect's on/off control, and so does a scene format without HDR range.
Gets the scale the effect applies to the exposure of the camera this frame, multiplying the exposure of the scene, or of the physical camera with physical units - for effects adapting the exposure to what the camera sees. Read every frame while the effect takes part, after CameraFrameEffect#frameUpdate; the camera frame applies the product of the scales of the effects taking part, and the camera renders with its own exposure again once none does. Defaults to 1.
// an effect brightening the image by one stop
get cameraExposureScale() {
return 2;
}
Gets the name the compose chunk can be overridden under in ShaderChunks, the same
way as the built-in chunks. Derived from the id as compose<Id>PS unless given.
Gets the names of the debug views the chunk provides.
Gets the define set on the compose shader while the effect is active: the id in upper snake
case, colorEnhance giving COLOR_ENHANCE.
Gets the name of the function the composition calls at the effect's slot. Derived from the
id as apply<Id> unless given. The signature depends on the slot: colour slots take
(vec3 color, vec2 uv) and return the colour, COMPOSESLOT_SCENE takes and returns a
vec4.
Gets the GLSL source of the compose chunk, or null when the effect has none.
Gets the identifier of the effect.
Gets the frame resources the effect needs: the half resolution scene, unless BloomEffect#highQuality is set.
Gets the compose slot the entry function is called at, or null for an effect that does not take part in the composition.
Gets the WGSL source of the compose chunk, or null when the effect has none.
Destroys the effect, removing it from its camera frame if it is still registered and
releasing everything it owns, the passes it created included. Subclasses which create
resources in their constructor release them in an override, calling super.destroy(). The
removal takes effect for the frames rendered after the next CameraFrame#update, which
is due before the next frame renders.
The values of this frame.
Returns the compose chunk source for a shader language.
SHADERLANGUAGE_GLSL or SHADERLANGUAGE_WGSL.
The source, or null when the effect has no chunk.
Sets a define on the compose shader. The define persists until changed, so fixed defines can be set once in the constructor and those depending on the parameters from CameraFrameEffect#update. A value of false, null or undefined removes it. Changing a define rebuilds the compose shader.
The define name.
The value.
Sets the value of a uniform the effect's shader chunk reads. Like a material parameter, the value is stored by reference, so an array or a texture can be updated in place. Set the values in CameraFrameEffect#update, or in CameraFrameEffect#frameUpdate for a value which changes every frame.
The name of the uniform, as declared in the chunk.
The value.
Applies the effect's parameters. Called by CameraFrame#update while the effect is active: set the uniform values with CameraFrameEffect#setUniform here, and the defines which depend on the parameters. Everything it sets is what the frames rendered until the next update use.
The HDR bloom effect, a postprocessing technique that simulates the natural glow of bright light sources by spreading their intensity beyond their boundaries, creating a soft and realistic blooming effect.
The bloom is generated from the scene by passes the effect owns, from a half resolution copy of it or, with BloomEffect#highQuality, from the full resolution scene, and added to the scene in linear HDR space, before tone mapping. It requires an HDR scene format, and is disabled when the camera frame renders to PIXELFORMAT_RGBA8.
Every CameraFrame constructs and registers one, available as CameraFrame#bloom.