Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions crates/bevy_pbr/src/atmosphere/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -280,9 +287,10 @@ 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_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 {
Expand Down Expand Up @@ -376,8 +384,11 @@ 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,


}


impl Default for AtmosphereSettings {
fn default() -> Self {
Self {
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_pbr/src/atmosphere/types.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ struct Atmosphere {
ozone_layer_altitude: f32, // units: m
ozone_layer_width: f32, // units: m
ozone_absorption: vec3<f32>, // 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 {
Expand Down
Loading