Light Path Expressions

iray render elements are specified by Light Path Expressions.

A Light Path Expression (LPE) is a regular expession that describes specific light paths. In the Render Elements interface for the iray renderer, these expressions select only certain light contributions to construct a particular element.

Light Source and Eye Events

To be complete, a Light Path Expression must begin with a light source event and end with an eye event—or the other way around.

E designates an eye event. In 3ds Max, this is the point of view of the active viewport (usually, for renderings, a camera view).

The light source event can specify the kind of light:

Light type Meaning
L Any light
Lp Point light
La Area light
Le Environment or background

For example, the LPE that generates a Light: Area element is La.*E, where the asterisk (*) matches any number of Area light events. The LPE for the Light: Environment element is Le.*E.

The LPE that generates a Mtl: Self Illumination event is LE. In other words, it renders light sources but not interactions of light with objects.

Light Interaction Events

Interaction events describe the interaction between a light ray and a material in the scene. In a Light Path Expression, an interaction event is enclosed in angle brackets, and contains two components: the type and the mode.

The event itself describes the interaction of a ray and an object. There are three types of interaction event:

Event Type Meaning
R Reflection
T Transmission
V Volume interaction

The mode describes the scattering that occurs. And there are three possible modes:

Event Mode Meaning
D Diffuse
G Glossy
S Specular

For example,

<RD>

... describes a simple diffuse reflection.

The "dot" (.) character is a wildcard that matches any type or mode.

<R.>

... describes all the reflections of the event.

You can abbreviate <R.> as R. This applies to any event that specifies only one type or one mode.

Be careful when you read abbreviated code: <RD> describes a single diffuse reflection, while RD describes a reflection event followed by a diffuse scattering event.

To match multiple events, you can enclose them in brackets ([]) to form a set.

[RT] combines a reflection and a transmission event. [DGS] combines all scattering modes. So <[RT][DGS]> is an event that includes reflection and transmission, with all kinds of scattering, excluding only volume interaction.

You can also exclude a type or mode from a set by preceding it with a caret (^).

<[^T].> excludes transmission from the event, and this is equivalent to <[RT][DGS]> or simply <[RT].>.

Operators

You can use a number of operators to combine sub-expressions. These are the operators allowed (A and B represent sub-expressions; m and n represent integer values):

Operator Meaning
AB Matches first A, then B
A|B Matches A or B
A? Optionally matches A. A might not be present in the scene.
A* Matches zero or more occurrences of A
A+ Matches one or more occurrences of A
A{n} Matches n consecutive occurrences of A
A{n,m} Matches from n to m occurrences of A
A{n,} Matches n or more occurrences of A

Operator Precedence

Operators are evaluated according to this precedence:

  1. Quantifiers

    ?, *, +, {}

  2. Concatenation

    AB

  3. Alternatives

    |

You can use parentheses (()) to group sub-expressions and change the order of evaluation. Sub-expressions within parentheses are evaluated first.