Light Path Expressions Iray

Seems like there is virtually no info on DAZ's implementation of the Iray LPE (Light Path Expressions), aside from a thread or two back in 2015 as far as I can tell.

From what I've seen about LPE's from the NVIDIA perspective it's a great way to define the specific passes/canvases you get in your renders, and you can extract an incredible amount of info from your renders. But unlike the standard passes, you select LPE and then you have to define what you want by entering some very cryptic expressions? 

I tried to do something simple, but it seems like DAZ hasn't fixed the implementation, since even when you type in an expression it types backwards. I guessing it was never really implemented, and since nobody seems to care they didn't pursue it? 

Has anybody succeeded with LPE, or are you limited to the standard canvases? 

Thanks. 

 

Comments

  • LayLo 3DLayLo 3D Posts: 329
    edited October 2017

    They work as far as I can tell. I've used my own LPEs and gotten results. In my opinion, they're just hard to completely understand and figure out. It took me probably close to 12 hours of experiementing with them before I was finally able to start getting the results I was trying to.

    To get around the very strange text box behavior inside Daz Studio, I type them somewhere else first then copy and paste them in.

    Post edited by LayLo 3D on
  • ebergerlyebergerly Posts: 3,255
    LayLo 3D said:

    They work as far as I can tell. I've used my own LPEs and gotten results. In my opinion, they're just hard to completely understand and figure out. It took me probably close to 12 hours of experiementing with them before I was finally able to start getting the results I was trying to.

    To get around the very strange text box behavior inside Daz Studio, I type them somewhere else first then copy and paste them in.

    Cool Thanks.

    So basically you just find in the NVIDIA documentation the correct LPE code and copy/paste? I assume DAZ is using the NIVDIA code directly?

  • LayLo 3DLayLo 3D Posts: 329
    ebergerly said:

    Cool Thanks.

    So basically you just find in the NVIDIA documentation the correct LPE code and copy/paste? I assume DAZ is using the NIVDIA code directly?

    Yeah, that's pretty much it. I guess if you're familiar with RegEx it's supposed to help, but I wouldn't really know.

    Oh yeah I forgot to mention, you can write them forward or backwards, from the light to the eye (camera) or from the eye to the light, but I'm pretty sure the order of the event type, scattering mode and handle need to be in the proper order.

  • ebergerlyebergerly Posts: 3,255

    Have you found a good reference for LPE expressions? I found this at the SolidAngle site, but it looks like they use "C" instead of "E" for camera view. I'm trying to replace those with E's and see if they work.

    https://support.solidangle.com/display/A5ARNTUT/Introduction+to+Light+Path+Expressions

  • ebergerlyebergerly Posts: 3,255
    edited October 2017

    Wow, I'm starting to love this LPE thing smiley

    I'm starting to build a list of LPE's that seem to work in Studio Iray:

    Environment Lighting: E.*Le 

    Indirect Lighting, more than 1 bounce: L.{2,}E

    Specular: E<RS.>.*L 

    Diffuse: E<RD.>.*L 

    Area Lighting:  E.*La 

    Scene illuminated by "plane 2" emissive only: <L'plane 2'>.*E

    The last one is the awesome-est. You can make a render pass that is JUST the scene illuminated by selected lights in your scene. Then you can take that into your compositor and adjust the scene as if you varied the light in your initial render. Cool. In this case I had an emissive plane called "plane 2" in my scene, and I isolated its effect. 

    By the way, it seems like the Iray for 3DS Max LPE's work in Studio Iray, while the ones for Arnold renderer (?) don't. 

    Post edited by ebergerly on
  • ebergerlyebergerly Posts: 3,255

    Yeah I already tried them and they seem to work fine. 

    The ones that don't seem to work are:

    Beauty: E.* 

    Albedo: E<RD>A 

    They just give me a black image/canvas

  • ebergerlyebergerly Posts: 3,255
    edited October 2017

    Okay so after some testing I've compiled the following list of LPE's that seem to work. To verify they work I added the "Light Type Contributions" canvases together in Nuke and they reproduce the Beauty pass. I did the same for the Reflections canvases:

    Light Type Contributions:

    Area Lights (ie, emissives):     E.*La                         

    Environment Lights    E.*Le                            

    Point Lights (not sure if this includes spotlights, etc.):    E.*Lp                         

    Reflections:

    Specular:    L.*<RS>E        

    Diffuse:       L.*<RD>E       

    Glossy:        L.*<RG>E       

    Specific Scene Light Contributions:

    Scene illuminated by "SpotLight 1" emissive only:    <L'SpotLight 1'>.*E          

    Indirect Lighting, more than 1 bounce:    L.{2,}E 

    It seems like the LPE seems to shine when you want to isolate one or more light sources and manipulate them in post. Or if you want to manipulate the reflections (diffuse, specular, etc.). So far I haven't found where you can access stuff like shadows, distance, and albedo, but I think maybe if you mix the LPE canvases with the regular Iray canvases in Studio you can get most of what you need.       

    Post edited by ebergerly on
  • ebergerlyebergerly Posts: 3,255

    By the way, you have't lived until you've manipulated the color and intensity of individual scene lights in your compositing program. It's pretty incredible. Saves a ton of time having to go back and re-render. Just move a slider and the light gets brighter and darker. Like magic. 

  • ebergerlyebergerly Posts: 3,255

    Oh, and for those who worry about needing tons of CPU power for professional 3D apps, the compositing program I started playing with is called Nuke, and it was used in Iron Man and a bunch of others. And it uses the GPU (if available). So I just set it for my 1080t and it runs fine. And fast. Like when it's doing depth of field and tons of canvases and stuff. 

  • ebergerlyebergerly Posts: 3,255
    edited October 2017

    Here's a simple scene with 3 lights:

    1. An Environment,
    2. An emissive plane above the scene, and
    3. An emissive spotlight pointing down to the center of the scene.

    Here's a GIF showing when I brought the final render into Nuke, and used an LPE to control only the Environment light. Using a simple Exposure node slider I can adjust the Environment intensity (and color if I want) in realtime in post. Pretty cool.

    Post edited by ebergerly on
  • That's neat. Another software toy for me to get, I suppose.

  • ebergerlyebergerly Posts: 3,255
    edited October 2017

    For anyone interested in this LPE thing, I found a few more tidbits...

    First, the built-in Specular, Diffuse, and Glossy are vastly different from the LPE versions I referenced above. In fact, the built-in versions don't add up to the Beauty pass, so I *think* there's something wrong with them. But I haven't figured out exactly what they are. Other than weird. For example, the built-in Diffuse looks nothing like a Diffuse. So I'll probably ignore them from now on and use the LPE versions. 

    Also, the EXR files generated as Canvases are not the normal 0 to 1  RGBA values, they're 0 to over 10,000 or something. Apparently DAZ didn't do the internal tone mapping that should be done (if I read previous posts right about DAZ's response), so you'll need to do your own with each EXR. The way I do it is to add an Exposure node in Nuke and set the Stops to -13.6 or thereabouts. 

    Also, the best reference I've found is the Iray Programmers Manual:

    https://www.migenius.com//doc/realityserver/latest/resources/general/iray/manual/index.html#/concept/light_path_expressions.html

    In fact that link has tons of great info on Iray in general. And if you want to make your own Iray renderer it even has sample C++ code showing you how to load a scene and render it in Iray. That may be on my list of fun things to try in the near future...

    BTW, below is a comparison of the LPE version of a Diffuse canvas (on the left) and the built-in version on the right. Weird. Clearly the one on the left is a Diffuse pass and the one on the right isn't. 

    Diffuse.PNG
    788 x 449 - 291K
    Post edited by ebergerly on
  • Do you have tone mapping enabled?  I believe having it on can cause canvases to show up differently than what you would expect.  Also some compositors may need to be told to set the gamma to 2.2 for some .exr files (I know I had to do this with Blackmagic Design's Fusion).

  • ebergerly said:

    For anyone interested in this LPE thing, I found a few more tidbits...

    First, the built-in Specular, Diffuse, and Glossy are vastly different from the LPE versions I referenced above. In fact, the built-in versions don't add up to the Beauty pass, so I *think* there's something wrong with them. But I haven't figured out exactly what they are. Other than weird. For example, the built-in Diffuse looks nothing like a Diffuse. So I'll probably ignore them from now on and use the LPE versions. 

    Also, the EXR files generated as Canvases are not the normal 0 to 1  RGBA values, they're 0 to over 10,000 or something. Apparently DAZ didn't do the internal tone mapping that should be done (if I read previous posts right about DAZ's response), so you'll need to do your own with each EXR. The way I do it is to add an Exposure node in Nuke and set the Stops to -13.6 or thereabouts. 

    Also, the best reference I've found is the Iray Programmers Manual:

    https://www.migenius.com//doc/realityserver/latest/resources/general/iray/manual/index.html#/concept/light_path_expressions.html

    In fact that link has tons of great info on Iray in general. And if you want to make your own Iray renderer it even has sample C++ code showing you how to load a scene and render it in Iray. That may be on my list of fun things to try in the near future...

    BTW, below is a comparison of the LPE version of a Diffuse canvas (on the left) and the built-in version on the right. Weird. Clearly the one on the left is a Diffuse pass and the one on the right isn't. 

    Really weird. Thanks for the manual link.

  • ebergerlyebergerly Posts: 3,255

    Do you have tone mapping enabled?  I believe having it on can cause canvases to show up differently than what you would expect.  Also some compositors may need to be told to set the gamma to 2.2 for some .exr files (I know I had to do this with Blackmagic Design's Fusion).

    Thanks. Yeah if you look at the Diffuse from the non-LPE on the right you can see that it's not a matter of just cranking the gamma up (ie, the mid-tones). If you compare with the correct one on the left, you can see the torus has zero diffuse (it's black), but on the right it's clearly reflecting, not diffuse like it should. So as far as I can tell it's just wrong. Not quite sure what it is, but it sure ain't diffuse.  

  • TheKDTheKD Posts: 2,674

    Anyone happen to know a LPE formula to get a proper materialID pass? Whatever the preset is doing, it's not a materialID pass I expect(a different solid color for each material set). It's a very useful thing to have for creating quick masks.

  • ebergerlyebergerly Posts: 3,255
    I found the preset material id to work okay as along as you do what i suggested to drop the exposure.
  • SzarkSzark Posts: 10,634

    Has anyone got or know of a walkthrough for plebs like me on how to use and set up LPE?

  • TheKDTheKD Posts: 2,674
    edited October 2017

    1) go to advanced tab of render settings.

    2) go to canvases and check it on

    3) click the plus button to add a canvas

    4) click on the type drop down with the new canvas selected and select LPE

    5) type the "equation thingie" in the box called expression.

    6) optional add nodes needed

    Post edited by TheKD on
  • SzarkSzark Posts: 10,634

    Thanks but

    5) Is what I am having trouble with. How do I use Material Colour ID and the "equation thingie"? It is all geek to me this side of things. LOL

  • TheKDTheKD Posts: 2,674
    edited October 2017

    Oh I have the same problem when it comes to those expressions lol. In the dropdown there is one called materialid in the presets, but I have never gotten it to work for me correctly. For a quick example, I get this render, with this materialid pass. Not what I am looking for at all lol. Where it is white looking, is all totally transparent in the PNG it spits out.



     

    testingColor.jpg
    900 x 1456 - 316K
    testing-Canvas2-MaterialID.png
    900 x 1456 - 61K
    Post edited by TheKD on
Sign In or Register to comment.