From b61ebcf95a72a8c8f3472357cb25b737b37898ec Mon Sep 17 00:00:00 2001 From: Dan Aloni Date: Sat, 13 Jun 2026 01:36:24 +0300 Subject: [PATCH 1/2] light: add SunDisk::MARS preset for Mars atmosphere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces a new `SunDisk::MARS` constant to accurately represent the sun’s apparent size when viewed from Mars. The implementation updates the documentation and adds the corresponding constant with an angular size of ~21 arcminutes (0.00615 radians). Key modifications: - Added `SunDisk::MARS` constant in `directional_light.rs` - Updated documentation to reference the new Mars preset - Modified `atmosphere` example to switch sun disk alongside atmosphere presets --- crates/bevy_light/src/directional_light.rs | 14 ++++++++++++-- examples/3d/atmosphere.rs | 14 +++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/crates/bevy_light/src/directional_light.rs b/crates/bevy_light/src/directional_light.rs index 1857d57bc4ed0..31bb2a0c992e6 100644 --- a/crates/bevy_light/src/directional_light.rs +++ b/crates/bevy_light/src/directional_light.rs @@ -257,8 +257,9 @@ pub fn update_directional_light_frusta( /// Requires a `bevy::pbr::Atmosphere` component on a [`Camera3d`](bevy_camera::Camera3d) to have any effect. /// /// By default, the atmosphere is rendered with [`SunDisk::EARTH`], which approximates the -/// apparent size and brightness of the Sun as seen from Earth. You can also disable the sun -/// disk entirely with [`SunDisk::OFF`]. +/// apparent size and brightness of the Sun as seen from Earth. Use [`SunDisk::MARS`] for the +/// smaller apparent sun size from Mars (~1.52 AU). You can also disable the sun disk entirely +/// with [`SunDisk::OFF`]. /// /// In order to cause the sun to "glow" and light up the surrounding sky, enable bloom /// in your post-processing pipeline by adding a `Bloom` component to your camera. @@ -284,6 +285,15 @@ impl SunDisk { intensity: 1.0, }; + /// Mars-like parameters for the sun disk. + /// + /// Uses the mean apparent size (~21 arcminutes) of the Sun from Mars + /// at ~1.52 AU distance with default intensity. + pub const MARS: SunDisk = SunDisk { + angular_size: 0.00615, + intensity: 1.0, + }; + /// No visible sun disk. /// /// Keeps scattering and directional light illumination, but hides the disk itself. diff --git a/examples/3d/atmosphere.rs b/examples/3d/atmosphere.rs index 99396ccc7d78a..5258ceb4d2731 100644 --- a/examples/3d/atmosphere.rs +++ b/examples/3d/atmosphere.rs @@ -15,7 +15,7 @@ use bevy::{ input::keyboard::KeyCode, light::{ atmosphere::ScatteringMedium, light_consts::lux, Atmosphere, AtmosphereEnvironmentMapLight, - FogVolume, VolumetricFog, VolumetricLight, + FogVolume, SunDisk, VolumetricFog, VolumetricLight, }, pbr::{ AtmosphereMode, AtmosphereSettings, DefaultOpaqueRendererMethod, ExtendedMaterial, @@ -72,6 +72,7 @@ fn atmosphere_controls( keyboard_input: Res>, mut planet_atmosphere: Query<(&mut Atmosphere, &mut GlobalTransform)>, mut camera_settings: Query<&mut AtmosphereSettings, With>, + mut sun_disks: Query<&mut SunDisk, With>, atmosphere_presets: Res, mut game_state: ResMut, mut camera_exposure: Query<&mut Exposure, With>, @@ -81,16 +82,22 @@ fn atmosphere_controls( for (mut atmosphere, mut transform) in &mut planet_atmosphere { *atmosphere = Atmosphere::earth(atmosphere_presets.earth.clone()); *transform = GlobalTransform::from_translation(-Vec3::Y * atmosphere.inner_radius); - println!("Switched to Earth atmosphere"); } + for mut sun_disk in &mut sun_disks { + sun_disk.angular_size = SunDisk::EARTH.angular_size; + } + println!("Switched to Earth atmosphere"); } if keyboard_input.just_pressed(KeyCode::Digit4) { for (mut atmosphere, mut transform) in &mut planet_atmosphere { *atmosphere = Atmosphere::mars(atmosphere_presets.mars.clone()); *transform = GlobalTransform::from_translation(-Vec3::Y * atmosphere.inner_radius); - println!("Switched to Mars atmosphere"); } + for mut sun_disk in &mut sun_disks { + sun_disk.angular_size = SunDisk::MARS.angular_size; + } + println!("Switched to Mars atmosphere"); } if keyboard_input.just_pressed(KeyCode::Digit1) { @@ -229,6 +236,7 @@ fn setup_terrain_scene( }, Transform::from_xyz(1.0, 0.4, 0.0).looking_at(Vec3::ZERO, Vec3::Y), VolumetricLight, + SunDisk::EARTH, )); // spawn the fog volume From 67bf75fcaca23154cfe7d26102bdf75758aa609f Mon Sep 17 00:00:00 2001 From: Dan Aloni Date: Sun, 14 Jun 2026 09:26:14 +0300 Subject: [PATCH 2/2] Update crates/bevy_light/src/directional_light.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Máté Homolya --- crates/bevy_light/src/directional_light.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_light/src/directional_light.rs b/crates/bevy_light/src/directional_light.rs index 31bb2a0c992e6..e65a1e1b2024e 100644 --- a/crates/bevy_light/src/directional_light.rs +++ b/crates/bevy_light/src/directional_light.rs @@ -258,7 +258,7 @@ pub fn update_directional_light_frusta( /// /// By default, the atmosphere is rendered with [`SunDisk::EARTH`], which approximates the /// apparent size and brightness of the Sun as seen from Earth. Use [`SunDisk::MARS`] for the -/// smaller apparent sun size from Mars (~1.52 AU). You can also disable the sun disk entirely +/// smaller apparent sun size from Mars. You can also disable the sun disk entirely /// with [`SunDisk::OFF`]. /// /// In order to cause the sun to "glow" and light up the surrounding sky, enable bloom