godot icon indicating copy to clipboard operation
godot copied to clipboard

Fix ambient_light_disabled render mode flag

Open devloglogan opened this issue 2 years ago • 2 comments

Fixes the ambient_light_disabled render mode, as it currently does not have any implementation in master.

devloglogan avatar Sep 19 '22 13:09 devloglogan

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

clayjohn avatar Sep 19 '22 17:09 clayjohn

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.

Calinou avatar Sep 19 '22 18:09 Calinou

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.

JonqsGames avatar Oct 03 '22 18:10 JonqsGames

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.

nekotogd avatar Oct 18 '22 13:10 nekotogd

Looks great, thanks! And congratulations on your first merged contribution!

clayjohn avatar Oct 27 '22 17:10 clayjohn

I noticed that this does not work for SDFGI (yet another ambient light source). I assume because its done in screenspace somehow?

bertodelrio256 avatar Oct 17 '23 18:10 bertodelrio256

@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.

Calinou avatar Oct 17 '23 21:10 Calinou

opened here: https://github.com/godotengine/godot/issues/83593

thanks.

bertodelrio256 avatar Oct 19 '23 01:10 bertodelrio256