Add High Quality Once update mode to Sky#55933
Conversation
7f8e358 to
27028e8
Compare
This allows for generating high-quality reflections once when the sky resource is first assigned (or when the project starts). The use case is to use sky shaders that feature real-time clouds and the like without impacting performance nearly as much, since the radiance map is no longer constantly regenereated during gameplay.
27028e8 to
9ba1932
Compare
|
Yay! (Personally I'm halfway through moving my racer project to Vulkan, but a 3.x backport would be awesome if possible) |
|
I don't think that this resolves godotengine/godot-proposals#3593 Wouldn't it be preferable to implement godotengine/godot-proposals#3593 e.g. provide a different sky source for reflections and background? To me, the current workflow in this PR seems a little hacky. Users would have to write a script to change the sky_material after one frame if they want to separate reflections from the sky background. Otherwise, they would just end up with whatever their lighting/material setup was on frame 0. |
|
It sort of resolves #3593, as setting the Sky for radiance map to update only once does allow for a Static Sky to Provide Ambient and Reflected Lighting, while also allowing the Sky itself to be changed, without affecting the radiance maps.. I mean this doesn't resolve it the way it's proposed, but it does add a workaround that gives a desired result and it is still unclear how much demand there is for something like that for it to be made more user-friendly way of doing it. |
It's tangentially related, but this is indeed a separate problem. I don't think this PR resolves godotengine/godot-proposals#3593, but it does provide another way to work around the original issue. However, this PR does provide a way to resolve notable performance issues that occur when performing sky updates that do not change the radiance map in a significant way. This is why I feel it's important to address this before 4.0 is released. |
Is this an issue that users have been reporting? I'm concerned that we may be chasing an invented use-case and not an actual problem that users are running into. I'm happy to be shown I am wrong here, but I haven't seen any users who are slightly tweaking their sky every frame and running into resulting performance issues. Although, personally, I really like the idea of being able to set the reflections to not update, and then being able to update them when you choose. But I feel that I am being too speculative. I have a feeling that if users want to have a static sky for reflections along with a dynamic sky for the background, the best option is the one presented in godotengine/godot-proposals#3593, |
|
We discussed this PR during today's PR review meeting. The consensus is that we should add a project setting to control how often the radiance map is updated (either once, spread over N frames, or updated every frame). In order to do that we will need to re-evaluate the rendering probe update options and the Update Mode settings in Sky (high quality incremental may no longer be needed). edit: To be clear, we need to go through the proposal process to figure out something that will work and be intuitive. Upon further reflection, having the update time as project setting may not make sense as the realtime update mode is made to operate in a single frame and won't have the same benefits for calculating over multiple frames that the high quality mode has. |
|
Is this still useful after #58177? |
Yes, but this PR needs to be redesigned to follow clayjohn's comment above. On slow integrated graphics, freezing radiance map updates entirely can make the difference between an unplayable game and a playable game 🙂 Alternatively, it's possible to decrease the radiance map size and GGX steps to the minimum value, but this will make reflections look worse (even in scenes with a static sky). |
|
To add to Calinou's comment, something like this is still needed because for complex sky shaders, the slowest part is the sky shader rather than the generation of the radiance map. #58177 made generating a high quality radiance map much cheaper, but it does nothing for expensive shaders. @Calinou I am thinking that we do the following:
The radiance update would only start after the cubemap is updated after running the sky shader. |
Related to #55929.
This allows for generating high-quality reflections once when the sky resource is first assigned (or when the project starts).
The use case is to use sky shaders that feature real-time clouds and the like without impacting performance nearly as much, since the radiance map is no longer constantly regenereated during gameplay. When using this mode, clouds won't move in reflections anymore, but this is hardly a problem in most scenes since clouds are hard to see moving in reflections.
Additionally, with some shader trickery (e.g. toggling a boolean uniform after loading the scene), this allows you to have a radiance map that looks nothing like the sky if you wish 😉
While not physically accurate, this has been requested many times over the years: godotengine/godot-proposals#3593
Testing project: test_sky_update_once.zip
Press C to cycle between sky update modes (including Automatic).
This PR can likely be remade for
3.xif desired.This closes #53969 (at the cost of incorrect reflections, but not much can be done about this, other than adjusting ambient light intensity at run-time).
Performance
OS: Fedora 34
CPU: Intel Core i7-6700K
GPU: GeForce GTX 1080