Light Path Expressions#
Light Path Expressions (LPEs) select the light-transport paths accumulated into a RenderVar. Use them to split a Path Tracing image into compositing passes such as diffuse reflection, glossy reflection, emission, direct light, or caustics.
One Path Tracing image separated into beauty and four LPE outputs. Each LPE contains only the light-transport paths matched by its expression.#
LPEs are available in PathTracing mode. Author each expression as the
sourceName of a RenderVar, set its sourceType to lpe, and target
the RenderVar from the RenderProduct’s orderedVars relationship.
Syntax#
An LPE is a regular expression over the events along a light-transport path.
Expressions can run from the eye or camera (E) to a light (L), or in
the reverse direction. Every expression, including every branch of an
alternation, must contain exactly one eye marker and one light marker.
A scattering event combines an interaction type and scattering mode inside
angle brackets. For example, <RD> means diffuse reflection, <RG> means
glossy reflection, and <TS> means specular transmission. An optional
single-quoted label restricts an event to a named scene object, as in
<RD'ground'>.
Read E<RD>.*L from left to right as:
Start at the camera (
E).Match a diffuse-reflection event (
<RD>).Match zero or more additional scattering events (
.*).End at any light (
L).
Terminal Tokens#
Token |
Category |
Meaning |
|---|---|---|
|
Path endpoint |
Eye or camera vertex. |
|
Path endpoint |
Any light. |
|
Light subtype |
Area light. RTX currently produces this marker. |
|
Light subtype |
Environment or background light. RTX currently produces this marker. |
|
Light subtype |
Point light. This marker parses but RTX does not currently produce it. |
|
Light subtype |
Matte lookup or backplate light. This marker parses but RTX does not currently produce it. |
|
Light subtype |
Emissive volume. This marker parses but RTX does not currently produce it. |
|
Path endpoint |
Irradiance marker. |
|
Event type |
Reflection. |
|
Event type |
Transmission. |
|
Event type |
Volume scattering. |
|
Scattering mode |
Diffuse scattering. |
|
Scattering mode |
Glossy scattering. |
|
Scattering mode |
Ideal specular (delta) scattering. Rough specular reflection or transmission is classified as glossy ( |
|
Label |
A geometry or light label authored in USD. |
|
Wildcard |
Any ordinary scattering event; it does not match the special |
Operators And Quantifiers#
Syntax |
Meaning |
|---|---|
|
Match |
|
Match either |
|
Match zero or one occurrence of |
|
Match zero or more occurrences of |
|
Match one or more occurrences of |
|
Match exactly |
|
Match between |
|
Match at least |
|
Group a subexpression. |
|
Match any member of a set, such as |
|
Match anything except members of a set. |
|
Complement the complete expression. Complement is valid only at the top level. |
|
Match paths accepted by both expressions. |
|
Declare a reusable expression variable. |
|
Use a previously declared expression variable. |
Quantifiers bind most tightly, followed by concatenation, then alternation.
<TS> is one specular-transmission event; unbracketed TS means two
consecutive abbreviated events.
Common Expressions#
Expression |
Output |
|---|---|
|
All light paths. |
|
Diffuse reflection visible from the camera. |
|
Glossy reflection visible from the camera. |
|
Caustics. |
|
Directly visible emission. |
|
Indirect illumination with at least two scattering events. |
Labels#
Labels restrict an event to named scene elements. Author
primvars:omni:label as a uniform token on geometry and omni:label as a
uniform token on lights. For example, E<RD'ground'>.*L selects diffuse
reflection at geometry labelled ground, while E.*<L'key'> selects paths
ending at a light labelled key.
Read And Visualize Outputs#
After stepping the RenderProduct, map each LPE output like any other camera RenderVar. LPE outputs use the same linear floating-point image representation as HdrColor. See Python: Light Path Expressions for a runnable example that reads, converts, and displays all requested outputs.
Limitations#
A RenderProduct can request at most nine LPE RenderVars. Additional LPEs are ignored.
LPE outputs are supported only in
PathTracingmode.Leave
omni:rtx:pt:radianceCache:enableddisabled when LPE outputs must be complete. When it is enabled, cached contributions remain in beauty but are omitted from LPE outputs because they do not retain path history.Area (
La) and environment (Le) light markers are produced. Point (Lp), emissive-volume (Lv), and matte (Lm) markers parse but do not currently match renderer contributions.Volume-scattering events are currently classified as glossy (
VG).