|Table of Contents|
In RenderMan, in addition to the built-in AOVs, light path expressions (LPEs), which are adopted from Open Shading Language's Light Path Expression, specify what light transport paths to output to a display channel. In other words, we don't have to modify the shaders or plugins to output a custom AOV that uses the LPE.
The setup is the same as an AOV except we use a light path expression instead of an AOV channel name. Additionally, we can group the outputs by light groups and/or by geometry set up by a lpegroup.
You will find a useful set of video tutorials and discussion of these practices on the RenderMan Community site.
An LPE is made up of tokens which are not the most artist-friendly things. For this reason, we provide a list of LPEs in our plugins that can be easily selected and output. We also provide options on how specific you want to be when it comes to output; from outputting all your direct or indirect interactions at once per type or outputting them per-lobe which provides greater control for advanced workflows.
To better understand how an LPE is constructed, the below tokens are used to define interactions. For most users, the pre-built LPE are easily selected and explained below.
<type event 'group'>
|Scattering event specified by scattering type, scattering event, or lpe group|
|Light, i.e. analytic and geometric lights|
|Emissive object, i.e. camera visible lights and material glow|
|A period will match any relevant event|
|Transmission or refraction|
|Diffuse lobes (D1 to D4)|
|Specular/Glossy lobes (S1 to S8)|
|User lobes used to output material properties (U1 to U12)|
|( )||Parentheses allow grouping of a sequence of LPE events|
||||A vertical bar separates alternatives|
|[ ]||Square brackets that match any one of the enclosed events|
|Square brackets that match any one event not contained within the brackets|
|An asterisk will match the preceding event zero or more times|
|A plus sign will match the preceding event one or more times|
|Curly brackets that match the preceding event exactly n times|
|Curly brackets that match the preceding event min or more times|
|Curly brackets that match the preceding event at least min but not more than max times|
To specify an LPE in RIB, reference a DisplayChannel in the Display. This is the most basic way to view what's being output.
DisplayChannel "color directDiffuse" "string source" ["color lpe:CD[<L.>O]"] Display "myRender.exr" "openexr" "directDiffuse"
LPE tokens are not necessarily the most artist-friendly things. For this reason, we provide a list of LPEs in our plugins that can be easily selected and output. We also provide options on how specific you want to be when it comes to output; from outputting all your direct or indirect interactions at once per type or outputting them per-lobe which provides greater control for advanced workflows.
For basic workflows, the following LPE are recommended. Note that we are specifying the DisplayChannel and a name (which can be most anything). Note that these LPE will collect the light interaction from different lobes of materials and store them in the same AOV. For example: reflections from the Glass Lobe in PxrSurface will be combined with other specular reflections in the direct and indirectSpecular AOVs. This can simplify the outputs.
|Carousel Image Slider|
For example, some PxrSurface materials have a Clearcoat lobe usage may involve the Clearcoat lobe. Normally this is summed under the
S token. Routing this lobe to the
S2 token will allow you to use
S2 in your LPEs. Up to 4 diffuse lobes and 8 specular lobes are available for LPEs. By default,
S1 contains all the specular lobes, so use any higher tokens such as
S2 for your per-lobe LPE's.
|Carousel Image Slider|
For objects that have an LPE group called "collector",
lpe:shadowcollector collects shadows. This may be useful for creating holdouts using a manual workflow.
Caustics are not included in the built-in list because they overlap with
indirectdiffuse lpe:C<RD>[DS]+[<L.>O] However, you can select caustics with the expression
lpe:CDS+[<L.>O] Below you can find an example of the caustics LPE output, Indirect Diffuse, and the difference between them. Note that the Caustics LPE output doesn't capture indirect lighting from object to object, in this case the red cube. You can create the image on the far right with the indirect diffuse minus the caustic result using the following source:
|Carousel Image Slider|
An LPE group (lpegroup) allows us to specify which objects we want to be use for an LPE channel. The attributes can be added in RenderMan plugins using the software's menu system such as PrmanObjectSettings in Katana.
LPE Group Example RIB
Attribute "identifier" "string lpegroup" ["ground"] DisplayChannel "varying color plane2Shadow" "string source" ["color lpe:shadows;C<.[DS]'ground'><L.>"]
Predefined LPE Groups
For the built-in LPE such as shadowcollector, it assumes a predefined lpegroup named "collector". So for the objects that we want to collect shadow, we can simply name its lpegroup to "collector". Specifying
lpe:shadowcollector will collect the shadow for these objects.
This may be useful for creating holdouts using a manual workflow.
Advanced LPE Group Logic
You can use the usual regular expression character classes syntax to define more complex LPEs by considering each lpegroup as a single token.
unoccluded– returns unoccluded or unshadowed result.
noclamp– returns unclamped result.
nothruput– does not apply thruput (thruput is the accumulative albedo of the objects hit by rays).
shadows– returns collected shadows.
holdouts – holdout LPE that directs the LPE output to the beauty channel.returns only holdout light paths (light paths with one or more holdout events)
overwrite– instead of outputting the accumulated result, overwrite it. One example of using this is for the albedo output where we do not want an accumulated result.
noinfinitecheck– do not do any infinite check.
D– any diffuse (includes
S– any specular (includes
O– emissive object (camera visible lights and objects using material glow)
L– geometric area light
T– transmission (refraction/subsurface)
<>– specifies <ScatteringType ScatteringEvent lpegroup>
- Scattering types:
- Scattering events:
- lpegroup: This is optional; if specified, the LPE only applies to that lpegroup
- Scattering types:
()– for grouping
– for regular expression.
*means 0 or more.
+means 1 or more
- U – user defined signals (selected by number,
User Defined Signals
Utokens specify a user defined signal. A Bxdf can output any user defined signal via the RixBXLobeWeights class. There are twelve of them, from
U12. By default, all user defined signals are set to
U1. More on this can be found in the Developer's Guide.
- If you have more than one user defined signal, it is important to direct each user defined signal to a different
Utoken by setting them in
rendermn.ini. Otherwise, all user defined signals that are assigned to the same U token will override each others!
- By default,
U2is set to the albedo output in the installed
- In the documentation examples we often use <L.> means Light scattering type with all scattering events. For light group AOVs, using <L.> is required instead in place of L. There's no functional difference.
- lpe:CD<L.> means camera with diffuse scattering event for light scattering type.
- lpe:CO means camera with emissive objection (since emissive does not need any light, there is no L).