godot
godot copied to clipboard
Fix ambient_light_disabled render mode flag
Fixes the ambient_light_disabled
render mode, as it currently does not have any implementation in master.
We need to re-evaluate the ambient_light_disabled
render mode as in 3.x all it does is disable contributions from the sky radiance and irradiance map. It doesn't disable all ambient light. This PR disables all ambient light (the Tree-SSA ensures will optimize out any calculations contributing to ambient light because it doesn't end up affecting the final render result). Now that we can select the source of ambient contributions I'm not sure that we should keep this render mode.
Edit: To be clear, I am happy with the implementation if other stakeholders agree that the render mode should be kept and what it should do is forcibly disable all ambient light contributions
Now that we can select the source of ambient contributions I'm not sure that we should keep this render mode.
This is a global setting, while the ambient_light_disabled
render mode works on a per-material basis.
~~On the other hand, I fail to see any use case for disabling ambient light on a specific material.~~
Edit: The initial pull request adding this render mode claimed that disabling ambient light is useful for toon shaders, which sounds reasonable.
I have a usecase for that, my pipeline is strange (i'm rendering data more than color) and ambient light is used to fully light the red channel. Other lights only applies to blue channel in my pipeline. For transparent material the current limitation of godot doesn't allow post processing properly (screen texture is rendered prior to transparent pass and viewport is sRGB). It would be usefull to be able to turn of the ambient light on my transparent shaders.
I also have a use case for it. In a water caustics shader made with @paddy-exe , we needed the ambient_light_disabled
render mode to remove the filled color over caustics volume, without disabling ambient light for the whole game.
You can actually see this happening in the video attached within the README.md
file.
Looks great, thanks! And congratulations on your first merged contribution!
I noticed that this does not work for SDFGI (yet another ambient light source). I assume because its done in screenspace somehow?
@bertodelrio256 Please open a new issue with a minimal reproduction project attached. Also, I recommend testing this with VoxelGI and ReflectionProbe with a custom ambient color set.
opened here: https://github.com/godotengine/godot/issues/83593
thanks.