pub struct BloomSettings {
pub intensity: f32,
pub low_frequency_boost: f32,
pub low_frequency_boost_curvature: f32,
pub high_pass_frequency: f32,
pub prefilter_settings: BloomPrefilterSettings,
pub composite_mode: BloomCompositeMode,
}Expand description
Applies a bloom effect to an HDR-enabled 2d or 3d camera.
Bloom emulates an effect found in real cameras and the human eye, causing halos to appear around very bright parts of the scene.
See also https://en.wikipedia.org/wiki/Bloom_(shader_effect).
§Usage Notes
Bloom is currently not compatible with WebGL2.
Often used in conjunction with bevy_pbr::StandardMaterial::emissive for 3d meshes.
Bloom is best used alongside a tonemapping function that desaturates bright colors,
such as TonyMcMapface.
Bevy’s implementation uses a parametric curve to blend between a set of blurred (lower frequency) images generated from the camera’s view. See https://starlederer.github.io/bloom/ for a visualization of the parametric curve used in Bevy as well as a visualization of the curve’s respective scattering profile.
Fields§
§intensity: f32Controls the baseline of how much the image is scattered (default: 0.15).
This parameter should be used only to control the strength of the bloom for the scene as a whole. Increasing it too much will make the scene appear blurry and over-exposed.
To make a mesh glow brighter, rather than increase the bloom intensity,
you should increase the mesh’s emissive value.
§In energy-conserving mode
The value represents how likely the light is to scatter.
The value should be between 0.0 and 1.0 where:
- 0.0 means no bloom
- 1.0 means the light is scattered as much as possible
§In additive mode
The value represents how much scattered light is added to the image to create the glow effect.
In this configuration:
- 0.0 means no bloom
-
0.0 means a proportionate amount of scattered light is added
low_frequency_boost: f32Low frequency contribution boost. Controls how much more likely the light is to scatter completely sideways (low frequency image).
Comparable to a low shelf boost on an equalizer.
§In energy-conserving mode
The value should be between 0.0 and 1.0 where:
- 0.0 means low frequency light uses base intensity for blend factor calculation
- 1.0 means low frequency light contributes at full power
§In additive mode
The value represents how much scattered light is added to the image to create the glow effect.
In this configuration:
- 0.0 means no bloom
-
0.0 means a proportionate amount of scattered light is added
low_frequency_boost_curvature: f32Low frequency contribution boost curve. Controls the curvature of the blend factor function making frequencies next to the lowest ones contribute more.
Somewhat comparable to the Q factor of an equalizer node.
Valid range:
- 0.0 - base base intensity and boosted intensity are linearly interpolated
- 1.0 - all frequencies below maximum are at boosted intensity level
high_pass_frequency: f32Tightens how much the light scatters (default: 1.0).
Valid range:
- 0.0 - maximum scattering angle is 0 degrees (no scattering)
- 1.0 - maximum scattering angle is 90 degrees
prefilter_settings: BloomPrefilterSettings§composite_mode: BloomCompositeModeControls whether bloom textures
are blended between or added to each other. Useful
if image brightening is desired and a must-change
if prefilter_settings are used.
§Recommendation
Set to BloomCompositeMode::Additive if prefilter_settings are
configured in a non-energy-conserving way,
otherwise set to BloomCompositeMode::EnergyConserving.
Implementations§
Source§impl BloomSettings
impl BloomSettings
Sourcepub const OLD_SCHOOL: Self
pub const OLD_SCHOOL: Self
A preset that’s similar to how older games did bloom.
Sourcepub const SCREEN_BLUR: Self
pub const SCREEN_BLUR: Self
A preset that applies a very strong bloom, and blurs the whole screen.
Trait Implementations§
Source§impl Clone for BloomSettings
impl Clone for BloomSettings
Source§fn clone(&self) -> BloomSettings
fn clone(&self) -> BloomSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BloomSettings
impl RefUnwindSafe for BloomSettings
impl Send for BloomSettings
impl Sync for BloomSettings
impl Unpin for BloomSettings
impl UnwindSafe for BloomSettings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().