Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fog color being inaccurate #10226

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Changes from 1 commit
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
28 changes: 20 additions & 8 deletions crates/bevy_pbr/src/render/fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,33 @@ pub fn prepare_fog(
match &fog.falloff {
FogFalloff::Linear { start, end } => GpuFog {
mode: GPU_FOG_MODE_LINEAR,
base_color: fog.color.into(),
directional_light_color: fog.directional_light_color.into(),
base_color: fog.color.as_linear_rgba_f32().into(),
directional_light_color: fog
.directional_light_color
.as_linear_rgba_f32()
.into(),
directional_light_exponent: fog.directional_light_exponent,
be: Vec3::new(*start, *end, 0.0),
..Default::default()
},
FogFalloff::Exponential { density } => GpuFog {
mode: GPU_FOG_MODE_EXPONENTIAL,
base_color: fog.color.into(),
directional_light_color: fog.directional_light_color.into(),
base_color: fog.color.as_linear_rgba_f32().into(),
directional_light_color: fog
.directional_light_color
.as_linear_rgba_f32()
.into(),
directional_light_exponent: fog.directional_light_exponent,
be: Vec3::new(*density, 0.0, 0.0),
..Default::default()
},
FogFalloff::ExponentialSquared { density } => GpuFog {
mode: GPU_FOG_MODE_EXPONENTIAL_SQUARED,
base_color: fog.color.into(),
directional_light_color: fog.directional_light_color.into(),
base_color: fog.color.as_linear_rgba_f32().into(),
directional_light_color: fog
.directional_light_color
.as_linear_rgba_f32()
.into(),
directional_light_exponent: fog.directional_light_exponent,
be: Vec3::new(*density, 0.0, 0.0),
..Default::default()
Expand All @@ -92,8 +101,11 @@ pub fn prepare_fog(
inscattering,
} => GpuFog {
mode: GPU_FOG_MODE_ATMOSPHERIC,
base_color: fog.color.into(),
directional_light_color: fog.directional_light_color.into(),
base_color: fog.color.as_linear_rgba_f32().into(),
directional_light_color: fog
.directional_light_color
.as_linear_rgba_f32()
.into(),
directional_light_exponent: fog.directional_light_exponent,
be: *extinction,
bi: *inscattering,
Expand Down