Skip to content

voithos/godot-precomputed-atmosphere

Repository files navigation

Godot Precomputed Atmosphere

Screenshot

A compute shader implementation of precomputed atmospheric scattering, largely based on the paper "A Scalable and Production Ready Sky and Atmosphere Rendering Technique" by Sébastien Hillaire.

This project implements real-time sky rendering, including automatic IBL via godot's sky shader support. In addition, it includes a Compositor effect that applies aerial perspective and an exponential height fog effect based on aerial perspective.

Currently, this does not implement proper space views.

Built in Godot v4.4.1. Older versions haven't been tested, but at least v4.0 is needed since this requires compute shader support.

Demo

screencast.mp4

Controls

The example scene provides a few convenience controls:

  • WASD - movement
  • Left mouse - rotate
  • Right mouse - elevate / descend camera (nonlinear)
  • Middle mouse - move sun position

Performance

I ran a quick, non-comprehensive performance profile using NVIDIA Nsight Graphics on an RTX 4090. The LUT generation dispatches took the following amount of GPU time:

  • Transmittance LUT - 0.007424ms
  • MS LUT - 0.174304ms
  • Skyview LUT - 0.008256ms

GPU profile

This is not reflective of final performance impact, as it doesn't include the sky draw pass nor aerial perspective pass, and Godot itself does a lot of extra passes to generate radiance cubemaps from the sky shader.

In addition, the transmittance and MS LUTs don't need to be re-rendered each frame unless the atmospheric parameters change (note, sun direction is not one of these!), so disabling those passes if params haven't changed would be an easy optimization.

Attribution

About

Compute shader implementation of precomputed atmospheric scattering in Godot.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published