Color Occlusion by Spherical Area Lights

January 19th, 2007 by Stefano Jannuzzo - Viewed 14948 times -




Yes, yet another occlusion technique.

The game is pretending no occlusion nor FG/GI tool is shipping with XSI, and do it with what is left, in particular area lights.
In the end, the result is less accurate than the standard ambient occlusion and FG, but, in some ways, more intuitive and flexible.

As we know, the standard techniques sample the hemisphere centered above the normal of a point.
The main idea is to provide ourselves the hemisphere through a large spherical area light surrounding the scene, or just the objects that must be occluded.
Any standard illumination node applied to the objects will sample the light all over the light virtual sphere, regardless of the light center.

oal1.jpg

Setting the light color to white and the shadow color to black, the light intensity hitting a point is actually the ratio of samples “seen” by the point and those hidden by other objects toward the sample location.

In other words, for a large enough light radius, ambient occlusion.

In order to get the pure light color, we apply a flat light node as the surface shader to the receiving objects, with diffuse set to white and ambient to black.
In these tests the light has 20×20 samples, with white color and intensity set to 2, just to average the fact that only half of the samples are visible from any opaque point.

This is the render, before any optimization.

oal2.jpg

The shadow is black, because the torus does not have any shadow shader on.
If we connect the checkerboard color as shadow shader, we magically have color occlusion, which can also be seen as a cheap (but very easy to tune) color bleeding.

oal3.jpg

A couple of advanced notes:

You may want to define your own brdf, in order to have the samples shading the surface.
Instead of having the illumination model attached to the objects, we do it at the light level.
For a standard lambertian model, you just need to take the direction to the current light sample, and dot-product it by the point normal, as shown here.

oal4.jpg

This may be enough, but we can also add some glossiness to the model, by using the dot product as input to a gradient node, so allowing us to weight the samples depending on their incoming direction.
This setting for instance will give more weight to the samples over the point, zero instead for those with a large angle about the normal.

oal5.jpg

Note that the sphere radius must be large, compared to the scene extent.

In fact, if an object is close to the sphere surface, the number of samples visible from the object is smaller, depending on the sphere cap defined by the current rendering point and its normal.

A further adjustment can be made to raise the light intensity as much as the cap area gets smaller.

The same technique may be used for other purposes, for instance for performing a basic image based lighting because the light color can be textured based on the sample position over the light sphere surface.

5 Responses to “Color Occlusion by Spherical Area Lights”

  1. faizol says:

    Hi,
    I can’t seem to reproduce the effect above using a point light, but it works with an infinite light. Could u post just a simple readme type instructions? I’m using xsi6 foundation on linux.

    TIA

  2. thiago says:

    Interesting technique

  3. Fabio Lissi says:

    Ma quante ne sai ?!?!.

    English translation:

    But how much do you know ?!?!.

    Fabio

  4. Jim Bowers says:

    I used the basic AO/overcast technique for years (without the fancy colour bounce), before FG and GI was available and in Softimage3D. Nice to be reminded of it. Huge area point lights offset towards the sun’s direction gave some nice results, especially for overcast scenes or fill light. There was a way of using a huge sphere smaller than the area light, textured with a sky dome and using the RGB for transparency, which cast coloured light onto the scene. Area point lights were awesome :) Need to get rid of the dreaded hard jagged shadows on smooth poly objects? Use an area point light thousands of units away. It beat Renderman hands down. Hardly ever used an infinite light.

    Them were the days. Thanks for reminding me of it ;)