Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

UI Expand
titleExample: The + modifier

Previously, we looked at C<T[GS]><RD>L to capture diffuse reflection behind refraction. This will work behind a single refractive pane, as we only ask for a single refractive hit with <T[GS]> that is either Glossy or Singular.

If the refractive object is (for example) a cube, then the ray needs to enter and exit the cube, hitting the refractive surface twice before reaching the diffuse surface behind.

In this case, we need to ask for two refraction hits C<T[GS]><T[GS]><RD>L. If there's no risk of capturing other random refraction hits, we can use <T[GS]>+ to ask for 1 or more repetitions of <T[GS]>


C<T[GS]><T[GS]><RD>L captures the diffuse surface behind exactly 2 panes of refractive surfaces.

C<T[GS]>+<RD>L captures the diffuse surface behind 1 or more refractive hits.

Capture objects or materials

LPEs can be modified to record information for only specific objects or materials by adding a label.

 

...

LPE labels for objects

Column
width60%

If we take C.* as an example, which gives us the Beauty, C.'1'.* will filter the Beauty only for objects with LPE label 1.

C.'cube'.* will be the Beauty only for objects with LPE label cube.

LPE labels to objects are added with V-Ray User Attributes, added from the extra V-Ray attributes menu. The user attribute name needs to be lpe_label and its value can be text or numbers: for instance

lpe_label=1 or lpe_label=cube.

 

UI Text Box
typetip

LPE labels can be anything. You can label an object or material 1, or 2, or myObject, or myMaterial.

When used in expressions, labels need to be placed inside single quotes: C.'cube'.*

UI Text Box
typenote

Note that Maya attributes cannot be used as LPE labels.

Column
width5%

 

Column
width35%

Image Removed

Adding a Light Path Expression label to geometry



...

LPE labels for materials

Column
width60%

Similarly, C.'m1'.* can be used to separate the Beauty only for materials with material label 1.

C.'mmyMaterial'.* will be the Beauty only for materials with LPE label myMaterial.

LPE labels are added to materials with the Light Path Expression Label attribute from the extra V-Ray attributes menu. The label can take numeric or text values and when used in an expression it needs to be preceded by m and placed inside in single quotes.

 

UI Text Box
typetip

LPE labels can be anything. You can label an object or material 1, or 2, or myObject, or myMaterial.

When used in expressions, material labels require prefixing the label with m and placing the label inside single quotes:  C.'m1' or C.'mmyMaterial'.

Column
width5%

 

Column
width35%

Image Removed

Adding a Light Path Expression label to materials

Inverting LPE labels

Labels can be easily inverted in expressions by adding ^ in front of them and then placing the inversion symbol and the label inside square brackets [ ].

For example, C.[^'m1'].* will give us the Beauty for all materials that do not have material label 1.

We can invert multiple labels at the same time, for example CR[^'1''2'].+L filters the indirect illumination for all object that do not have the labels 1 and 2.

 

Reserved labels: coat and sheen

The material labels coat and sheen are reserved for the additional VRayMtl Coat and Sheen layers.

You cannot add a custom Light Path Expression Label with values coat or sheen.

You can use mcoat and msheen directly in expressions to capture the reserved labels.

Boolean operations between expressions can be used along with the reserved coat or sheen labels to extract those layers exclusively for specified materials or objects.

Example: (C.*)-(C.'mcoat'.*) captures the Beauty without the contribution of the VRayMtl Coat layer.

You can read more about boolean operations in the next section.

Boolean operations

...

Boolean operations allow us to combine expressions. We can complement (^), intersect (&) or unite (|) expressions, or we can subtract (-) one expression from another.

...