godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.43k stars 21.27k forks source link

Looking through fog volumes shows scene depth undesirably #71430

Open ettiSurreal opened 1 year ago

ettiSurreal commented 1 year ago

Godot version

v4.0.beta12.official [3c9bf4bc2]

System information

Vulkan Forward+

Issue description

The issue is somewhat difficult to explain for me, please understand.

When one looks at a scene from behind or within a fog volume (or a light contributing to the volumetric fog), the scene depth can be seen, in this case being very much an undesired effect, letting the player see further than intended.

I made a simple scene to demonstrate the issue, and recreated it in Blender to show how i intended it to look like.

With the volumetric fog Godot produces, you can clearly see the contours of the structure and the edge of the plane it's sitting on, despite the light not reaching that far and there being no other lights in the scene, apart from the red one on top of the structure. image

With the result i made in Blender, you cannot see the world border and the structure contours (the red light exists to show that it is still there). Please know that Blender was only used here to show how i intended the fog to look like, and not to compare the rendering of the two softwares. image

Please, let me know if this is a rendering limitation that cannot/won't be fixed.

Steps to reproduce

In the scene showed in the example the world environment has its background mode set to Custom Color, with the Color being the default pure black, and volumetric fog being turned on in it's default settings.

Both lights have their volumetric fog energy set to 16, but the issue isn't dependent on it.

Minimal reproduction project

An even simpler scene demonstrating the issue, just make sure to disable preview sunlight. scene.zip

clayjohn commented 1 year ago

Can you please upload an MRP so contributors can test and confirm whether they can reproduce this bug?

ettiSurreal commented 1 year ago

Can you please upload an MRP so contributors can test and confirm whether they can reproduce this bug?

Uploaded a very simple scene file with the issue, since it's entirely visual. You just need to disable preview sunlight since it doesn't get saved in the scene file.

Calinou commented 1 year ago

This is because volumetric fog has a limited length (64 units by default). You can increase this length, but this will decrease volumetric fog precision unless you increase volumetric fog depth in the advanced Project Settings (which has a performance cost).

If you wish to fully occlude distant objects, use non-volumetric fog at the same time as volumetric fog. This will need https://github.com/godotengine/godot-proposals/issues/5625 to be implemented though.

ettiSurreal commented 1 year ago

This is because volumetric fog has a limited length (64 units by default). You can increase this length, but this will decrease volumetric fog precision unless you increase volumetric fog depth in the advanced Project Settings (which has a performance cost).

If you wish to fully occlude distant objects, use non-volumetric fog at the same time as volumetric fog. This will need godotengine/godot-proposals#5625 to be implemented though.

You may have misunderstood what my issue is, it's that the volumetric fog functionally lets you see in the dark.

The scene from a side angle image Camera view (fog length set to 64) image

The issue can actually be somewhat worked around by decreasing the fog length (10 in this image), but at the expense of only seeing the volumetric fog at a very limited range. image

Though i do think this might be a realtime limitation, as i also easily reproduced the issue in Unreal (though i didn't mess with the settings too much there).