Occlusion and Image-Based Lighting
Image-Based Lighting as implemented in RenderMan needs a few words of explanation to understand how it functions. Understanding how something functions inside, allows us to work more efficiently and avoid common pitfalls. In RenderMan Studio, the Environment Sphere gives us access to these effects. Information on using it, along with comparison images, can be found in the RenderMan Environment Light Fundamental.
Image-Based Lighting is a generic term for using image maps to illuminate scenes. Traditionally this is a ray tracing effect.
Start by thinking about how you would ray trace a reflection of an environment image: from the view of the camera, a ray is fired into the scene, it reflects off the surface. If it does not hit any objects, it makes it into the environment, where it hits our spherical environment map and registers the reflection color. This is how specular reflection works (though RenderMan does this without having to ray trace). It gives view dependent reflections of the environment. What we are really interested in for IBL, however, is diffuse reflectivity.
Image-based lighting uses occlusion in conjunction with something called bent normals and environment map lookups. Most of us are familiar with the standard greyscale occlusion passes. Occlusion works by firing rays in a hemisphere around each shading point on the model. If a ray hits a piece of geometry, it is occluded and returns 1. If it escapes unimpeded into the environment, then it is unoccluded and returns 0. An average, of these ray return values, is taken over the number of samples giving the final occlusion amount; a white-to-black image.
To help understand how RenderMan gets from pure black-to-white occlusion to colored image-based lighting, we need to talk about something called bent normals. So, if we want to do something clever, we can use the occlusion call to calculate bent normals. Internally, these bent normals are calculated at the same time as RenderMan is calculating the occlusion. Essentially, each time a ray escapes unoccluded into the environment, we save the direction it was fired in. After all the sample rays are fired, as we average our unoccluded hits, we also average our unoccluded ray directions. This average unoccluded direction becomes our bent normal and used to look up our environment map color for the IBL.
The image below shows how the normals of our object are bent by occluding geometry. This is not something you will see inside RenderMan (unless you write a bent normal shader): it is only visualized here to help you understand how the IBL works.
Image showing areas where the normals are 'bent'
by occluding geometry. Grey areas are un-occluded.
From here, it is a simple extension to use each of our bent normals to do an environment map lookup. RenderMan is efficient at taking a direction and looking up the color corresponding to a spherical environment map. When the direction is a bent normal and the environment map has high dynamic range, the result is a pleasing and easy-to-setup IBL render.
RenderMan Studio and RenderMan ProServer also have the ability to render occlusion and IBL effects using non ray-traced, point-based approximation. This is an entirely new approach to rendering these expensive ray tracing effects, saving up to 4-5 times the rendertime. For point-based fundamentals see Point-based Occlusion and colorbleeding
HowTos - Rendering Image Based Lighting
Library - Production Ready Global Illumination