Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ac2c148
Input -> ButtonInput
GitGhillie Dec 16, 2023
b1c0ddd
Change default exposure to indoor
GitGhillie Dec 16, 2023
540ab66
Adjust a few examples
GitGhillie Dec 16, 2023
d04ad9a
Adjust PhysicalCameraParameters to an exposure of roughly 7 as well
GitGhillie Dec 16, 2023
dc61b42
adjust lighting example by changing the initial exposure
GitGhillie Dec 16, 2023
479223a
increase point light intensity in lighting example
GitGhillie Dec 17, 2023
6cf0423
Adjust default ambient light
GitGhillie Dec 18, 2023
f67e704
Adjust 3d examples
GitGhillie Dec 18, 2023
2d2f95d
Adjust some more 3d examples
GitGhillie Dec 19, 2023
81e7c25
Adjust some more 3d examples part 3
GitGhillie Dec 20, 2023
418ec05
Adjust some more 3d examples part 4
GitGhillie Dec 25, 2023
ec1ddfb
Adjust some more 3d examples part 5
GitGhillie Dec 26, 2023
a7e0831
Adjust some more 3d examples part 6
GitGhillie Dec 26, 2023
e969d5e
Compensate for exposure after fetching transmission background color
coreh Dec 29, 2023
f743dce
Adjust transmission example
coreh Dec 29, 2023
874ea8c
Remove `ColorGrading` exposure as a workaround for `EnvironmentMapLig…
coreh Dec 29, 2023
0d4006e
Also tweak look of emissive flame in transmission example
coreh Dec 29, 2023
edfb721
Adjust some more 3d examples part 7
GitGhillie Dec 30, 2023
404a98d
Merge pull request #1 from coreh/exposure_jms
GitGhillie Dec 31, 2023
5f92b44
Adjust some more 3d examples part 8
GitGhillie Jan 4, 2024
9968173
Adjust some more 3d examples part 9 (fin)
GitGhillie Jan 4, 2024
bbd6532
fmt
GitGhillie Jan 4, 2024
a6d9076
Take exposure into account for directional light influence in fog
coreh Jan 6, 2024
c276a80
Merge pull request #2 from coreh/exposure-fog-fix
GitGhillie Jan 6, 2024
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
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ fn calculate_cascade(
/// # use bevy_ecs::system::ResMut;
/// # use bevy_pbr::AmbientLight;
/// fn setup_ambient_light(mut ambient_light: ResMut<AmbientLight>) {
/// ambient_light.brightness = 0.3;
/// ambient_light.brightness = 20.0;
/// }
/// ```
#[derive(Resource, Clone, Debug, ExtractResource, Reflect)]
Expand All @@ -570,7 +570,7 @@ impl Default for AmbientLight {
fn default() -> Self {
Self {
color: Color::rgb(1.0, 1.0, 1.0),
brightness: 0.05,
brightness: 8.0,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/render/pbr_functions.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ fn apply_fog(fog_params: mesh_view_types::Fog, input_color: vec4<f32>, fragment_
0.0
),
fog_params.directional_light_exponent
) * light.color.rgb;
) * light.color.rgb * view_bindings::view.exposure;
}
}

Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_pbr/src/render/pbr_transmission.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ fn specular_transmissive_light(world_position: vec4<f32>, frag_coord: vec3<f32>,
background_color = fetch_transmissive_background(offset_position, frag_coord, view_z, perceptual_roughness);
}

// Compensate for exposure, since the background color is coming from an already exposure-adjusted texture
background_color = vec4(background_color.rgb / view_bindings::view.exposure, background_color.a);

// Dot product of the refracted direction with the exit normal (Note: We assume the exit normal is the entry normal but inverted)
let MinusNdotT = dot(-N, T);

Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl ExposureSettings {
impl Default for ExposureSettings {
fn default() -> Self {
Self {
ev100: Self::EV100_OVERCAST,
ev100: Self::EV100_INDOOR,
}
}
}
Expand Down Expand Up @@ -138,8 +138,8 @@ impl PhysicalCameraParameters {
impl Default for PhysicalCameraParameters {
fn default() -> Self {
Self {
aperture_f_stops: 4.0,
shutter_speed_s: 1.0 / 250.0,
aperture_f_stops: 1.0,
shutter_speed_s: 1.0 / 125.0,
sensitivity_iso: 100.0,
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/3d_gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn setup(
// light
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 1500.0,
intensity: 250000.0,
shadows_enabled: true,
..default()
},
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/3d_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn setup(
// light
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 1500.0,
intensity: 250_000.0,
shadows_enabled: true,
..default()
},
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/3d_shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn setup(

commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 9000.0,
intensity: 1500000.0,
range: 100.,
shadows_enabled: true,
..default()
Expand Down
4 changes: 4 additions & 0 deletions examples/3d/3d_viewport_to_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ fn setup(
// light
commands.spawn(DirectionalLightBundle {
transform: Transform::from_translation(Vec3::ONE).looking_at(Vec3::ZERO, Vec3::Y),
directional_light: DirectionalLight {
illuminance: 2000.0,
..default()
},
..default()
});

Expand Down
2 changes: 2 additions & 0 deletions examples/3d/anti_aliasing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ fn setup(
// Light
commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 3000.0,
shadows_enabled: true,
..default()
},
Expand Down Expand Up @@ -324,6 +325,7 @@ fn setup(
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
intensity: 150.0,
},
FogSettings {
color: Color::rgba_u8(43, 44, 47, 255),
Expand Down
1 change: 1 addition & 0 deletions examples/3d/atmospheric_fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn setup_terrain_scene(
commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
color: Color::rgb(0.98, 0.95, 0.82),
illuminance: 3000.0,
shadows_enabled: true,
..default()
},
Expand Down
4 changes: 4 additions & 0 deletions examples/3d/blend_modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ fn setup(

// Light
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 150_000.0,
..default()
},
transform: Transform::from_xyz(4.0, 8.0, 4.0),
..default()
});
Expand Down
6 changes: 3 additions & 3 deletions examples/3d/bloom_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ fn setup_scene(
));

let material_emissive1 = materials.add(StandardMaterial {
emissive: Color::rgb_linear(13.99, 5.32, 2.0), // 4. Put something bright in a dark environment to see the effect
emissive: Color::rgb_linear(2300.0, 900.0, 300.0), // 4. Put something bright in a dark environment to see the effect
..default()
});
let material_emissive2 = materials.add(StandardMaterial {
emissive: Color::rgb_linear(2.0, 13.99, 5.32),
emissive: Color::rgb_linear(300.0, 2300.0, 900.0),
..default()
});
let material_emissive3 = materials.add(StandardMaterial {
emissive: Color::rgb_linear(5.32, 2.0, 13.99),
emissive: Color::rgb_linear(900.0, 300.0, 2300.0),
..default()
});
let material_non_emissive = materials.add(StandardMaterial {
Expand Down
4 changes: 3 additions & 1 deletion examples/3d/deferred_rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fn setup(
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
intensity: 150.0,
},
DepthPrepass,
MotionVectorPrepass,
Expand All @@ -71,6 +72,7 @@ fn setup(

commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 4000.0,
shadows_enabled: true,
..default()
},
Expand Down Expand Up @@ -145,7 +147,7 @@ fn setup(
// Light
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 1.0,
intensity: 150.0,
radius: 0.125,
shadows_enabled: true,
color: sphere_color,
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn setup_pyramid_scene(
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(0.0, 1.0, 0.0),
point_light: PointLight {
intensity: 1500.,
intensity: 300_000.,
range: 100.,
shadows_enabled: true,
..default()
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/generate_custom_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn setup(
// Light up the scene.
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 1000.0,
intensity: 100_000.0,
range: 100.0,
..default()
},
Expand Down
16 changes: 10 additions & 6 deletions examples/3d/lighting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ use bevy::{
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.init_resource::<Parameters>()
.insert_resource(Parameters(PhysicalCameraParameters {
aperture_f_stops: 1.0,
shutter_speed_s: 1.0 / 15.0,
sensitivity_iso: 400.0,
}))
.add_systems(Startup, setup)
.add_systems(Update, (update_exposure, movement, animate_light_direction))
.run();
Expand Down Expand Up @@ -131,7 +135,7 @@ fn setup(
// transform: Transform::from_xyz(5.0, 8.0, 2.0),
transform: Transform::from_xyz(1.0, 2.0, 0.0),
point_light: PointLight {
intensity: 1600.0, // lumens - roughly a 100W non-halogen incandescent bulb
intensity: 4000.0, // lumens - roughly a 300W non-halogen incandescent bulb
color: Color::RED,
shadows_enabled: true,
..default()
Expand Down Expand Up @@ -159,7 +163,7 @@ fn setup(
transform: Transform::from_xyz(-1.0, 2.0, 0.0)
.looking_at(Vec3::new(-1.0, 0.0, 0.0), Vec3::Z),
spot_light: SpotLight {
intensity: 1600.0, // lumens - roughly a 100W non-halogen incandescent bulb
intensity: 4000.0, // lumens - roughly a 300W non-halogen incandescent bulb
color: Color::GREEN,
shadows_enabled: true,
inner_angle: 0.6,
Expand Down Expand Up @@ -191,7 +195,7 @@ fn setup(
// transform: Transform::from_xyz(5.0, 8.0, 2.0),
transform: Transform::from_xyz(0.0, 4.0, 0.0),
point_light: PointLight {
intensity: 1600.0, // lumens - roughly a 100W non-halogen incandescent bulb
intensity: 4000.0, // lumens - roughly a 300W non-halogen incandescent bulb
color: Color::BLUE,
shadows_enabled: true,
..default()
Expand All @@ -216,7 +220,7 @@ fn setup(
// directional 'sun' light
commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 1000.0,
illuminance: 100.0,
shadows_enabled: true,
..default()
},
Expand Down Expand Up @@ -287,7 +291,7 @@ fn setup(
}

fn update_exposure(
key_input: Res<Input<KeyCode>>,
key_input: Res<ButtonInput<KeyCode>>,
mut parameters: ResMut<Parameters>,
mut query: Query<&mut ExposureSettings>,
mut text: Query<&mut Text>,
Expand Down
3 changes: 2 additions & 1 deletion examples/3d/load_gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
intensity: 1.0,
intensity: 150.0,
},
));

commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 2000.0,
shadows_enabled: true,
..default()
},
Expand Down
4 changes: 4 additions & 0 deletions examples/3d/orthographic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ fn setup(
// light
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(3.0, 8.0, 5.0),
point_light: PointLight {
intensity: 150_000.0,
..default()
},
..default()
});
}
2 changes: 1 addition & 1 deletion examples/3d/parallax_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fn setup(
.spawn(PointLightBundle {
transform: Transform::from_xyz(1.8, 0.7, -1.1),
point_light: PointLight {
intensity: 226.0,
intensity: 50_000.0,
shadows_enabled: true,
..default()
},
Expand Down
4 changes: 4 additions & 0 deletions examples/3d/parenting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ fn setup(
// light
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(4.0, 5.0, -4.0),
point_light: PointLight {
intensity: 150_000.0,
..default()
},
..default()
});
// camera
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/pbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn setup(
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(50.0, 50.0, 50.0),
point_light: PointLight {
intensity: 600000.,
intensity: 100_000_000.,
range: 100.,
..default()
},
Expand Down Expand Up @@ -138,7 +138,7 @@ fn setup(
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
intensity: 1.0,
intensity: 150.0,
},
));
}
Expand Down
4 changes: 4 additions & 0 deletions examples/3d/render_to_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ fn setup(
commands.spawn((
PointLightBundle {
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 10.0)),
point_light: PointLight {
intensity: 150_000.0,
..default()
},
..default()
},
RenderLayers::all(),
Expand Down
6 changes: 3 additions & 3 deletions examples/3d/shadow_biases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn setup(
});
builder.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 100000.0,
illuminance: 1500.0,
shadow_depth_bias: 0.0,
shadow_normal_bias: 0.0,
shadows_enabled: true,
Expand Down Expand Up @@ -196,15 +196,15 @@ fn toggle_light(
for mut light in &mut point_lights {
light.intensity = if light.intensity == 0.0 {
example_text.single_mut().sections[5].value = "PointLight".to_string();
100000000.0
500_000.0
} else {
0.0
};
}
for mut light in &mut directional_lights {
light.illuminance = if light.illuminance == 0.0 {
example_text.single_mut().sections[5].value = "DirectionalLight".to_string();
100000.0
1500.0
} else {
0.0
};
Expand Down
6 changes: 3 additions & 3 deletions examples/3d/shadow_caster_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn setup(

commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 100000.0,
illuminance: 1500.0,
shadows_enabled: true,
..default()
},
Expand Down Expand Up @@ -134,15 +134,15 @@ fn toggle_light(
for mut light in &mut point_lights {
light.intensity = if light.intensity == 0.0 {
println!("Using PointLight");
100000000.0
500_000.0
} else {
0.0
};
}
for mut light in &mut directional_lights {
light.illuminance = if light.illuminance == 0.0 {
println!("Using DirectionalLight");
100000.0
1500.0
} else {
0.0
};
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/skybox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
CameraController::default(),
Skybox {
image: skybox_handle.clone(),
brightness: 1.0,
brightness: 150.0,
},
));

Expand Down
Loading