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.
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.
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.
In RfK, an LPE is specified via PrmanOutputChannelDefine. For a list of built-in LPE names, please see the LPE tables below.
For DisplayChannel, we can use either the short name or long expression, e.g., lpe:diffuse
or lpe:CD<L.>
DisplayChannel "color lpe:diffuse" |
or
DisplayChannel "color lpe:CD<L.>" |
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.> |
For basic workflows, the following LPE are recommended. Note that below we're specifying the DisplayChannel and a name (which can be 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.
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] |
RenderMan Still Life by Dylan Sisson
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.
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] |
For objects that have an LPE group called "collector", lpe:shadowcollector
collects shadows. This may be useful for creating holdouts.
Note that the first eight of these expressions are both disjoint and exhaustive; any individual light path will match exactly one of them. As a result, rendering out all eight of them and then compositing them together will produce the equivalent of the beauty image. |
Caustics are not included in the built-in list because they overlap with lpe:indirectdiffuse
. However, you can select caustics with the expression lpe:CD[S]+<L.>
Pig model by Tom Painter of Bigman 3D
A custom LPE can be added in RenderMan Controls' Add Channels/Outputs:
Custom LPE is specified via PrmanOutputChannelDefine's Add Source:
If the custom LPE is useful for other 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 LPE list after relaunching Maya. For example:
/prman/lpe/macro/myDiffuse CD<L.> |
|
An LPE group (lpegroup) allows us to specify which objects we want to be use for an LPE channel.
In RfM, we add an lpegroup by selecting the objects and add the lpegroup RenderMan attribute.
In RfK, we add an lpegroup via PrmanObjectSettings' attributes/identifier/lpegroup.
Attribute "identifier" "string lpegroup" ["ground"] DisplayChannel "varying color plane2Shadow" "string source" ["color lpe:shadows;C<.[DS]'ground'><L.>"] |
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.
You can use the usual regular expression character classes syntax to define more complex LPEs by considering each lpegroup as a single token.
For instance, provided you are using lpegroups "foo" and "bar", you can define the following LPEs:
C<.D'foo'>L C<.D[^'foo']>L C<.D['foo''bar']>L C<.D[^'foo''bar']>L |
By default, LPEs retrieve the response to all lights in the scene. To limit the LPE to the contribution due to a single light or set of lights, assign each light to the group by setting the __group parameter on each light to the same name.
For the short LPE name, suffix the name with '_' followed by the light group name. For the long expression, place the light group name in single quotes inside the LPE.
For instance, say we have a light group named "key". The following are both valid LPEs:
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.
For example, some PxrSurface materials have a 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.
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.
unoccluded
– returns unoccluded 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
– holdout LPE that directs the LPE output to the beauty channel.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.C
– cameraD
– diffuseS
– any specular (includes S1
, S2
, ...)D
– any diffuse (includes D1
, D2
, ...)R
– reflectionO
– emissive objectL
– geometric area lightT
– transmission (refraction/subsurface)<>
– specifies <ScatteringType ScatteringEvent lpegroup>L
(light), T
(transmission), R
(relection), or O
(emissive object)D
(diffuse), S
(specular)()
– for grouping[]
– for regular expression. []*
means 0 or more. []+
means 1 or moreU1
through U12
)U
tokens specify a user defined signal. A Bxdf can output any user defined signal via the RixBXLobeWeights class. There are twelve of them, from U1
to U12
. By default, all user defined signals are set to U1
.U
token by setting them in rendermn.ini
. Otherwise, all user defined signals that are assigned to the same U token will override each others!U2
is set to the albedo output in the installed rendermn.ini
:/prman/lpe/user2 Albedo |