From 8a14cf0a170bec64dc006bc9c01a6954fe6ade9c Mon Sep 17 00:00:00 2001 From: slopisgood Date: Thu, 7 Aug 2025 04:29:47 -0700 Subject: [PATCH 1/4] Add sun_disc_mult field to Atmosphere struct (#20425) Adds a multiplier field to control sun disc visibility in the procedural atmosphere. --- crates/bevy_pbr/src/atmosphere/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bevy_pbr/src/atmosphere/mod.rs b/crates/bevy_pbr/src/atmosphere/mod.rs index 4b6065c76dc7b..563841c46bdce 100644 --- a/crates/bevy_pbr/src/atmosphere/mod.rs +++ b/crates/bevy_pbr/src/atmosphere/mod.rs @@ -376,8 +376,13 @@ pub struct AtmosphereSettings { /// A conversion factor between scene units and meters, used to /// ensure correctness at different length scales. pub scene_units_to_m: f32, + /// Multiplier to control the visibility of the sun disc. + /// Set to 1.0 to show the sun disc (default) or 0.0 to hide it. + pub sun_disc_mult: f32, + } + impl Default for AtmosphereSettings { fn default() -> Self { Self { From 1a5fc65434947fb0bc3cd6939edc7fcfbaae61ea Mon Sep 17 00:00:00 2001 From: slopisgood Date: Thu, 7 Aug 2025 05:54:01 -0700 Subject: [PATCH 2/4] feat(atmosphere): add sun_disc_mult to Atmosphere to control sun disc visibility (#20425) Adds a new `sun_disc_mult: f32` field to the Atmosphere component so users can toggle the sun disc in procedural sky rendering. Defaults to 1.0 (sun visible) and can be set to 0.0 to hide the disc. The default EARTH constant is updated to set `sun_disc_mult` to 1.0. This partially addresses bevyengine/bevy#20425.https://github.com/slopisgood/bevy/edit/slopisgood-patch-1/crates/bevy_pbr/src/atmosphere/mod.rs --- crates/bevy_pbr/src/atmosphere/mod.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/bevy_pbr/src/atmosphere/mod.rs b/crates/bevy_pbr/src/atmosphere/mod.rs index 563841c46bdce..3f11d8113f20d 100644 --- a/crates/bevy_pbr/src/atmosphere/mod.rs +++ b/crates/bevy_pbr/src/atmosphere/mod.rs @@ -266,7 +266,14 @@ pub struct Atmosphere { /// light it absorbs per meter. /// /// units: m^-1 - pub ozone_absorption: Vec3, + pub ozone_absorption: Vec3, + + /// Multiplier to control the visibility of the sun disc. + /// Set to 1.0 to show the sun disc (default) or 0.0 to hide it. + pub sun_disc_mult: f32, + + + } impl Atmosphere { @@ -280,7 +287,8 @@ impl Atmosphere { mie_scattering: 3.996e-6, mie_absorption: 0.444e-6, mie_asymmetry: 0.8, - ozone_layer_altitude: 25_000.0, + ozone_layer_altitude: 25_00 + sun_disc_mult: 1.0,0.0, ozone_layer_width: 30_000.0, ozone_absorption: Vec3::new(0.650e-6, 1.881e-6, 0.085e-6), }; @@ -376,9 +384,7 @@ pub struct AtmosphereSettings { /// A conversion factor between scene units and meters, used to /// ensure correctness at different length scales. pub scene_units_to_m: f32, - /// Multiplier to control the visibility of the sun disc. - /// Set to 1.0 to show the sun disc (default) or 0.0 to hide it. - pub sun_disc_mult: f32, + } From 35c23bbb486a3a7cbf37dcce42b34cf047b78e24 Mon Sep 17 00:00:00 2001 From: slopisgood Date: Thu, 7 Aug 2025 07:02:51 -0700 Subject: [PATCH 3/4] feat(atmosphere): add sun_disc_mult to Atmosphere WGSL struct Adds sun_disc_mult field to the Atmosphere struct in WGSL so that it matches the Rust component. Allows toggling visibility of the sun disc. (#20425) --- crates/bevy_pbr/src/atmosphere/types.wgsl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/bevy_pbr/src/atmosphere/types.wgsl b/crates/bevy_pbr/src/atmosphere/types.wgsl index 78e9e9a717192..93b54c74508ea 100644 --- a/crates/bevy_pbr/src/atmosphere/types.wgsl +++ b/crates/bevy_pbr/src/atmosphere/types.wgsl @@ -20,6 +20,9 @@ struct Atmosphere { ozone_layer_altitude: f32, // units: m ozone_layer_width: f32, // units: m ozone_absorption: vec3, // ozone absorption. units: m^-1 + // Multiplier to control the visibility of the sun disc. + // Set to 1.0 to show the sun disc (default) or 0.0 to hide it. + sun_disc_mult: f32, } struct AtmosphereSettings { From 7c9f5fd265710ed4bd0a56d900c5c0617dbbbbf1 Mon Sep 17 00:00:00 2001 From: slopisgood Date: Thu, 7 Aug 2025 07:28:37 -0700 Subject: [PATCH 4/4] fix(atmosphere): correct EARTH constant ozone_layer_altitude and sun_disc_mult (#20425) --- crates/bevy_pbr/src/atmosphere/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_pbr/src/atmosphere/mod.rs b/crates/bevy_pbr/src/atmosphere/mod.rs index 3f11d8113f20d..ddfc731444a37 100644 --- a/crates/bevy_pbr/src/atmosphere/mod.rs +++ b/crates/bevy_pbr/src/atmosphere/mod.rs @@ -287,10 +287,10 @@ impl Atmosphere { mie_scattering: 3.996e-6, mie_absorption: 0.444e-6, mie_asymmetry: 0.8, - ozone_layer_altitude: 25_00 - sun_disc_mult: 1.0,0.0, + ozone_layer_altitude: 25_000.0, ozone_layer_width: 30_000.0, ozone_absorption: Vec3::new(0.650e-6, 1.881e-6, 0.085e-6), + sun_disc_mult: 1.0, }; pub fn with_density_multiplier(mut self, mult: f32) -> Self {