Skip to content

jan-van-bergen/SphericalHarmonicLighting

Repository files navigation

Spherical Harmonic Lighting

An experimental project to explore global illumination techniques that use Spherical Harmonics.

Features

  • Radiance is calulcated per vertex. The transfer function takes into account the surface normal for direct diffuse lighting. It also takes into account indirect shadowing. This is achieved by performing a raytracing precalculation step.
  • Diffuse as well as Glossy BDRF support.
  • Interreflection, called Self-Transfer in the original paper but in this implementation different objects can affect each others transfer functions.
  • Raytracing is accelerated using a BVH.
  • Spherical Harmonic coefficients can be efficiently rotated using recurrence relations as described in a paper by Ivanic.
  • Lighting is performed on the GPU. The Spherical Harmonic coefficients are stored in a Texture Buffer Object.
  • The engine supports two different types of Light. The first is a simple directional light, the calculation of which is fully synthetic. The second is a probe light, which is based on a provided light probe image, such as those found at http://www.pauldebevec.com/Probes.

Images

Default Diffuse Lighting

Note the soft shadow being cast from the monkey head onto the ground.

Default Lighting

HDR Probe Diffuse Lighting

Rendered using the Grace Cathedral light probe.

HDR Probe Lighting

Default Glossy Lighting

Default Glossy

HDR Probe Glossy Lighting

Rendered using the Grace Cathedral light probe.

HDR Probe Glossy

Diffuse Interreflection

Note the ambient lighting that is being reflected from the green cube and the red floor onto the monkey head.

Diffuse Self Transfer

Glossy Interreflection

Note the ambient lighting that is being reflected from the green cube and the red floor onto the monkey head.

Glossy Interreflection

BVH

A debug rendering of the BVH (Bounding Volume Hierarchy) structure used to raytrace the monkey head mesh.

BVH

Building

The project should work out of the box with Visual Studio 2017 or above.

The program makes use of .dat files to store the transfer coefficients of each model. These files are not included in the git repository and will be reconstructed upon running the program for the first time. This process might take a little while to complete.

Dependencies

  • Assimp
  • GLEW
  • GLM
  • SDL 2
  • STB Image

References

About

Global Illumination using Spherical Harmonics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages