Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Contents

In production it often become necessary to create non-physical effects and art-directed changes to your shot. Light Path Expressions (LPE) are a powerful way to collect and output specific light paths for alteration later.

Some examples of the power of LPE are the ability to:

  • Output a specific bounce of light (2nd, 3rd, etc.) or even a range of bounces (4th to 8th bounce of light). You can use this to isolate effects or even noisy bounces for subtraction.
  • Output a specific object to an LPE. While you can use Cryptomatte to isolate objects with an ID, you can also output the object or collection of objects and their contribution separately.
  • Isolate a particular noisy light path for subtraction in comp or an LPE without these light paths to composite.
  • Create a non-physical effect like differently colored caustics from their source, change the color cast of an object, or scale lighting.
  • Output per-light AOVs for manipulation later.
  • Allow for additive compositing, preserving the physical nature of the image and avoiding artifacts through multiplication or division in post processing.

Note that trace sets can also be used to accomplish some of these effects but since trace sets are global in the render, LPE will obey these trace sets (meaning data that would have been collected otherwise is restricted by the trace set).

LPE, Cryptomatte, and Trace Sets should improve the flexibility of your pipeline and when managed correctly, avoid expensive re-rendering for artistic tweaks.

Hand-authoring LPE can be a tedious process and for artists it's not always desired to do these manually. This document aims to improve the artist's understanding and usage of LPE.

The Basics

To understand what is collected in an LPE, we will talk about the parts below and some context. Firstly, we always begin at the camera, so we begin an expression using C for Camera as the starting point for light collection.

Scattering Types

Light is scattered when it strikes an object. It is either reflected off, absorbed, transmitted, or some combination of the three. In the LPE syntax we list two types of events:

  • Reflected Light (R) is light that reflects off the object and back into the scene. This light carries information about the objects reflective properties like its diffuse color and what the object might reflect more sharply of other objects around it.
  • Transmitted Light (T) is the light that transmits into and possibly through the object. Subsurface scattering is a very diffuse transmission of light. Refractive objects have a sharper specular transmission of light through the object.

The tokens for these events are are R and T as shown above. You may specify which you want to collect or both. Later we will discuss some shorthand for specifying either but for now we'll use the tokens. Light that is absorbed is handled by the material itself and since it doesn't travel back into the scene (its energy absorbed like light in the real world) we don't collect it.

Scattering Events

A scattering event is a type of light scattering. In RenderMan we provide two main events and one special User event:

  • Diffuse (D) scattering events are the type we associate with diffuse surfaces like paper, rough wood, skin, dust, cardboard, etc.
  • Specular (S) events are shiny or dielectric type scattering. This covers things like shiny car paint, metals, plastics, water, glass, etc.
  • User (U) events are available to shader writers interested in using them to store some other information. While mentioned here, the documentation will cover the D and S events.

You can specify a chain of events if you like, such as DDS, meaning Diffuse event to Diffuse event to a Specular in that order. The LPE would collect anything that happens in this specific order and store them. For simplicity we'll cover more common cases first.