www.doriengunnels.com/blog

RSL Notes: illuminate, solar, and illuminance functions and Changing the termination angle of lights

by TheRiverside on Nov.12, 2009, under Renderman II Final Project

Just a few RSL notes…

Illuminance loops:

-Illuminance loops are placed in the surface shader and essentially define how the shader interacts with the light coming from incoming light sources.  There are two forms of this loop:

illuminance(string category“, point position){
statement
}

illuminance(string category“, point position, vector axis, float angle){
statement
}

From the Pixar documentation: “The first form specifies that the integral extends over the entire sphere centered at position. The second form integrates over a cone whose apex is on the surface at position.”

The “cone” created in the second form, is essentially a cone eminating from a position on the surface (usually point P , centered on an axis (usually the surface normal), and spread out using a given angle.  By increasing the cone angle, the user is essentially allowing the sampling of more illumination.  A traditional Lambertian shading model can be defined as:

Nn = normalize(N);
illuminance( P, Nn, PI/2 )
{

Ln = normalize(L);
Ci += Cs * Cl * Ln.Nn;

}

Inside the “luminance” statement, the user is now given access to certain variables:

L – vector – incoming light ray direction
Cl – color – incoming light ray color
Ol – incoming light ray color

Knowing these variables, we can see that the above block of code says:

1) normalize the surface normal N.
2) Check if vector L is detected inside a cone emanating from surface point P (centered on the normalized surface normal and spread using the angle 90 degrees).
3) If L is detected, normalize L. Also, Ci (the apparent surface color of the surface) equals Cs (the actual surface color) times Cl (the light’s color) times the dot product of the normalized N and L vectors.

Changing the termination angle of the light
The angle given in the illuminance loop is always measured in radians. In the code block above, the angle used is PI/2 (90 degrees). This essentially means that the light will stop illuminating the surface 90 degrees from the direction the light is pointing. In the case of a sphere, half the sphere will be illuminated. If this angle is changed below 90 degrees, the light will unrealistically cease to have an effect before the natural termination angle of 90 degrees. If the angle is changed above 90 degrees, this will cause the light to seemingly wrap around the object. The ability to change this termination angle is extremely useful, especially when working with non-photorealistic rendering.  Theoretically, if the angle were changed to 180 degrees, the entirety of the surface would be illuminated regardless of light position or direction.

Light category string
It is possible for surface shaders to contain more than one “illuminance” statement. The “category” string given at the beginning of both types of illuminance loops will state which lights will affect the surface in the way given by that particular illuminance statement. The category is given to the light in the light shader using a flag ” __category” (”category” preceded by two underscores). For example:

light
spotlightWrapper(

float intensity = 1;
color lightcolor = 1;
point from = point “shader” (0,0,0);
point to = point “shader” (0,0,1);
float coneangle = radians(30);
float conedeltaangle = radians(5);
float beamdistribution = 2;
string __category = “wrapper”;

)
{

(body)

}

The category is then called in the surface shader like this:

illuminance(“wrapper”,P, n, PI/2 ) {

Ln = normalize(L);
Ci += Cs * Cl * Ln.Nn;

}


“Illuminate” and “Solar” functions:

These two statements are defined in the light shader.  Like the “illuminance” statement, the user is given access to vector L (the light’s direction) and color Cl (the light’s color).

“Illuminate” function

This function is used when defining light coming from a localized light source (ie: spot lights, point lights, etc.)  and the arguements essentially define a 3d cone eminating from the light source.  Again, there are two forms to this statement:

illuminate( point position )
statement

and

illuminate( point position, vector axis, float angle )
statement

From the Pixar docs:
“The first form specifies that light is cast in all directions. The second form specifies that light is cast only inside the given cone. The length of L inside an illuminate statement is equal to the distance between the light source and the surface currently being shaded.”

Essentially, the arguments say:

The lightsource illuminates from point position, aimed down vector axis, and is spread by angle (measured in radians).  In the first form, since light is being cast in all directions, the statement only needs point position.

“Solar” function

The “solar” function is called when illuminating a surface using a directional light (distance light).  With this type of light, there is not point from which the light is emanating.  Instead, a wall of light is coming evenly from a particular direction.

solar( )
statement

solar( vector axis, float angle )
statement

From the Pixar docs:
“The first form specifies that light is being cast from all points at infinity (e.g., an illumination map). The second form specifies that light is being cast from only directions inside a cone.

An example of the solar statement is the specification of a distant light source:

solar( D, 0 )
Cl = intensity * lightcolor;

This defines a light source at infinity that sends light in the direction D. Since the angle of the cone is 0, all rays from this light are parallel.”


3 Comments for this entry

1 Trackback or Pingback for this entry

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...