Documentation



Menu

LPE Grammar

This section provides a more detailed look at the grammar used to construct LPEs. There are individual sections on specific usage notes and a glossary of valid LPE operators.

LPE Events

Each event of an LPE, i.e. each interaction of light with the scene objects and materials, is described by its type (e.g., emission or reflection), the mode of scattering (e.g., diffuse or specular), and an optional handle. A full event is described as < t m h >, where:

Spaces are ignored unless they occur inside a handle string. The dot character (.) may be used as a wildcard in any position and accepts any valid input. For example, a diffuse reflection event may be specified as < R D . > or, omitting the handle, as < R D >. A specular transmission event identified with the handle "window" may be specified as < T S ’window’ >.

Handles

Handles are strings of ASCII characters, enclosed in single quotes (). The following characters must be escaped by prefixing them with a backslash inside handles: \, , and ".

Sets and Exclusions

As an alternative to the type, mode, and handle specifiers described above, each position of the event triple may contain a character set enclosed in square brackets. Any element of the set will be accepted. For example, < [RT] . . > matches all reflection events and all transmission events.

The complementary set is specified by first including the caret (^) character. For example, < . [^S] > matches any non-specular event and < . . [^’ground’] > matches any event that is not identified with the handle "ground".

Event sets also work on full events. For instance, [ <RG> <TS> ] matches glossy reflection and specular transmission events. Note that this is different to < [RT] [GS] >, which accepts glossy transmission and specular reflection in addition to the events accepted by the previous expression.

Abbreviations

To make specification of LPEs simpler, event descriptions may be abbreviated. An event in which only one of type, mode or handle is explicitly specified may be replaced by that item alone. For example, < R . . > may be abbreviated to R. Likewise, < . . ’handle’ > may be abbreviated to ’handle’. Note, however, the difference between< T S . >, which accepts a single specular transmission event, and TS, which accepts an arbitrary transmission event followed by an arbitrary specular event. Finally, . matches any event (but not the E or any of the L events which denote either end of the LPE).

Abbreviation rules also apply to event sets, i.e., [ < T . . > < . S . > ] reduces to [TS]. Again note that this is different from TS (without square brackets).

Termination Events and Alpha LPEs

Each LPE is delimited by special events for the eye (or camera) and light vertices. These events mark the termination of the light path at either end and must be the first and last symbols in a LPE.

LPEs may be specified starting either at the light or at the eye. All expressions must be constructed in such a way that every possible match has exactly one eye and one light vertex. This is due to the nature of LPEs — they describe light transport paths between one light and the eye. Note that this does not mean that light and eye markers must each show up exactly once. For example, "E (D La | G Le)" is correct because either alternative has exactly one light and one eye marker — "E D La" and "E G Le". On the other hand "E D La?", "E (D | La)" and "E (D | La) Le" are ill-formed as they would match paths with zero or two light markers.

However, when an LPE is applied to an Alpha Render Element, paths that do not terminate on light sources are allowed. This is because alpha is transparent (alpha 0) only for paths that match the provided LPE, meaning that light transport paths which do not reach a light source would always be opaque. This would make it impossible to create object masks as such masks need to be completely transparent when the relevant objects are hit by camera rays. To create masks, all such paths need to be captured and this requires a special type of LPE, i.e., one that captures terminated paths. Such LPEs are only allowed for alpha channels. For example, the expression "E ([^'crate'] .*)? L?" will render an alpha mask for the object 'crate', where the region of the image occupied by the crate will be completely transparent (alpha 0) and the rest of the image will be completely opaque (alpha 1). It does this by capturing all camera rays which first hit the crate, regardless of whether or not they go on to hit a light source.

Glossary


L Light
E Eye
R Reflection type
T Transmission type
V Volume interaction type
D Diffuse mode
G Glossy mode
S Specular mode
'h' Handle h
< type  mode  handle > Event
Lp Point light type
La Area light type
Le Environment or background light type
Lm Matte lookup type
< light-type  light-handle  mode  handle > Light source full form
< I h > Irradiance marker
type Abbreviation for < type . . >
mode Abbreviation for < . mode . >
handle Abbreviation for < . . handle >
I Abbreviation for < I . >
. Match anything (in context)
[ A ... ] Match any element in set
[ ^ A ] Match all but A
AB A followed by B
A? Zero or one A
A* Zero or more As
A+ One or more As
A{n} A sequence of n As
A{n, m} n to m occurrences of A
( ... ) Grouping
^ expression Complement of expression
expression_1 & expression_2 Match both expressions
name: expression Assign expression to name
$name Use value of name


Page Last Edited: