Set ambient_intensity to 0.0 in volumetric_fog example, correct doc comment (#13531)

# Objective

- Fixes #13521

## Solution

Set `ambient_intensity` to 0.0 in volumetric_fog example.

I chose setting it explicitly over changing the default in order to make
it clear that this needs to be set depending on whether you have an
`EnvironmentMapLight`. See documentation for `ambient_intensity` and
related members.

## Testing

- Run the volumetric_fog example and notice how the light shown in
#13521 is not there anymore, as expected.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
GitGhillie 2024-05-28 12:55:29 +02:00 committed by GitHub
parent d92b1fcef7
commit f45eddfe82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View file

@ -103,18 +103,19 @@ pub struct VolumetricFogSettings {
/// Color of the ambient light. /// Color of the ambient light.
/// ///
/// This is separate from Bevy's [`crate::light::AmbientLight`] because an /// This is separate from Bevy's [`AmbientLight`](crate::light::AmbientLight) because an
/// [`EnvironmentMapLight`] is still considered an ambient light for the /// [`EnvironmentMapLight`](crate::environment_map::EnvironmentMapLight) is
/// purposes of volumetric fog. If you're using a /// still considered an ambient light for the purposes of volumetric fog. If you're using a
/// [`crate::EnvironmentMapLight`], for best results, this should be a good /// [`EnvironmentMapLight`](crate::environment_map::EnvironmentMapLight), for best results,
/// approximation of the average color of the environment map. /// this should be a good approximation of the average color of the environment map.
/// ///
/// Defaults to white. /// Defaults to white.
pub ambient_color: Color, pub ambient_color: Color,
/// The brightness of the ambient light. /// The brightness of the ambient light.
/// ///
/// If there's no ambient light, set this to 0. /// If there's no [`EnvironmentMapLight`](crate::environment_map::EnvironmentMapLight),
/// set this to 0.
/// ///
/// Defaults to 0.1. /// Defaults to 0.1.
pub ambient_intensity: f32, pub ambient_intensity: f32,

View file

@ -50,7 +50,11 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
image: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"), image: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
brightness: 1000.0, brightness: 1000.0,
}) })
.insert(VolumetricFogSettings::default()); .insert(VolumetricFogSettings {
// This value is explicitly set to 0 since we have no environment map light
ambient_intensity: 0.0,
..default()
});
// Add the help text. // Add the help text.
commands.spawn( commands.spawn(