-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Fog aerial perspective does not blend seamlessly into the sky #97803
Comments
More likely the Radiance map isn't large enough, and is also filtered, so blue and red mix instead of picking one or the other, which due to an insufficiently large Radiance map size is very obvious in this case, whereas a larger radiance map would just turn magenta on a line on said spheres instead, with the upper and lower parts actually going their read and blue respective ways. |
Hmm, could be, but then the effective resolution after filtering is extremely low. Here's the same scene with a tall white plane added behind the spheres: Even at 135° vertical FOV, the plane still doesn't reach the right colours at its endpoints: (I turned off ambient lighting on its material to make sure that the very soft gradient does not come from global illumination. In fact, without fog, the plane is black because the sun illuminates it from behind.) Adding a fully reflective sphere (metallic = 1.0, roughness = 0.0) shows that the radiance cube map has plenty of resolution to give a sharp line: |
Aerial perspective chooses a mipmap level based on the distance from the camera. So pixels on the far plan will read from the highest resolution mipmap and pixels on the near plane will read from the blurriest mip level. This is done to emulate atmospheric scattering (which is what Aerial perspective is). I think the documentation should be clearer about this |
You probably want something like #89995, although it'll have to be a new option to avoid breaking compatibility. |
Thanks for your responses! @clayjohn is of course right that aerial perspective != blending with sky. The documentation should be clearer about this. Maybe, rather than having a boolean that just forces the highest resolution mipmap, it could be a slider like "mip bias":
This is not more difficult to implement, and gives the user even more control over the effect. |
Tested versions
v4.3.stable.mono.official
[77dcf97], also onv4.3.stable.arch_linux
.System information
Godot v4.3.stable.mono - Arch Linux #1 SMP PREEMPT_DYNAMIC Wed, 04 Sep 2024 15:16:37 +0000 - X11 - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (amdgpu) - 13th Gen Intel(R) Core(TM) i7-13700K (24 Threads)
Issue description
The documentation for
Environment::fog_aerial_perspective
says:So if this is set to 1.0, I would expect the fog to be the same colour as the sky. In places where fog density approaches 100%, I would expect to see the sky colour, as if the object has become transparent.
However, that's not what is happening:
This screenshot was made with a
PanoramaSky
consisting of blue at the top and red at the bottom. Fog density is set to 0.3, and aerial perspective is set to 1.0. The spheres have a green albedo. However, in the distance, the spheres do not become red/blue, but rather an intermediate magenta colour.From a cursory glance at the code, it seems that the shader is reading from the radiance cube map to do its thing. Could it be that it's reading from the wrong mip level, causing too much blending between the colours? That's just a wild guess though.
Steps to reproduce
Just open the attached MRP, which consists of the above scene.
Minimal reproduction project (MRP)
AerialPerspectiveTest.zip
The text was updated successfully, but these errors were encountered: