Skip to content
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

Vulkan: Fixed Fog is no longer radial and fades according to the view plane instead #52707

Closed
mrjustaguy opened this issue Sep 15, 2021 · 1 comment · Fixed by #53196
Closed

Comments

@mrjustaguy
Copy link
Contributor

Godot version

v4.0.dev.custom_build [5a612d6]

System information

Windows 10, Vulkan, Nvidia Quadro K2000 461.92

Issue description

Fog is no longer radial, as opposed to Fog in 3.x

(3.x)
Fade

In 3.x, the Fog fade is like in the picture, while in 4.0 the Fog fades in a linear fashion (like the camera far cuts off, also visible in the picture)

The Radial Fog is important because the angle of the camera doesn't affect how foggy something is, only distance matters, while without Radial Fogs rotating a camera can reveal things that are supposed to be foggy

Steps to reproduce

Create a Scene with Fogs in 3.x and Master and observe the behaviors of the 2 Fogs when rotating the camera with objects in the Fog

In Master, the fog level of objects will change as the camera rotates, but in 3.x it will not.

Minimal reproduction project

No response

@clayjohn
Copy link
Member

I guess the difference is just that in 3.x we us the distance to a given point while in 4.0 we just use the camera-space z value

GLES3:

float fog_z = smoothstep(fog_depth_begin, fog_far, length(vertex));

Master:

float fog_amount = 1.0 - exp(min(0.0, vertex.z * scene_data.fog_density));

Note for whoever works on this:
Fog in master is calculated in multiple places:

  • scene_forward_clustered.glsl
  • scene_forward_mobile.glsl and
  • sky.glsl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants