/SHPlayground

A small app to test out spherical harmonic lighting.

Primary LanguageC

SHPlayground

Screenshot

An application which (partially) implements [Sloan 2002] with CUDA acceleration. Radiance self-transfer without interreflection.

Interreflection is also theoretically doable, however I have not implemented BVH and that is extremely slow and janky, so I decided to simply remove it.

Usage

If you are just going to try it out and you are also using Windows with CUDA in path, you can download the executable here.

You can load .obj/COLLADA scenes into the application and visualize them. For a scene to visualize, you will need:

  • A selected model/scene
  • A selected shader
  • A camera
loading_scene.mp4

You can evaluate and visualize envmap coefficient by using SH sampler. Don't forget to reconfigure after you change the SH texture size.

scene_map_reconstruction.mp4

You can evaluate scene coefficient per-vertex and use SH reconstruction shader to visualize. Note that the shader I written only supports l=4 expansion, which means 16 coefficients per-vertex (I have no idea how to pass more than that to shader.) For the SH reconstruction shader to work, you will need:

  • A selected model/scene
  • A selected envmap
  • SH reconstruction shader selected
  • A selected SH sampler (define as current envmap coeffs)
    • envmap coefficient evaluated (16 color bars below aren't just gray)
    • Model/scene coefficient evaluated (Calculate current model/scene coefficient)
  • A camera

For the SH sampler to work, you will first need to press Reconfigure, then Calculate SH. Only then can you evaluate other stuffs, such as envmap coefficent and per-vertex coefficient.

envmap.mp4

Dependencies

Since I used Visual Studio and not CMake, dependencies in the project will be all wrong (absolute paths) and you'll have to fix them (sorry!). Here's a list of dependencies: