The Skylight Renderer is a new Module for the PixelFlow Library (https://github.com/diwi/PixelFlow).

It can be applied onto any existing Processing Sketch (P3D) with only a few extra lines of Code (Scene Bounding Sphere and a render callback).

Examples: https://github.com/diwi/PixelFlow/tree/master/examples/Skylight

 

Features

The Skylight Renderer generates correct Shadows (anything from soft to hard) and global Ambient Occlusion. It may take a couple of frames to get a noise-free frame, but for small scenes it works in realtime and allows for interactive and dynamic scene updates, e.g. Physics Simulation, etc…

What it cant provide, at least at the moment, is Global Illumination, advanced Materials as well as any other light sources than Sun and Sky.

 

 

Technique

Multiple Shadowmaps are accumulated (using temporal averaging) which results in correct global Ambient Occlusion.

For the Sun, the sample directions (yellow dots in the video) are focused to a certain direction. For hard shadows a narrow distribution is used, for soft shadows a very wide distribution.

The Sky samples (blue dots in the video) work exactly the same, except that the samples are distributed uniformly over the Bounding Sphere of the Scene.

Both accumulation buffers are combined for the final rendering.