User:Bnrayner/sandbox

A Light Path Expression (LPE) is a regular expression notation used in 3D computer graphics to describe the light transport and scattering events that take place as light travels from a light emitter to a light sensor.

Light path regular expressions were first introduced by Paul Heckbert in 1990 as a generic means for describing the light paths generated by different sampling strategies such as ray tracing and photon mapping. Eric Veach formalized this notation in 1997 to aid in the description of complex light transport mechanisms such as bidirectional path tracing and Metropolis light transport.

Functionally, LPEs can be used to declare output images for digital compositing. This allows artists to more easily create visually pleasing or non-physical effects. Light Path Expressions are similar to Arbitrary Output Variables (AOVs) in that they separate the primary render into individual framebuffers, however AOV separation tends to be handled locally by the material shader while LPE separation is handled globally by the rendering engine. LPEs are also restricted to describing physical light paths while AOVs can output arbitrary data such as surface normals or intersection depth.

LPE notation is goverend by an abbreviated event syntax that closely corresponds with 3D computer graphics terminology.

Events
Light transport can be represented by combining emission, scattering, and sensing events. Emission and sensing are treated special because a single light path must contain exactly one of each; all relevant paths start with light emission and end with a light sensor. A single light path can contain zero or more scattering events.

Each scattering event can be described as   where   is the scattering type,   is the event mode and   is a scene handle. The scattering type indicates whether light is reflected or transmitted by a surface, or if the interaction was volumetric. Event modes characterize each BSDF interaction as being either diffuse, glossy, or specular. Scene handles allow light paths to be tied to a particular scene entity.

Lights emission events can be described as   where   is the emission event and   and   are the same as before. Light sensors do not have a mode or handle and can simply be described as  .

A light path can thus be described as a chain of scattering events sandwiched between an emission and sensing event, e.g.      

It is equally valid to describe light path as bouncing in either a forwards (lights to eye) or a backwards direction (camera to lights). Thus   is equivalent to  

Tokens
Many renderers have developed slightly different event syntax.

Notes: H&V does not differentiate between transparency and specular transmission. H&V does not differentiate between light emitting object and other area lights. Directional lights are considered as being part of the environment/background light.

Beauty
The beauty is the primary output of a render and contains all possible light paths. As the primary output, a LPE is generally not required; nevertheless, it can be expressed as:

Alternately, you can render a beauty image without primary environment visiblility:

Diffuse Reflections
Direct diffuse lighting is typically referred to as simply 'diffuse' lighting.

Indirect diffuse lighting is sometimes refereed to 'diffuse irradiance' and corresponds to finalgather.

Glossy and Specular Reflections
Glossy and specular reflections are often grouped together. The direct path may be described as the 'highlight'.

Indirect glossy and specular reflections.

Transmission
All transmission paths.

Volumetric
Volumetric interactions are often buried within transmission paths. Nevertheless:

Emission
Note: LpE has no output

Langer & Zucker 1997 http://code.google.com/p/openshadinglanguage/wiki/LightPathExpressions