Renderman User Documentation
Introduction to Light Shaders: The Occlusion Light Shader



A magic light refers to the process of a light doing more than lighting a scene through a custom light shader. Knowledge of RSL provides the understanding of how a light source actually works.

We know surface shaders operate as subprograms that execute on geometry at render.

Light sources behave the same way.

Lights are shaders containing variables that are called upon by linked surface shaders.

Figure 01: Ambient Light Shader with Occlusion


RSL functions that communicate between surface shaders and light shaders are solar(),illuminate(), and illuminance().

These functions create the light-projecting effect we've come accustomed to.

Since lights are shaders, they are capable of the same RSL functions that surface shaders perform.

Occlusion, color bleed, texture mapping, displacements - anything a surface shader can do a light shader can do as well.

Figure 01 is the simplest light shader - the ambient light.

Ambient lights hold no contraints for their lighting functions - meaning an ambient light source illuminates top and bottom - front and back.

 

Figure 02: Light Shader Tag in .rib


Figure 01 replaces the illumination function with occlusion.

This turns our light into an ambient occlusion shader that effects all linked geometry.

Figure 02 shows the light shader tag in RiSpec.

By default, the occlusion function in RSL generates the invert of ambient occlusion.

Combine this element with the color parameter and recieve a fake color bleed effect - Figure 03.

 

Figure 03: Ambient Light Shader Fake Color Bleed



To produce proper ambient occlusion, invert the occlusion fuction in RSL (subtracting it from 1) and set color to white.

The result is Figure 04 - ambient occlusion.

Figure 04: Ambient Light Shader Ambient Occlusion



Ambient lights illuminate from all directions.

Point lights illuminate from a X Y Z coordinate.

Spot lights illuminate from a X Y Z coordinate into a specific direction.

Refer to the [from] and [to] parameters in the Figure 05 shader.

Figure 05 is a spot light with occlusion.

For experimental purposes, I attached Rman noise to the light source to see the effect - Figure 06. The resulting sequence seen with Figure 07.

Figure 05: Point Light Shader with Occluison













Note: The possibilities with light shaders are limitless. For more zany light shader effects, I recommend Moritz Moeller's Going Mad with Magic Lights.

Siggraph 2006's Renderman for Everyone, Course 25 p62.

Figure 06: Point Light Shader Occlusion and Noise SL



Figure 07: Point Light Shader Occlusion and Noise Sequence