-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Directional lights are 4800x dimmer than point lights and spot lights #8369
Comments
This will be a silly migration. Better to fix it up sooner than later. |
Hi, I'd like to take this one, if possible. I think I have a rough idea of what to change to solve it. |
I think this is because of a fundamental difference between point/spot lights (which have a spatial position and a With spot and point lights you can assign them a value like If I remember correctly the PBR implementations somewhat follows the Filament docs. There is some more information on light units there. That being said, maybe one of the people who worked on the PBR implementation can chime in and confirm that the current behavior is correct. |
This is not caused by the inverse square falloff. In my post, I use the amount of light emitted by the point light together with the distance to calculate the amount of light received at the origin. Then I construct a directional light that produces the same illuminance. Rather, this is caused by not following the Filament docs. Specifically, section 5.2.6 says that you have to pre-expose both directional and point/spot lights but Bevy is only pre-exposing directional lights while forgetting to do the same for point/spot lights. |
It seems like we could implement a quick fix that uses hard-coded exposure settings, but also that using per-camera defined exposure settings should be pretty straightforward to implement anyway? |
There's currently |
I made a draft PR that I think does what is suggested, but it makes everything look very dark. There's a lot of information in the filament docs and I need to read it more carefully. I noticed that only part of all the maths is being used and I didn't have time today to understand it. If you see errors, please point them out and I'll fix them ASAP. |
Agreed, I think that's the right way forward. Thanks for looking into this! |
Rebased and finished version of #8407. Huge thanks to @GitGhillie for adjusting all the examples, and the many other people who helped write this PR (@superdump , @coreh , among others) :) Fixes #8369 --- ## Changelog - Added a `brightness` control to `Skybox`. - Added an `intensity` control to `EnvironmentMapLight`. - Added `ExposureSettings` and `PhysicalCameraParameters` for controlling exposure of 3D cameras. - Removed the baked-in `DirectionalLight` exposure Bevy previously hardcoded internally. ## Migration Guide - If using a `Skybox` or `EnvironmentMapLight`, use the new `brightness` and `intensity` controls to adjust their strength. - All 3D scene will now have different apparent brightnesses due to Bevy implementing proper exposure controls. You will have to adjust the intensity of your lights and/or your camera exposure via the new `ExposureSettings` component to compensate. --------- Co-authored-by: Robert Swain <robert.swain@gmail.com> Co-authored-by: GitGhillie <jillisnoordhoek@gmail.com> Co-authored-by: Marco Buono <thecoreh@gmail.com> Co-authored-by: vero <email@atlasdostal.com> Co-authored-by: atlas dostal <rodol@rivalrebels.com>
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 means600,000 / (4 * PI * 86^2) ≈ 6.5 lux
reaching the origin.Point light
Same strength directional light
4800x scaled directional light
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
The text was updated successfully, but these errors were encountered: