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. Additionally, we can group the outputs by light groups and/or by geometry set up by a lpegroup.
Info |
---|
You will find a useful set of video tutorials and discussion of these practices on the RenderMan Community site. |
...
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 | All LPEs must contain a camera event. |
<type event 'group'> | Scattering event specified by scattering type, scattering event, or lpe group | C<RD'floor'>[LO] matches diffuse reflections from the floor lpe group |
<L.'group'> | Light, i.e. analytic and geometric lights | C.*<L.'key'> matches all light paths from the key light group |
O | Emissive object, i.e. camera visible lights and material glow | C.*O matches all emissive object light paths |
Wildcard |
. | A period will match any relevant scattering type or event | |
Scattering Types |
R | Reflection | CR[LO] which is the same as C<R.>[LO] or C<R[DS]>[LO] matches direct reflection |
T | Transmission or refraction | CT[LO] which is the same as C<T.>[LO] or C<T[DS]>[LO] matches direct transmission |
Scattering Events |
D | Diffuse lobes (D1 , D2 , D3 , D4 ) | CD[LO] which is the same as C<.D>[LO] or C<[RT]D>[LO] matches direct diffuse. |
S | Specular/Glossy lobes (S1 , S2 , S3 , S4 , S5 , S6 , S7 , S8 ) | CS[LO] which is the same as C<.S>[LO] or C<[RT]S>[LO] matches direct specular |
User Event |
| User lobes to output material properties, not light transport ( Note: User events must be explicit and will not match wildcards |
|
Grouping |
( ) | Parentheses allow grouping of a sequence of LPE events | CDSL , C(DS)L , and CD(SL) are all functionally equivalent |
Alternatives |
| | A vertical bar separates alternatives | CD|(SD)L matches CDL or CSDL |
[ ] | Square brackets that match any one of the enclosed events | C[S2S3S4]L matches CS2L , CS3L , or CS4L |
[^ ] | 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) |
Qualifiers |
* | An asterisk will match the preceding event zero or more times | C.*[LO] matches all light paths, including emissive |
+ | A plus sign will match the preceding event one or more times | C.+[LO] matches direct and indirect light paths, but not emissive |
? | A question mark will match the preceding event zero or one times | C.?[LO] matches direct and emissive light paths |
{n} | Curly brackets that match the preceding event exactly n times | CT{2}[LO] matches double transmission light paths |
{min,} | Curly brackets that match the preceding event min or more times | C.{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.{0,2}[LO] matches all light paths with up to one bounce of indirect |
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.
...
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.
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 emissive | color lpe:C[<L.>O] |
color directDiffuse | color lpe:C<RD>[<L.>O] |
color indirectDiffuse | color lpe:C<RD>.+[<L.>O] |
color subsurface | color lpe:C<TD>.*[<L.>O] |
color directSpecular | color lpe:C<RS>[<L.>O] |
color indirectSpecular | color lpe:C<RS>.+[<L.>O] |
color transmissive | color lpe:C<TS>.*[<L.>O] |
...
RenderMan Still Life by Dylan Sisson
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
For example, some PxrSurface usage may involve the Clearcoat lobe. Normally this is summed under the S
token. Routing this lobe to the S4
token will allow you to use S4
in your LPEs. These name-to-lobe mappings are controlled by render options. Up to 4 diffuse lobes and 8 specular lobes are available for LPEs. By default, S1
contains all unspecified specular lobes, so use any higher tokens such as S2
for explicit per-lobe LPEs. The standard lobe mappings are:
LPE Lobes | Named Lobes |
---|---|
D1 | (default diffuse) |
D2 | Diffuse,HairDiffuse |
D3 | Subsurface |
D4 | |
S1 | (default specular) |
S2 | Specular,HairSpecularR |
S3 | RoughSpecular,HairSpecularTRT |
S4 | Clearcoat |
S5 | Iridescence |
S6 | Fuzz,HairSpecularGLINTS |
S7 | SingleScatter,HairSpecularTT |
S8 | Glass |
U1 | (default user) |
U2 | Albedo,DiffuseAlbedo,SubsurfaceAlbedo,HairAlbedo |
U3 | Position |
U4 | UserColor |
U5 | |
U6 | Normal,DiffuseNormal,HairTangent,SubsurfaceNormal,SpecularNormal,RoughSpecularNormal,SingleScatterNormal,FuzzNormal,IridescenceNormal,GlassNormal |
U7 | |
U8 |
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. The documentation for PxrMarschner and PxrSurface list these user lobes at the bottom of their page under an Advanced Rollout as it is for informational purposes and not actual operation.
Note |
---|
Note that the emissive LPE is repeated below. For materials in RenderMan it's typically called Glow. |
Note |
---|
For legacy reasons, subsurface scattering requires an extra LPE event from diffuse. For example, direct subsurface lighting is |
DisplayChannel | Expression |
---|---|
color directDiffuseLobe | color lpe:CD2[<L.>O] |
color indirectDiffuseLobe | color lpe:CD2.+[<L.>O] |
color subsurfaceLobe | color lpe:CD3.*[<L.>O] |
color directSpecularPrimaryLobe | color lpe:CS2[<L.>O] |
color indirectSpecularPrimaryLobe | color lpe:CS2.+[<L.>O] |
color directSpecularRoughLobe | color lpe:CS3[<L.>O] |
color indirectSpecularRoughLobe | color lpe:CS3.+[<L.>O] |
color directSpecularClearcoatLobe | color lpe:CS4[<L.>O] |
color indirectSpecularClearcoatLobe | color lpe:CS4.+[<L.>O] |
color directSpecularIridescenceLobe | color lpe:CS5[<L.>O] |
color indirectSpecularIridescenceLobe | color lpe:CS5.+[<L.>O] |
color directSpecularFuzzLobe | color lpe:CS6[<L.>O] |
color indirectSpecularFuzzLobe | color lpe:CS6.+[<L.>O] |
color transmissiveSingleScatterLobe | color lpe:CS7.*[<L.>O] |
color directSpecularGlassLobe | color lpe:C<RS8>[<L.>O] |
color indirectSpecularGlassLobe | color lpe:C<RS8>.+[<L.>O] |
color transmissiveGlassLobe | color lpe:C<TS8>.*[<L.>O] |
color emissive | color lpe:C[<L.>O] |
Carousel Image Slider | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Carousel Image Slider | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
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: lpe:C<RD>D[DS]*[<L.>
O]
Carousel Image Slider | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
LPE Macro
If a custom LPE is useful for 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:
...
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 |
...