Advanced Iray Node Properties - "Iray Handle" & Light Path Expressions

linvanchenelinvanchene Posts: 1,303
edited March 2018 in Daz Studio Discussion


In the content library you can find a script to Create Advanced Iray Node Properties.

DAZ Studio Formats > My DAZ 3D Library > Scripts > Utilities > Create Advanced Iray Node Properties

While the use of "Iray Matte" is explained on the forum I was not able to find information about the "Iray Handle" parameter.

I put together an example how you can use the Iray Handle parameter in combination with the Iray Light Path Expressions:

I leave the first few posts of this thread as they are so you can track the progress of the discussion...

- - -

You can also find the script in the "Default Resources" Product:


- - -

"Enable Iray Matte"

I was able to follow the tutorials how to create "matte" objects to catch shadows in Iray.


Video: Matte Function in Iray DAZ Studio - Shadow Catcher #2


Related Forum post:


- - -

Iray Handle

When using the script to 

Create Advanced Iray Node Properties

there is also an entry created called "Iray Handle"

- - -


It seems you can enter a name.

In the example I entered "ground plane".

A handle may be something like an "object id" that then can be used to call that object in some other functions.

​But I was not able to find any information how it is used in the Iray integration for DAZ Studio.

- - -


1) How is this "Iray Handle" used in DAZ Studio?

2) Why do users have to run a script to show the parameters "Enable Iray Matte" and "Iray Handle"?

Can users break any functionality if they experiment with those settings without knowing what exactly to do?

Why are those settings not shown by default?




Create Advanced Iray Node properties.jpg
581 x 602 - 82K
Iray Handle example.jpg
1920 x 1080 - 292K
Post edited by linvanchene on


  • linvanchenelinvanchene Posts: 1,303
    edited March 2018


    Thank you for this link. This leads to some very interesting options how to composite with Iray.

    I did not know that Iray supports "Light Path Expressions" LPE that offer ways to split off the render into several images each containing specific elements.

    The images could be exported as .exr files and then could be composited in photoshop.

    - - -

    "An LPE is a regular expression that matches some light transport paths that iray generates, but not others. Each result buffer can be associated with a LPE so that only paths which match the expression end up contributing to that buffer. Iray also allows you to render several buffers with different LPEs at the same time at almost no additional runtime cost. LPEs can distinguish between different surface properties such as diffuse or glossy, reflection or refraction, types of light sources, and names."


    Regular Expressions:

    About Light Path Expressions:


    The get a grip series:


    ​- - -

    ​Update / Edit 2018-03-15

    ​I split off the information about Light Path Expressions into another thread.




    - - -


    I am not yet sure either if the Iray handles are related to the Light Path Expressions.

    Maybe the "Iray handles" are the "names" and can be used with LPE to indicate witch objects or surfaces should be included in the canvases.

    - - -

    Post edited by linvanchene on
  • linvanchenelinvanchene Posts: 1,303
    edited March 2018

    - - -

    After some more testing the short version:

    You can use the "Iray handles" under the "Advanced Iray Node Properties" to set up Light Path Expressions.

    Basically the Iray handles give an id or name to an object that then can be used to reference to it when using Iray specific commands (expressions)

    This post will follow an example of the Iray Dev Blog and show how the same can be done in DAZ Studio:

    - - -

    If you are not yet familiar with Iray Light Path Expressions in DAZ Studio please also have a look at those threads:

    - - -

    Iray Handles & Light Path Expressions used to "Compositing per light"

    ​In this example the idea is to separate the interaction of each light with objects in the scene into its own image.

    In photoshop you can then adjust the strenght of each image in postproduction.


    Step 01

    Set up a test scene with three lights:


    You can find version 1004 of the test scene in its basic state  as .zip file with size 83.2KB  here:

    This version of the scene has materials set up but the Light Path Expressions are not yet set so you can follow along.


    - - -

    Step 02

    Before any work with canvases and Light Path Expressions open the Iray Render settings and make sure the tone mapping parameters are adjusted to be "linear"

    • Burn Highlights: 1.0
    • Crush Blacks: 0.0
    • White point: 1.0, 1.0, 1.0
    • Vignetting: 0.0
    • Saturation: 1.0
    • Gamma: 1.0


    - - -

    Step 03

    Select your first emissive light object in the scene and apply the script to

    Create Advanced Iray Node Properties


    - - -

    Step 04

    Now open the Parameters tab - Rendering - Iray and give your light a name in the box "Iray Handle"




    - - -

    Step 05

    Now that you have set up the handles you can set up the Light Path Expressions LPE in the Iray Render Settings - Advanced - Canvases




    To get a basic idea how those expressions are put together

    L = light emitted by the environment (Le) that bounces from any type of surface any number of times

    E = then hits the eye (E)

    . = the dot character matches any interaction

    * = the star operator means “repeat any number of times"

    You just add the Iray handle after "L" into the brackets 


    Create a canvas with a Light Path Expression for each light in the scene.

    - - -

    Version 1005 of the test scene has everything set up and is ready to render:

    - - -

    Step 06

    ​When your goal is to export to .exr files then you do not need to worry which canvas is active.

    You can just render out any canvas as .png

    In this example something "odd" happened. The png for the LPE <L'light_front'>.*E just rendered blank.

    But as it turned out in the .exr all information was available.

    When you save the .png all the other canvases seem to be automatically written to a folder as .exr.


    - - -

    Now it is time to put the rendered out .exr together in photoshop.

    Step 7

    Create a new 32 bit image with the same dimensions as your rendered images.

    If there is no black solid background create one and leave its blending mode at normal.

    - Use File - Place Embedded to import your first .exr.

    In this example the first image placed was light_front

    Do not worry that your image may look either very bright or very black. 


    - Change the blending mode to Linear Dodge (Add)

    - place an Exposure adjustment layer

    With the default settings adjustment layers affect all the layers below them.

    While setting this up the idea is to have the same exposure values affect all the images in the different layers.

    Now you can change the exposure until a level in which the image of the first light looks about right to you.


    - embed the .exr of your next light and also set it to blend mode "Linear Dodge - Add"

    Now you can see the result of light_front and light_left​.

    - Now add the .exr of your third light and also set it to blend mode "Linear Dodge - Add"


    At this stage you have now added all the indiviudal light layers that create the original image.

    The photoshop document should now look excactly the same as if you would have rendered out a single .png without any canvases.

    The benefit is that you can adjust the strenght of each light without having to rerender the whole image.

    You can fine tune the lights by adjusting each individual layer.

    Instead of one adjustment layer affecting all images you may want to work with individual adjustment layers that just affect one layer and not the others.


    In this example another Exposure Adjustment Layer was applied to just the "right_light" layer.

    By changing the offset value the right red light is now stronger.

    If you want you can now also deceide to keep one light away completly by hiding it.

    Or if you want you can just tint one light.

    You could also apply masks to specific areas of individual layers...

    - - -

    Thanks to everyone who helped out, provided links and filled in missing pieces of information in this and the related threads.

    - - -








    01 Test scene layout.jpg
    1920 x 1080 - 205K
    02 Tone mapping linear.jpg
    815 x 836 - 150K
    LPE Light
    04 light_front.jpg
    1920 x 1080 - 221K
    04B light_left.jpg
    1920 x 1080 - 241K
    04C light_right.jpg
    1920 x 1080 - 308K
    05 LPE Canvases for each light.jpg
    1920 x 1080 - 269K
    06A render a canvas and save as png.jpg
    1920 x 1080 - 545K
    06B canvases are automatically saved as exr.jpg
    1920 x 1080 - 277K
    06C exr files in folder.jpg
    404 x 227 - 42K
    07A create 32 bit image in photoshop.jpg
    1920 x 1080 - 184K
    07B embed first exr file.jpg
    1920 x 1080 - 220K
    07C set blend mode to linear dodge add.jpg
    1920 x 1080 - 243K
    07D place an exposure adjustment layer.jpg
    1920 x 1080 - 186K
    07E light_front and light_left combined.jpg
    1920 x 1080 - 189K
    07F all three lights combined again.jpg
    1920 x 1080 - 194K
    07G Change light strenght in postproduction.jpg
    1920 x 1080 - 209K
    LPE Light
    Post edited by linvanchene on
  • evilded777evilded777 Posts: 2,394
    edited April 2018

    There is an easier way to do all this that does not require LPE.

    1. create a canvas for each light
    2. change the type to Light Group
    3. Create a node for each layer from the drop down list
      1. you can select the light in your Scene tab and then Choose Create from Selected
      2. Emissive surfaces need their own Light Group Layer
      3. Environment Lights have their own Canvas type and should be used if you are using an HDRI or Sun&Sky
    4. Then follow the same steps for compositing after you render

    I'm wondering if one can use LPE to have a light ignore a certain object, like say a volume based environment? Right now, LPE makes my head spin.

    571 x 588 - 37K
    Post edited by evilded777 on
  • JonnyRayJonnyRay Posts: 1,743

    This is awesome information @linvanchene! I love understanding the workings of the rendering engine and how to tweak it to get the best results. The canvas idea was very clever. I've written tutorials on using a standard 3-light studio setup and talked about making multiple renders, each with a single light turned on, but this method is even more flexible.

    The idea of selectively lighting objects with certain lights is interesting too. Renderman based engines (like 3Delight) can do this as well. It can be helpful for complex lighting situations.

  • evilded777evilded777 Posts: 2,394

    I'm still wondering, over a year later, if I can use LPE to ignore a volume based environment.


  • JD_MortalJD_Mortal Posts: 732
    edited March 2020

    Is there an update for this script? It does not seem to add some elements to shaders that others seem to have in similar posts.

    On a specific case, I am not seeing any settings that others have when selecting "Use Matte". The shader values are the same as before and there are no lighting options. (I was trying to create a "Mask" material. But the other examples were for creating invisible "shadow catcher" surfaces.)

    I am trying to make the eyes ALPHA, without any shadows or reflections on them. So I can place my own animated pre-renderd, eyes behind the face-shell that has the eyes cut-out. (I have devised another method for the moment, but having an "Alpha" mask, which could potentially have a UV mapped image, would be a lot easier.)

    Attached is a sample of what I ended-up with, as a work-around. (Using the canvas and replacement spheres for the eyeballs.)


    1920 x 768 - 1M
    Post edited by JD_Mortal on
Sign In or Register to comment.