Wrapped Diffuse Lighting model

August 24,2002

Background

The classic lamertian lighting model sometimes cannot produce acceptable result because that diffuse falls off too fast. People must light the model with more additional lights to simulate natural lighting. More and more light will truly slow down your render.

Thanks to the powerful RenderMan Shading Language, we can solve this problem by the following trick.

A Lambertian shading model can be expressed like:

Nn = normalize(N);

illuminance( P, Nn, PI/2 ) {

Ln = normalize(L);

Ci += Cs * Cl * Ln.Nn; }

Lamert's diffuse is mutiplied by the dot-production of Surface shading normal(N) and Incoming light ray direction(L). The angle between those two vector = acos(Ln.Nn). When angle > 90 deg, Ln.Nn < 0, thus light cannot reach the surface where N faces away from L.

If we multiply Cl with 1 - acos(Ln.Nn) / wrappedangle, (where wrappedangle is some degree greater than 90 deg )diffuse can now be still greater than 0 when Ln.Nn < 0.

The Wrapped Diffuse Lighting can be expressed as:

Nn = normalize(N);

illuminance( P, Nn, PI/2 ) {

Ln = normalize(L);

Ci += Cs * Cl * (1 - acos(Ln.Nn) / wrappedangle); }

Those upper two image are from same model lighted by a spot light. You can see the difference.

ClickHere for the slim template of the shading model.