Volumetric Fog

Light Fog

Heavy Fog

Note:
Notice the non-uniform distribution of the fog (certain objects/colors are covered more in the fog than others depending on the location), and the shadow volumes created from a directional light source.

Description

Volumetric Fog Demo

Written in C++, Qt, OpenGL

This project started due to a drive to explore an advanced concept in 3D graphics that I have never done before. Volumetric Fog was one of these concepts that stuck in the back of my mind for years and was now a perfect time to dive right in.

The goal was to learn the concept down to the details so I could recreate and adapt its principles across other areas, when necessary. Simply clicking a checkbox (UE4), writing a script and depend on an engine for lighting/shadow information (Unity), or reuse someone else’s lightmaps (College Course Websites) were not going to suffice if I wanted to truly understand volumetric lighting and fog.

Frustratingly, not a single source would describe the entire concept of volumetric lighting and fog, or cover the ideas needed to recreate it yourself. Using over 8 different resources, I have successfully demonstrated volumetric fog from scratch. While I did not spend time polishing the effect, I now feel confident in the concepts required and have already explored ideas on how to improve for future rendering engines.

For those looking into understanding this effect, here is a list of concepts to research and combine to recreate the effect:

  • Deferred Shading
  • GBuffers (Geometry Buffers)
  • Depth Buffers
  • Lighting/Shadow maps
  • Ray Marching
  • 3D Textures/Buffers
  • Perlin Noise/Fractal Brownian Motion (Not Necessary, But Useful)