Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pl-sky

A real-time sky and aerial-perspective rendering prototype built with Pilot Light.

Based on Sébastien Hillaire's A Scalable and Production Ready Sky and Atmosphere Rendering Technique .


Overview

This is an experimental implementation of a physically based planetary atmosphere renderer.

The project follows the general approach described by Sébastien Hillaire in A Scalable and Production Ready Sky and Atmosphere Rendering Technique. It uses several compact GPU-generated lookup tables to render a dynamic sky and aerial perspective without relying on a large precomputed multidimensional scattering table.

This repository is intended to serve as:

  • A readable reference implementation of the technique.
  • A testing ground for atmospheric rendering features.
  • A standalone example of low-level graphics programming with Pilot Light.
  • A prototype from which stable features can later be integrated into the main Pilot Light renderer.

Important

This is a research and development prototype, not a production-ready atmosphere system. APIs, shaders, parameters, and rendering behavior may change as the implementation is refined.

Gallery

Sky Image 0

Sky Image 1

Screenshots and video captures will be added as the prototype is prepared for release.

Features

The current implementation includes:

  • Physically based Rayleigh and Mie scattering.
  • Atmospheric absorption.
  • Dynamic sun direction and lighting.
  • Transmittance lookup table.
  • Multiple-scattering lookup table.
  • Sky-view lookup table.
  • Aerial-perspective 3D lookup table.
  • Depth-aware aerial-perspective compositing.
  • Configurable atmosphere and planet parameters.
  • Runtime regeneration of atmosphere lookup tables.
  • Directional-light shadowing within the aerial-perspective pass.
  • Support for rendering atmospheric light shafts and volumetric shadows.
  • Ground-level and high-altitude camera views.
  • Interactive debugging and parameter adjustment.

The implementation is written as a graphics prototype rather than a direct line-by-line port of the paper's reference code.

Rendering Pipeline

The atmosphere is rendered in several stages.

1. Transmittance LUT

The transmittance lookup table stores the amount of sunlight that remains after traveling through the atmosphere.

It is primarily parameterized by:

  • Observer altitude.
  • Direction relative to the planet.
  • Atmospheric extinction.

This table is reused by the later sky and scattering passes.

2. Multiple-Scattering LUT

The multiple-scattering lookup table approximates light that scatters through the atmosphere more than once.

This is important near the horizon and during sunrise or sunset, where single-scattering-only implementations can appear unnaturally dark or strongly yellow.

3. Sky-View LUT

The sky-view lookup table stores the atmosphere's incoming radiance for the current camera position and sun direction.

The table uses a nonlinear parameterization that allocates additional detail near the horizon, where atmospheric gradients are most visible.

4. Aerial-Perspective LUT

A 3D lookup table stores the accumulated in-scattered light and transmittance between the camera and points at increasing distances.

The volume is sampled using the scene depth buffer to apply atmosphere to rendered geometry.

5. Final Composition

The final passes combine:

  • Scene color.
  • Scene depth.
  • Sky radiance.
  • Aerial-perspective scattering.
  • Atmospheric transmittance.
  • Sun and shadow information.

The resulting image is then passed through the application's normal exposure and tone-mapping pipeline.

Runtime Controls

The prototype exposes atmosphere and rendering settings through its development UI.

Available or planned controls include:

  • Planet radius.
  • Atmosphere height.
  • Rayleigh scattering coefficients.
  • Rayleigh density distribution.
  • Mie scattering and absorption coefficients.
  • Mie anisotropy.
  • Absorption-layer parameters.
  • Sun direction.
  • Sun illuminance or radiance multiplier.
  • Atmosphere density scale.
  • Aerial-perspective distance.
  • Aerial-perspective depth distribution.
  • LUT dimensions.
  • Ray-marching sample counts.
  • Volumetric shadowing.
  • Debug visualization of individual lookup tables.

Some parameters are intentionally more permissive than physically measured Earth values so the prototype can also be used to explore fictional atmospheres.

Requirements

The project uses Pilot Light and its platform and graphics abstractions.

General requirements:

Windows

  • Visual Studio 2019 or newer toolchain
  • Desktop development with C++
  • Vulkan SDK

Linux

  • GCC or Clang
  • Vulkan SDK
  • X11 and XCB development packages

macOS

  • Xcode command-line tools
  • Vulkan SDK for shader compilation and related development tools

Building

This repository is structured as a standalone Pilot Light project. A separate Pilot Light checkout is not required after cloning this repository.

Clone the Repository

Windows

git clone https://github.com/hoffstadt/pl-sky
cd pl-sky
cd src
build_win32.bat

MacOS

git clone https://github.com/hoffstadt/pl-sky
cd pl-sky
cd src
chmod +x build_macos.sh
./build_macos.sh

Linux

git clone https://github.com/hoffstadt/pl-sky
cd pl-sky
cd src
chmod +x build_linux.sh
./build_linux.sh

Binaries will be in the out directory.

About

real-time sky and aerial-perspective rendering prototype

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages