Saturday, August 29, 2015

Depth fog - it makes a difference

Depth fog is the obscuring of objects based on how far they are from the viewer, eventually blending them into the background entirely. Here's a picture of Playform in all its depth-foggy glory:

Ahh.. Playform at dawn

Here's a roughly side-by-side example of the change. I'm unreasonably proud of how this looks.

Without depth fog

With depth fog

Depth fog adds a lot! The code change is incredibly shallow (heh), with only a few extra lines in the shader for a simple exponential drop-off in visibility. I spent much more time tweaking the constants and the curve than I spent writing the code, and that's a nice place to be working in.

It definitely helps me get a sense of distance, and ideally the fog would be tweaked such that the objects at the furthest edge of the viewing distance aren't visible at all. Then they would fade in gradually as you moved closer, instead of aggressively popping in because they've suddenly been loaded. Right now, the bottleneck on view distance is memory consumption - the GPU crunches through the whole mesh in less than a tenth of a millisecond, but the amount of mesh that fits in memory is a little lackluster.

Stay tuned! Coming up hopefully-soon is voxel brushes, better texturing, and voxel materials. I hear trees are also planning a comeback tour.

No comments:

Post a Comment