Make depth fog aerial perspective use the first radiance mipmap
This makes the depth fog fade directly to the sharpest possible version of the sky, as opposed to a blurred version that is less suitable for open world fog fading.
Subtle differences may still be noticeable when using a sky material with nearest-neighbor filtered textures, as it's always sampled with bilinear filtering. I've been wondering how we can improve upon this (perhaps with a project setting to adjust this sampler like https://github.com/godotengine/godot-proposals/issues/8063), but it's not too noticeable in practice if your Camera3D's Far property is adjusted to match the fog's end distance. Doing so is also beneficial for performance anyway.
Given this makes https://github.com/godotengine/godot/pull/84792 a lot more useful for open world games and affects visuals of projects using that feature, it would be good to get this in for 4.3 if possible :slightly_smiling_face:
The appearance of exponential fog isn't affected by this PR.
- This closes https://github.com/godotengine/godot/issues/97803.
Testing project: test_fog_sky_fade.zip
Preview
Forward+
| Before | After |
|---|---|
Mobile
Fog aerial perspective appears darker in general (both without and with this PR), similar to its screen_texture issue where screen contents appear darker.
| Before | After |
|---|---|
Compatibility
Fog aerial perspective isn't implemented yet in the Compatibility rendering method.
This is an interesting proposal. On the one hand, it allows users to trivially fade objects into the background (albeit in a much more expensive way than just using ALPHA). On the other hand it breaks atmospheric perspective which is a cheap way to simulate sky light scattering through fog. If the far plane just uses the sky value exactly, then it will always appear to do a non-foggy fadeout near the far plane.
On the one hand, it allows users to trivially fade objects into the background (albeit in a much more expensive way than just using ALPHA).
I thought this approach would actually be faster, since no objects go through the transparent pipeline. Also, you avoid any transparency sorting issues that would otherwise occur, and you're not locked out from features such as SSR appearing on those materials.
If the far plane just uses the sky value exactly, then it will always appear to do a non-foggy fadeout near the far plane.
I've tested this on master, but while blur is reduced in this situation, it's not using the first mip as I'd expect (and is therefore still blurrier than intended):
| PR | master |
|---|---|
Fog Depth Begin is set to 20, Fog Depth End is set to 40 and Camera3D's Z Far is set to 40.
I've tested this on
master, but while blur is reduced in this situation, it's not using the first mip as I'd expect (and is therefore still blurrier than intended):
Maybe blurrier than intended if you are intending this to a fadeout to the sky. Again, aerial perspective simulates the sky light dispersing through fog. It is not a simply a blend with the background.
I have nothing against implementing a feature to allow depth fog to blend to the background sky color, but isn't what aerial perspective does. In my opinion, we shouldn't be removing a feature while adding another. If we are serious about using fog to implement a general purpose blend to sky value for far plane fading, then I think that we should do it in a way that doesn't hijack an existing feature
What if we make the aerial perspective toggle-able between the current one and this one from the fog property?