---
title: "Light Path Expressions"
canonical: "https://documentation.chaos.com/space/VC4D/116850698/Light%20Path%20Expressions"
format: markdown
---
This page provides information about Light Path Expressions.


## **Overview**

---



<span style="color: #000000">**Scene Setup**</span>

---

<span style="color: #000000">The scene setup is similar to the Light Select workflow. As LPEs are a mode of the Light Select render element, the expression captures contributions of the light(s) added to the Light Select set. If the Light Select is empty, the expression captures contributions for all scene lights.</span>

<span style="color: #000000">LPEs also allow extracting information from the environment, for example, capturing the GI that comes from the environment only. This does not require adding lights to the Light Select set.</span>



## <span style="color: #000000">**Syntax**</span>

---

The LPE syntax is based on regular expressions.

Expressions describe a light path that starts from the camera and traces all light bounces to a light source.

Essentially, the syntax follows the direction in which a ray travels in the scene and captures information along the ray path.

Keep this information in mind, as light in the scene travels from the light source to the camera, but the expression is in reverse, following the path of the rays shot from the camera.

For example, if you need to capture GI that bounced off of one object onto another, the light will travel from the light onto the object that casts GI, then onto the object that receives GI, and end at the camera. But in LPEs, just like in ray tracing, the expression will be in reverse, starting from the camera, asking for what object receives GI, then what object casts the GI and end at the light source.


<span style="color: #000000"> </span>

## <span style="color: #000000">  </span><span style="color: #000000">**LPE Symbols**</span><span style="color: #000000">  </span>

---

<span style="color: #000000">The LPE alphabet consists of the symbols representing a ray event/type and additional regular expression symbols (“.”, “+”,“*”, “<”, “>”, “[“, “]”, “|”, “?”, “^” and additional label strings). </span>

<span style="color: #000000">A valid expression starts from the camera (</span><span style="color: #000000">**C**</span><span style="color: #000000">), captures ray spawn and scattering events, and ends at light (</span><span style="color: #000000">**L**</span><span style="color: #000000">), emissive object (</span><span style="color: #000000">**O**</span><span style="color: #000000">), or the environment (</span><span style="color: #000000">**B**</span><span style="color: #000000">).</span>


<span style="color: #000000">Ray spawn events other than </span><span style="color: #000000">**C**</span><span style="color: #000000"> or V can be combined with scattering types (e.g. </span><span style="color: #000000">**<RD>**</span><span style="color: #000000"> - capture only diffuse reflection) to get a more specific ray event, or they can be used directly (e.g. </span><span style="color: #000000">**R**</span><span style="color: #000000"> - capture reflections of any scattering type. This is also equivalent to </span><span style="color: #000000">**<R.>**</span><span style="color: #000000">)</span>

<span style="color: #000000">Ray termination events can also be combined with each other when you want to capture the contribution of a light together with emissive objects, e.g., </span><span style="color: #000000">**C<RD>.*[LO]**</span><span style="color: #000000"> will capture the GI coming from lights or emissive objects.</span>

<span style="color: #000000">See a full list of LPE Symbols:</span>

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (legacy-content)




## **Presets**

---

<span style="color: #000000">A number of presets are available for Light Path Expressions.</span>

<span style="color: #000000">There are preset equivalents to already available render elements (like Beauty, Lighting, GI, Light Select types, etc).</span>

<span style="color: #000000">The Misc and masking presets are useful in common-use cases.</span>

<span style="color: #000000">Any preset can be used as a starting point for building other expressions, and like any LPE, they can be combined with </span><span style="color: #000000">[boolean operations](https://docs-chaos.atlassian.net/wiki/spaces/VC4D/pages/116850698/Light+Path+Expressions#LightPathExpressions-Booleanoperations)</span><span style="color: #000000">.</span>

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (legacy-content)

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (legacy-content)

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> 
> 
> 
> > Macro (legacy-content)

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> 
> 
> > Macro (legacy-content)

## **Boolean operations**

---

Boolean operations allow us to combine expressions. We can complement (**^**), intersect (**&**), or unite (**|**) expressions, or we can subtract (**-**) one expression from another.

Boolean operations can also be very useful in a number of scenarios to simplify the compositing workflow.


> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (legacy-content)