Introduction to Light Path Expressions

Rollover image for specular LPE AOV

 

Light Path Expressions (LPEs) are useful for outputting light into specific AOVs. LPEs describe the transport of light through the scene, starting from a source of light, bouncing between objects and finally ending up at the camera. LPEs can be used to extract specific light contributions from Arnold into separate built-in or custom AOVs which can be output and recombined in various ways in a compositing package.

It is recommended that you familiarize yourself with 'Light Path Expression AOVs' first. A full list is available here.

The final scene can be found on the Learning Scenes page.

 

Built-in LPE AOVS

Custom AOVs

Light Groups and LPEs

Custom Shaders

Built-in LPE AOVs

LPEs are not particularly artist friendly, and so a list of built-in LPE AOVs are provided in Arnold. Below are some examples of the built-in light path expression AOVs that have been used in this scene.

 

LPE (diffuse) 'CD<L.>' entered in AOV node and viewed in Arnold RenderView

 

Custom AOVs

The built-in AOVs are suitable for most tasks. However, custom AOVs can give more control when using LPEs. For example, you can choose combinations of LPEs to use when rendering the scene.

Example

In the example below C[ST].*[LO] renders Specular and Transmission [ST]. Diffuse (D) has not been used in this case, and therefore the background is not rendered as it only has a diffuse component.

 

Below are some further examples of LPEs used with Custom AOVs.

Light Groups and LPEs

It is also possible to output per light AOVs. Combining light groups with LPEs can be a powerful tool when compositing AOVs. By default, LPEs use all of the lights in the scene. We can limit the light contribution from single or multiple lights using light groups.

  • In this case, we have used the following AOV Light Group names for each light: key light (white), rim light1 (magenta) and rim light2 (blue).
  • We also need to add a custom AOV with a "RGBA_" prefix. For example, the light group name for the blue rim light should be "RGBA_blue".
  • Now we can use the <L.'groupname'> syntax to isolate the specular reflection contribution from the blue light using the following expression C<RS><L.'blue'>.*

For light group AOVs, using <L.> is required instead of just L.

Specular reflection from blue rim light: C<RS><L.'blue'>.*

More information about per-light AOVs can be found on the AOVs and lights page.

Custom Shaders

We can restrict expressions to specific shader parameters. In the example below, C<RS[^'coat']>.* has been used to render the scene without coating. The helmet shader is therefore not apparent in the rendered image when Coat is at 1. However, specular (RS) is visible in the helmet when Coat is below 1.

Helmet is invisible when its Coat value is 1 (rollover image for specular only)

  • No labels