-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorM-Needs-Migration-GuideA breaking change to Bevy's public API that needs to be noted in a migration guideA breaking change to Bevy's public API that needs to be noted in a migration guide
Milestone
Description
Bevy version
2ec38d1 (but also happens on 0.10.x and probably others).
What you did
Delete the environment map lighting from the PBR example, then compare point light and directional light strengths.
The point light is sqrt(50^2 + 50^2 + 50^2) ≈ 86 meters
from the origin and has a strength of 600K lumens. Which means 600,000 / (4 * PI * 86^2) ≈ 6.5 lux
reaching the origin.
Point light
Same strength directional light
commands.spawn(DirectionalLightBundle {
transform: Transform::from_xyz(50.0, 50.0, 50.0).looking_at(Vec3::ZERO, Vec3::Y),
directional_light: DirectionalLight {
illuminance: 6.5,
..default()
},
..default()
});
4800x scaled directional light
commands.spawn(DirectionalLightBundle {
transform: Transform::from_xyz(50.0, 50.0, 50.0).looking_at(Vec3::ZERO, Vec3::Y),
directional_light: DirectionalLight {
illuminance: 6.5 * 4800.0,
..default()
},
..default()
});
Additional information
The bug is caused by this code which dims the strengths of directional lights by 4800x, but leaves point lights and spotlights unchanged:
bevy/crates/bevy_pbr/src/render/light.rs
Lines 857 to 867 in 2ec38d1
// convert from illuminance (lux) to candelas | |
// | |
// exposure is hard coded at the moment but should be replaced | |
// by values coming from the camera | |
// see: https://google.github.io/filament/Filament.html#imagingpipeline/physicallybasedcamera/exposuresettings | |
const APERTURE: f32 = 4.0; | |
const SHUTTER_SPEED: f32 = 1.0 / 250.0; | |
const SENSITIVITY: f32 = 100.0; | |
let ev100 = f32::log2(APERTURE * APERTURE / SHUTTER_SPEED) - f32::log2(SENSITIVITY / 100.0); | |
let exposure = 1.0 / (f32::powf(2.0, ev100) * 1.2); | |
let intensity = light.illuminance * exposure; |
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorM-Needs-Migration-GuideA breaking change to Bevy's public API that needs to be noted in a migration guideA breaking change to Bevy's public API that needs to be noted in a migration guide