Introduction to Light Path Expressions

beauty 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.

Important: It is recommended that you familiarize yourself with Light Path Expression AOVs first.

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

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.

Beauty: C.* Diffuse Albedo: C<RD>A Diffuse Direct: C<RD>L Diffuse Indirect: C<RD>[DSVOB].*
Diffuse: C<RD>.* Direct: C[DSV]L Emission: C[LO] Indirect: C[DSV][DSVOB].*
Specular Direct: C<RS>L Specular Indirect: C<RS>[DSVOB].* Specular: C<RS>.* SSS Albedo: C<TD>A
Direct: C[DSV]L Indirect: C[DSV][DSVOB].* SSS: C<TD>.* Transmission: C<TS>.*

LPE (diffuse) 'CD<RD.' viewed in Arnold IPR Window

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.

specular, transmission: C[ST].*[LO] transmission: C[T].*[LO]

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

direct + specular + atmoshere_volume: C[DSV]L diffuse: CD.*L
emission: C[LO] emission + emission_indirect: C.*O

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.

Note: RGBA has been used in this example, but you can use any other LPE.

Key light AOV: RGBA_white Rim light1 AOV: RGBA_magenta Rim light2 AOV: RGBA_blue

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

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

Custom AOV with LPE added in its Attributes

Note: 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 specular only