Fog Volume moves when camera rotates

Godot Version

Godot 4.5

Question

I am using a FogVolume and it appears to move unexpectedly when I move the camera.


The following video also shows the fog changing when moving.

Note: the map and its children (the fog, mountains, etc.) are being moved, not the character

Check the documentation about fog volumes:

It gives you some hints on how to alleviate that issue.

1 Like

The issue was that I was adjusting the camera’s Near to remove objects that would be between the player and the camera. This apparently affects the fog in ways as seen in the video.
This causes Godot to:

    1. Shrink the usable frustum
    1. Rebuilds the fog grid starting further away
    1. Changes voxel alignment
    1. Invalidates temporal reprojection

I’m working on an alternative solution to hide large objects that would block the view so that I don’t change the camera’s culling (Near).

I will say that increasing the Rendering > Environment > Volumetric Fog > Volume Depth in Project Settings does make the fog appear “smoother” and removes lines in the fog.

1 Like

If you need objects near the camera to disappear, the default material has a proximity fade option that you can use which will lower the mesh’s transparency if it’s near the camera. Same can be done if you’re using a custom shader.

This works great! Thank you!
Using “Distance Fade” with mode set to ObjectDither does exactly what I want. Now I just need to fine tune it a bit so that it fades only when obscuring the player.