Skip to content
Merged
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
10 changes: 5 additions & 5 deletions crates/bevy_pbr/src/volumetric_fog/volumetric_fog.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
#import bevy_pbr::mesh_functions::{get_world_from_local, mesh_position_local_to_clip}
#import bevy_pbr::mesh_view_bindings::{globals, lights, view, clusterable_objects}
#import bevy_pbr::mesh_view_types::{
DIRECTIONAL_LIGHT_FLAGS_VOLUMETRIC_BIT,
POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT,
DIRECTIONAL_LIGHT_FLAGS_VOLUMETRIC_BIT,
POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT,
POINT_LIGHT_FLAGS_VOLUMETRIC_BIT,
POINT_LIGHT_FLAGS_SPOT_LIGHT_Y_NEGATIVE,
ClusterableObject
}
#import bevy_pbr::shadow_sampling::{
sample_shadow_map_hardware,
sample_shadow_map_hardware,
sample_shadow_cubemap,
sample_shadow_map,
SPOT_SHADOW_TEXEL_SIZE
Expand Down Expand Up @@ -371,7 +371,7 @@ fn fragment(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {
}
local_light_attenuation *= spot_attenuation * shadow;
}

// Calculate absorption (amount of light absorbed by the fog) and
// out-scattering (amount of light the fog scattered away).
let sample_attenuation = exp(-step_size_world * density * (absorption + scattering));
Expand All @@ -381,7 +381,7 @@ fn fragment(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {

let light_attenuation = exp(-density * bounding_radius * (absorption + scattering));
let light_factors_per_step = fog_color * light_tint * light_attenuation *
scattering * density * step_size_world * light_intensity * 0.1;
scattering * density * step_size_world * light_intensity * exposure;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a 0.1 hardcoded there? 😮


// Modulate the factor we calculated above by the phase, fog color,
// light color, light tint.
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/volumetric_fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, app_settings: R
shadows_enabled: true,
range: 150.0,
color: RED.into(),
intensity: 1000.0,
intensity: 10_000.0,
..default()
},
VolumetricLight,
Expand All @@ -104,7 +104,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, app_settings: R
commands.spawn((
Transform::from_xyz(-1.8, 3.9, -2.7).looking_at(Vec3::ZERO, Vec3::Y),
SpotLight {
intensity: 5000.0, // lumens
intensity: 50_000.0, // lumens
color: Color::WHITE,
shadows_enabled: true,
inner_angle: 0.76,
Expand Down