Light Path ExpressionΒΆ

Introduction

A light path expression is a regular expression representing the different vertices of a path between the camera and a light. Guerilla comes with many presets, but you can create your own expression.

For example, CDL matches the direct lighting on a diffuse surface: a path of three events, each represented by a capital letter: Camera, Diffuse and a Light.

This section is a formal definition of the light path expression language. Ones may be interested by the the default expressions available in Guerilla

This section use formatting to help readability. A label can appear in an event <L.'label'> which is part of a bigger light expression C'Alice'L.

Regular Expression Syntax

The regular expression syntax can be used to match an event sequence. Many events are composed together using the following combiners:

Symbol Meaning Example
. Any Event C.L: Direct lighting on any surface
X* 0 or more X CG*DL: 0 or more Glossy followed by a Diffuse
X+ 1 or more X CD+L: 1 or more Diffuse
X|Y X ou Y C(DD|G)L: Two Diffuse or one Glossy
(XYZ) Grouping Usually used with the | operator
X{5,} 5 or more X
X{5, 10} between 5 and 10 X
[XYZ] X or Y or Z Only works for event, not groups of event
[^XYZ] none of X, Y, Z Only works for event, not groups of event

Event Rules

An event is characterized by:

  • Its type
  • Its scattering
  • Its label

Type, Scattering and Labels are combined with the extended event syntax: <TSL>, using . as wildcard. For example, <RS.> is an event with type Reflexion, scattering Singular and any label.

When it is not ambiguous, you can replace the extended event syntax by a single component. <L..> is equivalent to L.

Type description

EndPoints (Lights or Technicals):

  • C: Camera, all expressions will start by that
  • L: Light, all expressions but technical passes end with it
  • I: Information (Technical passes)

MiddlePoint (Surface or Volume):

  • R: Reflexion, the light bounce on a solid object
  • T: Tranmission, the light go through a solid object
  • V: Volume scattering
  • O: in-Object scattering (SSS)

Scattering description

EndPoints (Lights or Technicals):

  • S: Surface light
  • V: Volume light
  • 'aLabel': A technical passe named aLabel.

MiddlePoints (Surface or Volume):

  • S: Singular, perfect scattering, such as mirror or glass
  • D: Diffuse, rough scattering
  • G: Glossy, focused scattering

Labels

An event can also be represented by a label, such as 'Label'. Labels are used for light groups and object names. Labels can also appear in the scattering description of an technical pass I.

Tips

  • A technical output, such as Albedo, can be matched with an expressing ending by <I'Albedo'>.
  • Avoid matching only on I without a label, you'll get the sum of all technical output.
  • Similarly, avoid path expressions with unspecified endpoint. For example, C.* will match all light path, including technical ones.
  • ...~ is equivalent to ...<I'ShaderColor'.>, using the Shader Color setting of your AOV.
  • ...# is equivalent to ...<L.['lightCategoryA''lightCategoryB']> with as many cases as selected light categories in your AOV settings.

Examples

Capture only the Diffuse on light category RimLight

CD'RimLight'

Capture only the direct lighting on object Alice

C'Alice'L

Capture Albedo after two Singular Transmissions (i.e. through a glass)

C<TS>{2}<I.'Albedo'>

Capture only the Diffuse direct lighting Reflection on object Alice

C<RD'Alice'>L

Capture any Transmission on Alice

C<T.'Alice'>L

Capture the Albedo of object Alice after a Singular Reflection on Bob

C<RS'Bob'><I'Albedo''Alice'>

Capture the direct lighting on Diffuse, Glossy and Singular Reflexions

C<R[SDG]>L