Relighting with Iray Canvases

EsemwyEsemwy Posts: 577
edited January 2019 in Daz Studio Discussion

I felt it was time this subject got treated to a detailed explanation (with pictures), so I sat down and started making screen grabs. Presented here is what I've got so far, but there's still work to do to make this really usable. I present this in the hope that others will experiment and together we can fill in the missing pieces.

Some of the most impressive use of Iray I've seen so far is the use of Light Path Expressions (LPEs) to do advanced compositing in post. Rather than me explain the cool results, take a look here. I'm sure you've seen methods like this before, but Iray allows us to do it a bit differently. That was all done with a single render pass. I will grant that my 3D experience is rather sparse, being an engineer by trade, but I think that's seriously cool!

First, lets get a scene loaded. I started wth a very simple one, G2F (clothed and posed), A camera directly in front of the character, and a 100cm Photometric Spotlight in each of the four quadrants pointed directly at G2F. On the lights, I set them all to 100x100 rectangles at 100,000 lumens each. No light has a larger contribution than any other. 

The render environment is set to Scene Only in this particular case, but It doesn't matter since we'll be getting separate files for each lights.

DAZ Studio exposes LPEs through the canvas functionality on the Advanced Rendering tab, and makes them much simpler that writing raw expressions as seen in NVidia documentation. By default, canvases are disabled. You turn them on by selecting the Advanced tab, going to the Canvases sub-tab, and turning on canvases.

We start by creating a light group for each of the four lights, named "Key", "Fill", "Rim Left", and "Rim Right". Creating a canvas is done by clicking the "+" right below the check box that enables canvases. Adding a canvas creates a new entry named "Canvas1.Beauty". The beauty pass is what your normal render is created from, so if you don't have that canvas in the list of those you're rendering, you're normal output file will just contain a transparent background.

To create the light group canvases, click on the "Type" dropdown and choose "Light Group". I'd also recommend changing the canvas name to something meaningful, like the names of the light that will be in the group.

Now you have to choose the lights that will be in the group. From the "Nodes" dropdown, you can "Create from Selection..." which will create a Light Group from whatever is currently selected in your scene tab.

You will be prompted for the light groups name.

Alternatively, you can create node lists separately and fill in the light group names later. I find this a bit easier, and at the very least it allows you to check your work when you're done.


Here's the resulting Canvas panel (or sub-sub-panel) with the blank space removed.



Now, we're ready to render. You can render to a new window or directly to file. The canvases will be written when the render is done, or saved as the case may be. Strangely, I've found that if the render runs unnaturally fast, It usually means that I don't have enough light in my scene and the resulting canvases will have fireflys. Strangely enough, you can still get a decent looking low definition result (the PNG, TIF, BMP, JPG), because those are run through a firefly filter. The canvases, though will tell the tale.

Once saved, your canvases should be in a directory named whatever you saved your results as with "_canvases" tagged onto the end. In my case, that directory was "Iray Relighting_canvases".

Now that that's done, we're ready to load the results into Photoshop. I'm running CC 2015, but anything recent should have the functionality we need. GIMP may be usable as well, but I haven't tested it. Either way, your workflow may vary slightly, but the result should be all four EXR files loaded as layers in a single document. I used "File -> Scripts -> Load Files into Stack...", which comes with recent versions of Photoshop, but there are many other ways.


Once your layers are loaded, the Layers panel should look something like this.

and your actual image should look pretty dreadful, no matter which layer is on top.

The order of the layers doesn't matter, just that everything is in one place. Now, before we do anything else, select all four of the layers with CTRL (on PC) or CMD (on MacOS) Click and group them with CTRL/CMD "G". Now with the group selected rather than the individual layers, we need to add an adjustment layer. This is done by clicking the little half-closed circle at the bottom of the Layers panel. We'll be adjusting exposure. You could also do the same by adjusting Curves, Levels, or Brightness/Contrast. Exposure works well enough in this case.

Adjust the exposure downward until things are within the realm of sanity (i.e. you can see your subject). You may need to toggle your individual layers on and off to make sure that they're all exposed correctly. When you are done with that, your layers panel should look like this.

And your individual exposures should look like this.

 

 

Now, reselect all your grouped layers with CTRL/CMD Click, and change the Blending mode from "Normal" to "Linear Dodge (Add)". This should result in a file that looks like the one below, very well lit, but rather flat. We create the illusion of 3 dimensions in 2D by how shadows fall. If everything is lit evenly, a subject will look flat.

What we do now is change the contribution of each individual layer to get the effect we want. In this particular case, I just wanted to fill in the shadows a bit and lightly outline the character with rim lights. To do this, I left Key at 100% opacity and reduced Fill to 31%, Left Rim to 37% and Right Rim to 13%. This gives us the resulting image as seen below.

The problem with this method is that with linear dodge, total contributions of the layers must add up to at least 100%, or the subject begins to become transparent. This can be solved by placing a layer filled with black at the bottom.

This may all seem pretty pedestrian at this point, but I spent zero time test rendering to work out the proper contribution of each light. I just blasted away and adjusted the exposure and balance using simple filters and changing layer opacity. With a little bit of Photoshop hackery we could change the color contribution of individual lights, mask them, or anything your imagination can come up with.

Give it a shot, and feel free to share your results and anything you learn along the way.

Content also available in PDF

Post edited by Esemwy on
«1

Comments

  • mjc1016mjc1016 Posts: 15,001

    Nice...good job.

    I'd probably mirror this on someplace like dA or as a pdf somewhere.  (too many older threads like this have been lost to the aether...when forum software is changed).

  • EsemwyEsemwy Posts: 577

    I have all the text and images saved locally, but you're probably right. I'll beautify the layout and turn it into a PDF for dA.

  • ChoholeChohole Posts: 33,604

    Not this time, they managed to bring all the old threads over.

  • hOsshOss Posts: 24

    Wow. This is awesome stuff!

    -Patrick

  • mjc1016mjc1016 Posts: 15,001
    Chohole said:

    Not this time, they managed to bring all the old threads over.

    Mostly...but they aren't editable...and if somehting like losing in-line images happens the next go-round, that would mess them up, even if they were brought over intact.

    And the ones from the now, long dead, forumarchive are some of the ones that are needed/wanted most.

  • EsemwyEsemwy Posts: 577

    Regardless, better safe than sorry.

  • ToborTobor Posts: 2,300

    Just wanted to add the sound of my applause, too. Very nice writeup.

     

  • Jim_1831252Jim_1831252 Posts: 728
    edited September 2015

    Have been thinking of playing with this but didn't know where to start. Many thanks Esemwy, I think I'll be testing this out with whatever I render next.

    Oh, and kudos for the PDF. Downloaded :)

    Post edited by Jim_1831252 on
  • mjc1016mjc1016 Posts: 15,001

    The pdf is perfect...

  • Hey thanks for this!  Excellent to know!

  • Great thanks!

  • Esemwy said:

    I felt it was time this subject got treated to a detailed explanation (with pictures), so I sat down and started making screen grabs. Presented here is what I've got so far, but there's still work to do to make this really usable. I present this in the hope that others will experiment and together we can fill in the missing pieces.

    Truly appreciate your efforts and time, Esemwy - thank you!

    - Greg

  • Nice work, thank you did not know this.

  • barbultbarbult Posts: 23,049

    Thank you. I'd really like to save the PDF, but I'm getting a 404 file not found error.

  • EsemwyEsemwy Posts: 577

    Fixed the link. Sorry for the inconvenience. It's also available at my dA account here.

  • barbultbarbult Posts: 23,049

    Thanks, I got it successfully from your DA account link.

  • GrokDDGrokDD Posts: 59

    I'm away from my render machine at the moment. Do you guys think we can simulate a negative light like in Carrara? It seems like it would just be just finding the right blending mode.

    Or does Daz Studio Iray have negative lights that I just don't know about?

  • Lissa_xyzLissa_xyz Posts: 6,116

    Couldn't figure this out properly when I tried on my own. Bookmarked and downloaded, thank you.

  • EsemwyEsemwy Posts: 577

    Truthfully hadn't heard of "negative lights" until I saw it here. In this thread, it is implied that it might be possible by some combination of LPE (on which canvases are based) and post processing in Photoshop. 

  • ToborTobor Posts: 2,300

    If by "negative light" you mean a light source that removes light from the scene, then yes, Iray supports that. It's best with an emissive (not sure if the primitive light types support it). Simply dial a negative value for luminance. Careful: a little goes a long way.

    The net effect is "photons" removed from the area that the emissive would have cast light upon.

    As a BTW, Poser has supported this for years. It's a great way to create noir scenes, as you can place small point lights in various places that "suck away" light, casting things in shadow.

  • ChoholeChohole Posts: 33,604
    Tobor said:

    If by "negative light" you mean a light source that removes light from the scene, then yes, Iray supports that. It's best with an emissive (not sure if the primitive light types support it). Simply dial a negative value for luminance. Careful: a little goes a long way.

    The net effect is "photons" removed from the area that the emissive would have cast light upon.

    As a BTW, Poser has supported this for years. It's a great way to create noir scenes, as you can place small point lights in various places that "suck away" light, casting things in shadow.

    And (I am going to crow here) this has always been a feature of Bryce.

  • Thanks

  • ZilvergrafixZilvergrafix Posts: 1,385
    Esemwy said:

    Fixed the link. Sorry for the inconvenience. It's also available at my dA account here.

    interesting, thanks for your knowledge. yes

  • TheKDTheKD Posts: 2,666

    I tried this on a few scenes, the 32bit exr maps tonemapped horribly. The colors looked really bad, no matter what I did. I ended up going back and rerendering the normal way. I am used to doing 32bit light passes in houdini then compositing them like that later. It doesn't work the same with canvases for some reason.    

  • JimbowJimbow Posts: 557

    It's been a while since I rendered exr, but there's a way of getting them to look right. It's something to do with switching tonemapping off completely, IIRC. I have examples in my gallery. If you Google 'iray exr output' I think you might find some clues.

  • TheKDTheKD Posts: 2,666
    edited March 2016
    Jimbow said:

    It's been a while since I rendered exr, but there's a way of getting them to look right. It's something to do with switching tonemapping off completely, IIRC. I have examples in my gallery. If you Google 'iray exr output' I think you might find some clues.

    Hmmm, thanks for the tip, I will give it a try next render. It kinda makes logical sense I guess. Being tonemapped twice could have some odd effects.

     

    Yes, I am pretty sure you nailed it, thanks a lot for the tip! Looks waaaaaaaaaay more natural colored now when tonemapping in photoshop.

    Post edited by TheKD on
  • KurzonDaxKurzonDax Posts: 228

    Btw, Photoshop automatically tone maps the 32-bit EXR for display, and it's default algorithm isn't always very good.  You can change the algorithm used by clicking on the view menu, then 32 Bit Preview Options.  By default it uses local adaptation, if I remember right, which works ok sometimes, but doesn't always handle rendered images very well.  I use "Exposure and Gamma" most of the time for the preview, and again when I convert the image to 8 or 16 bit mode.

     

  • JimbowJimbow Posts: 557
    TheKD said:
    Yes, I am pretty sure you nailed it, thanks a lot for the tip! Looks waaaaaaaaaay more natural colored now when tonemapping in photoshop.

     

    Top banana.

  • GrokDDGrokDD Posts: 59

    To answer my own question and to stay on topic.
    ​1) Yes, Iray supports negative lights, (you have to go into the "Intesity" Parameter settings gear icon and change the minimum to a negative value. Then change the intesity value to a negative value.

    ​2) Negative lights captured as an exr file are just black.

    ​3) Fiddling around with positive lights' exr, unfortunatly many of the Layer modes are unavailable to the 32bit file formats. Preventing me from being able to fake the negative lights from positive lights.

    All in all though, I am greatful for this thread and learned a lot from it.
    ​Thank you again Esemwy!

  • ToborTobor Posts: 2,300
    edited March 2016

    No, they're all there, though some are more useful than others. If you view a 32-bit file in Photoshop (etc.) without adjusting tone mapping, you can get a crushed black or white mapping. In Photoshop you'd use Image-Adjustments-HDR Toning.

    More than likely, your final output will be an 8-bit image. As you've disabled tone mapping in Iray (or should if you're outputting to an EXR), you have to provide a mapping somewhere in order to depict the scene the way you want it. 32 bits have to be down-mapped to 8 bits.

    Post edited by Tobor on
Sign In or Register to comment.