Light Path Expressions
When working with a rendering software, soon having only the color image as output won’t be enough. A lot of tweaks can be done after the rendering is complete, with photo editing software like Photoshop, or with compositing software like After Effects, NUKE, etc. Examples of tweaks could be overlapping the rendering over an image background, changing the color of a certain light, changing the brightness of caustics, etc. The possibilities are limitless. The reason why it’s done after the rendering is complete is because the rendering can take some time to complete, while image compositing is usually an instantaneous operation.
In order to be able to perform all that compositing work, it is often necessary that the rendering software is capable of outputting more information than just the color image, such as the alpha image(transparency), the Z-buffer, separate light images, and many others, depending on the effects you want to achieve. All these output images are commonly referred as AOVs (Arbitrary Output Variables).
Most rendering software have predetermined set of AOV types, used in the most common scenarios, such as alpha, Z-buffer, etc.
Light path expressions is an idea first developed by Alejandro Conty at Sony Pictures Imageworks as part of Arnold Renderer, and it’s becoming widespread in the rendering industry. It is a simple and elegant solution to express arbitrary AOVs, that is based on regular expressions.
A typical light path expression (LPE) could be: “CD*L”. “C” stands for camera, “D” stands for diffuse, “*” stands for zero or more times, L stands for light. The meaning of the expression is: output the color leaving the light, hitting zero or more diffuse surfaces, and landing on the camera.
Among the many symbols that can be used in LPEs are “G” (Glossy), “S” (Specular), “T” (Transmission), and arbitrary labels.
With this framework, the possibilities offered by light path expressions are limitless.
If you want to learn more about LPEs, here is the wiki page from the inventors: Light path expressions in Open Shading Language.
Edit:
To be more precise, as somebody already noticed, the way of representing light paths using regular expressions was first proposed by Heckbert and then further developed by Veach. Sony provides a particular specification of light path expressions, which is becoming widespread in the industry. They also provide an open source implementation inside the Open Shading Language project.