o3de / o3de

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.

Home Page:https://o3de.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deferred Fog Opacity/density controls.

CarbAndrewD opened this issue · comments

Something I've seen that is frustrating is the deferred fog doesn't have a master opacity/density control. Using this component ends up replacing the skybox entirely since the far bound of the fog always ends up at 100% opacity.

I would like to have some more control over the fog density/opacity in a slider or percent value. This would allow the fog to be used without completely overriding the skybox, and allow some nice atmospheric effects that improve the overall look of a project. I think it would also be nice to control the fall off of the fog, perhaps as an adjustable curve or presets.

This could work alongside ticket #17606 which would allow for a bounded fog volume using the same basic deferred fog tools. Having a per entity switch for global or bounded would be extremely helpful.

Fog Opacity is controlled using the start and end distance. The greater the distance between them, the less opacity the fog has (but it always is 100% at the end distance).
Since the problem seems to be the max density for the fog (since it's blocking the Skybox) I added a "Fog Density Clamp" attribute that limits the max value for the fog opacity. I also added 2 new modes for the fog formula, Exponential and Exponential Squared, with a density value that controls the way the density ramps up.
Finally the Fog Layer functionality was enabled for the Mobile pipeline. It's a little more expensive than the traditional deferred fog, but Shader Variants were added when the Fog Layer is on/off. Also, Fog Layer (and Turbulence) are disabled for low and medium mobile devices.