Table of Contents |
---|
Quick Introduction
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. We can also use a short descriptive name (e. g. lpe:diffuse
) as well as the long LPE expression (e.g. lpe:CD<L.>
). Additionally, we can group the outputs by light groups and/or by geometry set up by a lpegroup.
Usage
An LPE is made up of tokens which are not the most artist-friendly things. For this reason, we provide a list of built-in LPEs with short descriptive names and hide the non-artist friendly expressions.
RenderMan for Maya
In RfM, an LPE can be easily added by clicking on an LPE name from the built-in LPEs list in Render Settings. Note in the UI that the Source field is where the LPE Expression is required. The LPE listed below are already built into Maya.
RenderMan for Katana
In RfK, an LPE is specified via PrmanOutputChannelDefine. For a list of built-in LPE names, please see the LPE tables below.
RIB
For DisplayChannel, we can use either the short name or long expression, e.g., lpe:diffuse
or lpe:CD<L.>
Code Block |
---|
DisplayChannel "color lpe:diffuse" |
or
Code Block |
---|
DisplayChannel "color lpe:CD<L.>" |
Built-in LPEs
In RenderMan, these names are enough to output the supplied LPEs below without inputting an Expression.
Name | Corresponding Expression |
---|---|
|
|
lpe:specular | lpe:CS<L.> |
lpe:emission | lpe:CO |
lpe:indirectdiffuse | lpe:(C<RD>[DS]+<L.>)|(C<RD>[DS]*O) |
lpe:indirectspecular | lpe:(C<RS>[DS]+<L.>)|(C<RS>[DS]*O) |
lpe:subsurface | lpe:(C<TD>[DS]+<L.>)|(C<TD>[DS]*O) |
lpe:refraction | lpe:(C<T[S]>[DS]+<L.>)|(C<T[S]>[DS]*O) |
lpe:shadowcollector | lpe:shadows;C[<.D'collector'><.S'collector'>]<L.> |
Info |
---|
You will find a useful set of video tutorials and discussion of these practices on the RenderMan Community site. |
LPE Tokens
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.
LPE Events | Description | Example |
---|---|---|
C | Camera | |
<type event 'group'> | Scattering event specified by scattering type, scattering event, or lpe group | C<.[DS]'floor'>[LO] matches all light paths from the floor lpe group |
<L.'group'> | Light, i.e. analytic and geometric lights | C[DS]*<L.'key'> matches all light paths from the key light group |
O | Emissive object, i.e. camera visible lights and material glow | C[DS]*O matches all emissive object light paths |
Wildcard | ||
. | A period will match any relevant event | <.D> where the period represents R or T |
Scattering Types | ||
R | Reflection | C<R[DS]>[DS]*[LO] matches all reflected light paths |
T | Transmission or refraction | C<T[DS]>[DS]*[LO] matches all transmitted light paths |
Scattering Events | ||
D | Diffuse lobes (D1 to D4) | CD[DS]*[LO] matches all diffuse light paths |
S | Specular/Glossy lobes (S1 to S8) | CS[DS]*[LO] matches all specular light paths |
U | User lobes used to output material properties (U1 to U12) | CU2L matches the camera visible user2 lobe, typically albedo |
Grouping | ||
( ) | Parentheses allow grouping of a sequence of LPE events | CDSL , C(DS)L , and CD(SL) are all functionally the same |
Alternatives | ||
| | A vertical bar separates alternatives | CD|(SD)L matches direct diffuse or specular-diffuse light paths |
[ ] | Square brackets that match any one of the enclosed events | C[D2D3]L matches direct diffuse2 or diffuse3 light paths |
[^ ] | Square brackets that match any one event not contained within the brackets | C[^D2D3]L matches all light paths besides diffuse2 and diffuse3 (including specular and user) |
Qualifiers | ||
* | An asterisk will match the preceding event zero or more times | C[DS]*[LO] matches all light paths, including emissive |
+ | A plus sign will match the preceding event one or more times | C[DS]+[LO] matches direct and indirect light paths, but not emissive |
{n} | Curly brackets that match the preceding event exactly n times | C<T[DS]>{2}[LO] matches double transmission light paths |
{min,} | Curly brackets that match the preceding event min or more times | C[DS]{2,}[LO] matches all indirect light paths |
{min,max} | Curly brackets that match the preceding event at least min but not more than max times | C[DS]{0,1}[LO] matches direct and emissive light paths |
In RIB
To specify an LPE in RIB, reference a DisplayChannel in the Display. This is the most basic way to view what's being output.
Code Block |
---|
DisplayChannel "color directDiffuse" "string source" ["color lpe:CD[<L.>O]"]
Display "myRender.exr" "openexr" "directDiffuse" |
Usage
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.
Basic LPEs
Anchor | ||||
---|---|---|---|---|
|
...
For basic workflows, the following LPE are recommended. Note that below we 're are specifying the DisplayChannel and a name (which can be most anything) as opposed to the examples above using a built-in naming scheme. 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 for rendering.
Note |
---|
Understand that emissive LPE results are a special case. In the materials provided it's referred to as "Glow" or emission. Light sources directly visible to the camera are also output into this LPE. In the below example, the candle flames are using the glow lobe in PxrSurface. |
DisplayChannel | Expression | color beauty|
---|---|---|
color lpe:C[DS]*[<L.>O]color emissive | color lpe:C[<L.>O] | |
color directDiffuse | color lpe:C<RD>[<L.>O] | |
color indirectDiffuse | color lpe:C<RD>[DS]+[<L.>O] | |
color subsurface | color lpe:C<TD>[DS]*[<L.>O] | |
color directSpecular | color lpe:C<RS>[<L.>O] | |
color indirectSpecular | color lpe:C<RS>[DS]+[<L.>O] | |
color transmissive | color lpe:C<TS>[DS]*[<L.>O] |
...
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Per-Lobe LPEs
Bxdf materials may have more than one diffuse or specular lobe which are summed for D
and S
, respectively. However, in some situations, it may be desirable to output a specific lobe separately.
For example, some PxrSurface 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.
For advanced workflows that want to separate all scattering lobes into separate AOVs, the below LPE are provided. These capture the light interaction for each lobe, direct and indirect, and store them into separate AOVs. This is useful for tweaking individual effects at the cost of added AOVs and image output.
Note |
---|
Note that the emissive LPE is repeated below. For materials in RenderMan it's typically called Glow. |
DisplayChannel | Expression |
---|---|
color directDiffuseLobe | color lpe:CD2[<L.>O] |
color indirectDiffuseLobe | color lpe:CD2[DS]+[<L.>O] |
color subsurfaceLobe | color lpe:CD3[DS]*[<L.>O] |
color directSpecularPrimaryLobe | color lpe:CS2[<L.>O] |
color indirectSpecularPrimaryLobe | color lpe:CS2[DS]+[<L.>O] |
color directSpecularRoughLobe | color lpe:CS3[<L.>O] |
color indirectSpecularRoughLobe | color lpe:CS3[DS]+[<L.>O] |
color directSpecularClearcoatLobe | color lpe:CS4[<L.>O] |
color indirectSpecularClearcoatLobe | color lpe:CS4[DS]+[<L.>O] |
color directSpecularIridescenceLobe | color lpe:CS5[<L.>O] |
color indirectSpecularIridescenceLobe | color lpe:CS5[DS]+[<L.>O] |
color directSpecularFuzzLobe | color lpe:CS6[<L.>O] |
color indirectSpecularFuzzLobe | color lpe:CS6[DS]+[<L.>O] |
color transmissiveSingleScatterLobe | color lpe:CS7[DS]*[<L.>O] |
color directSpecularGlassLobe | color lpe:C<RS8>[<L.>O] |
color indirectSpecularGlassLobe | color lpe:C<RS8>[DS]+[<L.>O] |
color transmissiveGlassLobe | color lpe:C<TS8>[DS]*[<L.>O] |
color emissive | color lpe:C[<L.>O] |
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Carousel Image Slider | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Carousel Image Slider | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Carousel Image Slider | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
For objects that have an LPE group called "collector", lpe:shadowcollector
collects shadows. This may be useful for creating holdouts.
...
Caustics are not included in the built-in list because they overlap with lpe:indirectdiffuse
. with indirectdiffuse lpe:C<RD>[DS]+[<L.>O]
However, you can select caustics with the expression lpe:CD[S]+<L.>
...
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: lpe:C<RD>D[DS]*[<L.>
O]
Carousel Image Slider | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
Carousel Image Slider | |||||||||||||||||
|
Pig model by Tom Painter of Bigman 3D
Custom LPE
RenderMan for Maya
A custom LPE can be added in RenderMan Controls' Add Channels/Outputs:
RenderMan for Katana
Custom LPE is specified via PrmanOutputChannelDefine's Add Source:
LPE LPE Macro
If the a custom LPE is useful for other your shots, you can add your custom LPE by creating a macro in rendermn.ini
file. The custom LPE will appear in the RenderMan for Maya (RfM) LPE list after relaunching Maya. For example:
...
Note |
---|
|
LPE Groups
An LPE group (lpegroup) allows us to specify which objects we want to be use for an LPE channel.
RenderMan for Maya
In RfM, we add an lpegroup by selecting the objects and add the lpegroup RenderMan attribute.
RenderMan for Katana
In RfK, we add an lpegroup via PrmanObjectSettings' attributes/identifier/lpegroup.
The attributes can be added in RenderMan plugins using the software's menu system such as PrmanObjectSettings in Katana.
LPE Group Example RIB
Code Block |
---|
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 or reflectioncollector, it assumes a predefined lpegroup named "collector". So for the objects that we want to collect shadow or reflection, 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.
...
Code Block |
---|
DisplayChannel "varying color lpe:diffuse_key" DisplayChannel "varying color lpe:CD<L.'key'>" |
...
Bxdf materials may have more than one diffuse or specular lobe which are summed for D
and S
, respectively. However, in some situations, it may be desirable to output a specific lobe separately.
...
LPE
...
Code Block |
---|
Option "lpe" "string specular2" ["Clearcoat"]
DisplayChannel "color lpe:CS2<L.>" |
This will cause a slight performance penalty but may be desirable to see lobes independently.
LPE Prefixes
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.holdout
s – 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.
LPE Tokens
C
– cameraD
– diffuseS
– any specular (includesS1
,S2
, ...)D
– any diffuse (includesD1
,D2
, ...)R
– reflectionO
– emissive objectL
– geometric area lightT
– transmission (refraction/subsurface)<>
– specifies <ScatteringType ScatteringEvent lpegroup>- Scattering types:
L
(light),T
(transmission),R
(relection), orO
(emissive object) - Scattering events:
D
(diffuse),S
(specular) - 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,
U1
through U12
)
User Defined Signals
U
tokens specify a user defined signal. A Bxdf can output any user defined signal via the RixBXLobeWeights class. There are twelve of them, fromU1
toU12
. By default, all user defined signals are set toU1
. 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
U
token by setting them inrendermn.ini
. Otherwise, all user defined signals that are assigned to the same U token will override each others! - By default,
U2
is set to the albedo output in the installedrendermn.ini
:
Code Block |
---|
/prman/lpe/user2 Albedo,DiffuseAlbedo,SubsurfaceAlbedo,HairAlbedo |
Examples
- 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 of Lin 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).