Email Me Course Link
Matrix Level-Of-Detail St Coloration Pattern Animation Fire Shader
Home

Light Wrapping in RenderMan

Light wrapping is the phenomena where the light from a back-lit object partially wraps around to the front of the object. This can be acheived by adjusting the illuminance loop in renderman shaders. Remember by default, the illuminance function only considers lights who's incidence ray falls within a pre-defined hemispherical cone. This hemisphere is defined by an angle of PI/2 from the surface normal.

This Diagram Illustrates the default operation of the Illuminance function. Any normalized ray entering within 90% from the surface normal will contribute to lighting the point. By saying we want light to wrap around the surface, we are really saying that we want the illuminance function to search a wider hemisphere for contributing light. So In the light shader, we would create a new parameter that adds to the angle defining that hemisphere.

In the light shader, a new parameter called "wrapAngle" can be created for querying later. We also create a category called "wrapper" because later, we will let the illuminance loop consider ONLY those lights within that category.

light
wrapper_light(float intensity = 1;
color lightcolor = 1;
string __category = "wrapper";
float wrapAngle = 0;
)

In the surface shader, we will now query the wrapAngle and restrict other lights not belonging to the group "wrapper."

//All points on the surface will sample the
//lights with the category name "wrapper"
illuminance("wrapper", P, n, PI) {

Now we will use the lightsource() function to query each light's "wrapAngle", store it in a variable called "wrap" and add that to a radian angle of 90%. Rays within this angle is added to the final diffuseColor of the surface.


//we can now query the wrapper light's "wrapAngle parameter value
float wrap = 0;
lightsource("wrapAngle", wrap);

vector l = normalize(L);
float dot = n.l;
float radianAngle = radians(90.0 + wrap);
diffuseColor += Cl * smoothstep(cos(radianAngle), 1.0, dot);
}

Below is a quick test showing the result of animating the light wrap parameter in Houdini.

 


Matrix
Level-of-Detail
ST Coloration
Maya Pattern Animation
Fire
Links
Links