-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Re-introduce "Replace Ambient Lights with Environment Map Lights (#17482)" #18207
base: main
Are you sure you want to change the base?
Re-introduce "Replace Ambient Lights with Environment Map Lights (#17482)" #18207
Conversation
…evyengine#17482)" …" This reverts commit 54701a8.
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
Can you say more about this? Has this been discussed elsewhere? I'd really like to do this, but we need clear rationale for changing how user scenes are rendered. |
Does that mean we'll change again how every scene renders in the next version? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example code shouldn't use deprecated things, they need to be updated to use the new component.
this would also close #17367 |
Would it make sense to rename the Conceptually, it is ambient light, right? Isn't it just being implemented with an environment map? |
It was discussed on discord.
There's no plan that I'm aware of to do other changes related to this. The main goal is still to yeet the non physical ambient light but have an easy way to still emulate an ambient light with less overall shader code to maintain.
No, because the |
is there an explanation why some scenes are darker (https://pixel-eagle.com/project/b25a040a-a980-4602-b90c-d480ab84076d/run/9021/compare/9009?screenshot=3D+Rendering/ssao.png or https://pixel-eagle.com/project/b25a040a-a980-4602-b90c-d480ab84076d/run/9021/compare/9009?screenshot=3D+Rendering/pbr.png) and some are lighter (https://pixel-eagle.com/project/b25a040a-a980-4602-b90c-d480ab84076d/run/9021/compare/9009?screenshot=3D+Rendering/spotlight.png or https://pixel-eagle.com/project/b25a040a-a980-4602-b90c-d480ab84076d/run/9021/compare/9009?screenshot=3D+Rendering/ssao.png)? on https://pixel-eagle.com/project/b25a040a-a980-4602-b90c-d480ab84076d/run/9021/compare/9009?screenshot=3D+Rendering/anisotropy.png some details completely disappear. for example the dark bar between the light filaments that should be there when looking at https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/AnisotropyBarnLamp |
Certain scenes are darker since they had both an ambient light and an environment map, but now the ambient light is overridden by the environment map. For scenes that are lighter, this is because the ambient light had no effect on specular reflections, whereas the environment map does.
Examples that modified the ambient light have been updated to use environment map lights instead, but I haven't modified any that relied on the default resource. That change should probably be done when we remove |
I feel like we should make some effort to preserve the scenes of our users. If the new light is brighter because it is more physically correct then it seems like the default intensity should be lower. Or we at least need to tell users what happened and how to fix their scenes. Just linking for reference, the PR that set the current default ambient intensity: 11868. |
There are still examples that use ambient light, they should be fixed now |
I also think that if we deprecate |
This makes sense, but I'm not sure how to replace that with a default environment map, because the new constructors require an While I do think that having no lights by default is a good idea, as it forces users to be deliberate with their lighting setup, it does hurt quick prototyping. |
can't you create a default image on startup to use for the default environment map? |
bevy already has this 1x1 default images bevy/crates/bevy_render/src/texture/mod.rs Lines 24 to 30 in 3b9e2e6
other locations with images created on setup bevy/crates/bevy_core_pipeline/src/post_process/mod.rs Lines 56 to 61 in 3b9e2e6
bevy/crates/bevy_core_pipeline/src/smaa/mod.rs Lines 86 to 90 in 3b9e2e6
|
yup you can static embed small assets, a 1x1 cubemap shouldn't use a lot of memory |
I've swapped out the default This should mean that users will only be using the |
I think that the migration will be easier if we do a deprecation notice. This will point the users to the right spot. |
I missed the original discussion and PR, but I'd like to ask something about the whole idea of removing ambient light. Isn't the whole point of ambient light that it is extremely cheap? AFAIK, it's just another term added to the lighting equations computed in the shader, no? Just some extra arithmetic. Whereas environment map lighting requires texture sampling operations (much slower operation for the GPU) in addition to computation. I thought the reason why ambient light exists is to have an ultra-cheap fallback for very low-end GPUs. That alone makes it a useful feature. Yes, it looks ugly and is not physically correct, but that's kinda the point. Using environment map lighting looks better, yes, but also costs performance, and that kinda defeats the point. Emulating the look of ambient light (ugly) with environment maps (slower perf) just sounds like the worst of both worlds. |
If using an envmap is already too slow for you, then you should probably not be using bevy's default PBR shader and should be using a custom material that is more appropriate for that use case. And if bevy's PBR is good enough, then the envmap is likely not the bottleneck and it's more accurate. This PR also has the nice side effect of making scenes with only an envmap faster. |
#17482 was reverted due to unintentional changes in ambient light rendering.
However, after further inspection, that was due to environment maps being more physically-correct, so the changes are positive.
Closes #17367.