Screen Shots

Spherical harmonic lighting is a family of shading models that can perform at various levels of fidelity to the true lighting. It is best adapted to area lights — the more spread out the better.

We have only modelled the diffuse component of lighting, so all the objects look as though they’re made of chalk or matte paper. Specular reflectance components can be added to the SH model at the expense of greater model complexity.

Effect of shading Model

The following sequence of screen shots uses Paul Debevec’s light probe of ‘Galileo’s Tomb’, which has strong light flooding in a window on one side of the scene. As a result the shadows, though soft, are well resolved. The sequence shows successive improvement in fidelity as the model improves. Frame rate at runtime is similar for all three models, as the shadowed and interreflected transfer coefficients are precomputed via ray tracing.

Shading Model Comment Screen shot

 

(click to enlarge)

SH Unshadowed This is a local illumination model, analogous to diffuse OpenGL dot-product lighting. It takes no account of light blocking by objects in the scene — just the geometric orientation of surface elements. Like many CG scenes it feels flat and insufficiently ‘grounded’. ScreenShot - BunnyScene - Unshadowed - Deg8
SH Shadowed This is a global illumination model, which accounts for ray blocking by objects in the scene. The objects are visually more firmly ‘attached’ to the floor, and the scene is much more realistic. However corners and recesses in the scene are much too dark because the model does not account for interreflected light.

 

Some Gouraud shading artifacts can be seen near the base of the red arch. This is due to the relatively sharp shadow there interacting with the finite polygon grid size. The effect is a blocky appearance of the shadow.

ScreenShot - BunnyScene - Shadowed - Deg8
SH Interreflected This enhances the shadowed illumination by accounting for the first bounce of interreflected light, filling in the lighting of corners and recesses in the scene. See especially behind the bunny. There is also some colour bleeding, where light reflected from objects (e.g. the red arch) bleeds onto the white floor.

 

The SH model allows for further bounces of interreflected light, but we have not computed those. The resolution amounts to computing an SH approximation to the Neumann series for the lighting integral equation.

ScreenShot - BunnyScene - Interreflected - Deg8
Interreflected component only The dominant part of the interreflected model is the shadowed SH contribution. This screen shot shows interreflection more obviously, by suppressing the shadowed component. Brightness has been enhanced to see better. Notice coloured light bleeding from objects onto the floor, especially the yellow balls and red arch.

 

Some artifacts can be seen in the form of dirty ‘stripes’ — this is due to sampling error in the ray casting.

ScreenShot - BunnyScene - InterreflectedOnly - Deg8

.

Interreflection Demo

The effect of interreflection is seen more strongly in this test scene.

Shading model Comment Screen shot

 

(click to enlarge)

SH Interreflected Notice the colour from the three ‘satellite’ balls bleeding onto the larger white sphere in the centre. ScreenShot - Balls - Interreflected
Interreflected only This suppresses the shadowed part so that the interreflected component can be seen more strongly. As well as the colour bleeding onto the white sphere, this screen shot clearly shows white light from the central sphere interreflecting onto the ‘satellites’. ScreenShot - Balls - InterreflectedOnly

Scene with desk & chair

In this pair of images is shown a higher polygon count scene (57600 polygons). Lighting uses Paul Debevec’s light probe from St. Peter’s Basilica in Rome, which has very soft even lighting coming from above.

The models are by various graphic artists and were retrieved from the "Free stuff" part of 3dTotal:

  • Desk: Steve Byers. Polygon count 19370. The artist has used one-sided geometry on portions of the desk, which confuses the interreflected transfer. The interreflection code distinguishes between front-face and back-face hits by light rays, and gives incorrect answers on one-sided geometry like this. The back faces are here drawn in wire-frame to deliberately show up these scene portions.
  • Chair: Manolis Gerasidis. Polygon count 23600. The artist uses 2-sided geometry, but the grid tesselation has made many tiny triangles in regions of high curvature (e.g. tubular chair frame) and a few very large triangles in flatter parts such as the seat of the chair. This is satisfactory for the standard local OpenGL lighting model, but gives suboptimal Gouraud shading when shadows are present. The shadows are unable to be properly resolved on the oversize triangles. For adequate shadow resolution, a fine even grid is required.
  • Bin: from Meta3d. Polygon count 1650. The artist has used one-sided geometry on the bin, again confusing the interreflected transfer. The back faces are visible in wireframe. Grid triangulation artifacts are also visible — for instance the lid of the bin consists of a small number of large triangles, and the shadows are noticeably poor on this part of the scene.
Shading model Comment Screen shot

 

(click to enlarge)

Shadowed Areas under the desk get no direct illumination because of ray blocking , so they are rendered too dark.

 

Where the bin sits on the floor, there is a sudden transition from dark (under the bin) to fully lit (just beyond). Gouraud shading on the grid squares making up the floor gives shadow artifacts, visible as a dark blocky smudge under the bin.

ScreenShot - Desk - Shadowed
Interreflected Adding interreflected light fills in the dark areas under the desk. The other artifacts are still present.

 

However the overall effect of the shading is a very still, tranquil scene with natural looking indoor shadows. SH Lighting is especially well suited to the St. Peters light probe because of its soft area lighting.

ScreenShot - Desk - Interreflected

Effect of SH Degree

The following sequence shows the effect of increasing SH degree on a scene illuminated by Debevec’s ‘Galileo’s tomb’ light probe using the SH interreflected transfer illumination model. Higher SH degree leads to higher fidelity shadows, especially in regions where the shadows are sharper. However due to the discontinuous nature of the ray blocking function, the SH approximation is prone to Gibbs’ phenomenon artifacts, which take the form of bright and dark fringes near shadow edges. These are more apparent as SH degree rises.

SH degree Comment Screen shot

 

(click to enlarge)

0 This is analogous to ‘ambient’ lighting in the standard OpenGL lighting model. The scene is very flat looking because light is entering uniformly from all directions. However because the model accounts for ray blocking, it is still reasonably realistic — something like twilight light from a bright sky — the bottoms of objects are still dark, giving a sense of attachment to the surface.

 

1 x SH function x 3 colours. Frame rate 75 fps.

ScreenShot - BunnyScene - Interreflected - Deg0
1 At degree 1, a directional component to the light appears. Some regions are lightened and some darkened relative to deg 0 — see especially the yellow balls. Shadows, though diffuse, begin to acquire a directional component.

 

4 x SH functions x 3 colours. Frame rate 75 fps.

ScreenShot - BunnyScene - Interreflected - Deg1
2 At degrees 2 through 8, the shadows sharpen in regions such as at the base of the red arch.

 

9 x SH functions x 3 colours. Frame rate 75 fps.

ScreenShot - BunnyScene - Interreflected - Deg2
3 Theory tells us that odd SH degrees 3, 5, 7, … should contribute nothing to the shadowed SH model. However presumably because of ray sampling error, plus the effect of interreflection, there is in fact noticeable change at these degrees.

 

16 x SH functions x 3 colours. Frame rate 75 fps.

ScreenShot - BunnyScene - Interreflected - Deg3
4 25 x SH functions x 3 colours. Frame rate 75 fps. ScreenShot - BunnyScene - Interreflected - Deg4
5 For this test scene with 26000 polygons, the frame rate begins to drop as SH degree goes above 4, due to the increasing computational burden on the CPU..

 

36 x SH functions x 3 colours. Frame rate 63 fps.

ScreenShot - BunnyScene - Interreflected - Deg5
6 49 x SH functions x 3 colours. Frame rate 59 fps.

 

This SH degree probably gives the best tradeoff between shadow resolution, frame rate and freedom from Gibbs artifacts. The scene appears very naturally lit — only the lack of surface shininess lets it down.

ScreenShot - BunnyScene - Interreflected - Deg6
7 64 x SH functions x 3 colours. Frame rate 55 fps. ScreenShot - BunnyScene - Interreflected - Deg7
8 In this view, Gibbs’ phenomenon shadow banding artifacts are not noticeable, but they are objectionable at some other scene orientations. SH Degree 6 is probably optimal for this light probe. However degree 8 is still pretty good.

 

81 x SH functions x 3 colours. Frame rate 53 fps.

ScreenShot - BunnyScene - Interreflected - Deg8

Gibbs’ Phenomenon Artifacts

When the light source is small (like sunlight), spherical harmonic lighting performs poorly. Both the visibility function and the lighting distribution then have large discontinuities, which excites "overshoot" wiggles in the SH approximation to the function — Gibbs’ phenomenon. When present, these show up as light and dark bands near the edges of shadows that should be sharp.

The model of the plateosaur is by D. Giordano, downloaded from "Free stuff" area of 3dTotal. Polygons: 16094.

Lighting Model Comment Screen shot

 

(click to enlarge)

SH shadowed This screen shot is deliberately contrived to be a "worst case" for SH lighting. The light source here is a circular "spotlight" of aperture 5 degrees. This should give fairly sharp-edged shadows, so excites Gibbs’ phenomenon when things are SH expanded. The most prominent artifact is a bright fringe around the shadow. But there is a second, broader bright fringe in front of the dinosaur and some darkish bands in between. Since there is no interreflection in this view, these must be artifacts.

 

My belief is that the source of these artifacts is deep in the mathematics and goes something like this. Lighting is a linear functional acting on the scene. The scene visibility function, being uniformly bounded, lives naturally in L(S2), so lighting naturally lives in the dual space L1(S2). However SH theory does L2 approximation to both. In the extreme case, a light distribution may be in L1 but not L2, in which case the SH expansion will not even converge — this is the case e.g. for point source lights. The nearer a lighting environment is to falling out of L2(S2) the more severe will be these convergence artifacts. Effectively SH lighting is confined to dealing with lighting environments that can be well approximated in the L2 sense. To resolve Gibbs artifacts for near-point source lighting requires a fundamental rethink of the mode of approximation — wavelets?

ScreenShot - Plateosaur - Shadowed - Deg8