Announcement

Collapse
No announcement yet.

Light path expression to isolate object contribution to scene

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Light path expression to isolate object contribution to scene

    i tried to continue a previous discussion on the beta forum here:

    https://forums.chaosgroup.com/forum/...use-them/page2

    but the forum is now locked.

    I have several scenes where i need to do various version of the same product on different coloured backgrounds.

    on a previous version of the job i made a seperate file, with the product materials all desaturated, the background geometry set to red, and the product excluded from illumination.

    that gave me a nice mask to modify the reflection, refraction and gi contributions of the background in post.

    the main render was done with a 50% grey background, which was then colourised using the mask. ive no idea if it was technically accurate, but it worked well enough that you couldnt see any obvious errors or strangeness.


    i was really hoping for the new range of images, i could use LPE to generate a mask of only the contribution of the background geometry to the scene.

    Lele showed me how to do it and it seemed good to go..

    render an LPE, subtract from render, add back in and colour correct it.

    however, i just cannot get what i want.

    the LPE also contains the colours of the object materials which are being affected.. this may be mathematically correct, however if i use the above workflow and try to hue shift the LPE after adding it back to the render, it screws up the colours of all the materials. especially coloured refractive objects.

    is there an Expression i can use which will exclude the colours of the materials on the product from the LPE?

    or do i have to subtract the diffuse filter from the lpe or something?

    i have a feeling there is a way to do what i want, without creating seperate scenes to make masks (its a boring fiddly job)

    the attractive alternative at the moment is just to render the damn thing multiple times with different bg colours, but thats a ton of rendering.


    here is a quick illustrative (exaggerated) test:

    as per suggestions recieved, LPE used was


    C.*.'mset'.* (set is the material name on the background)

    Click image for larger version

Name:	render.jpg
Views:	398
Size:	438.4 KB
ID:	1074989
    original render



    Click image for larger version

Name:	LPE mask.jpg
Views:	517
Size:	361.9 KB
ID:	1074987
    LPE for background object (defined by material name)



    Click image for larger version

Name:	LPE colour shift result.jpg
Views:	421
Size:	549.4 KB
ID:	1074988
    LPE subtracted from render, added back, and hue shifted (all in PS, 32 bit exr)



    as you can see its not quite the result im after.


    (the actual scene is rendered as a full comp, rebuilt in PS, with shadows seperate, background geometry hidden, and actual background done in post, so the shifts on the shadows etc are not a problem.. but the actual objects need to retain their shading , with just the bg colour bleed, refraction and reflection being changed.
    i dont even need independent control of the reflection refraction etc... a single correction on a flattened comp as a last step would be ok.
    Last edited by super gnu; 17-06-2020, 03:10 PM.

  • #2
    Originally posted by super gnu View Post
    is there an Expression i can use which will exclude the colours of the materials on the product from the LPE?
    No, that's not possible, if I understand correctly.

    Maybe try with the same LPE but render with a grey background geometry. Then change the color by multiplying the LPE element by a filter color instead of hue shifting or any other correction. This should preserve the colors of the materials.
    Radoslav Platikanov | V-Ray R&D

    Comment


    • #3
      Or, as i was mentioning in the other post, you create more than one LPE, one for each contributing aspect of the shader (f.e. diffuse, specular/reflection, refraction...), render the corresponding filters, and extract the raw elements that way.
      Notice this may or may not work exactly (i'm unsure as to multi-bounce results. will need to test it better.), so perhaps you'll still need some fiddling.
      Lele
      Trouble Stirrer in RnD @ Chaos
      ----------------------
      emanuele.lecchi@chaos.com

      Disclaimer:
      The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

      Comment


      • #4
        Originally posted by ^Lele^ View Post
        Or, as i was mentioning in the other post, you create more than one LPE, one for each contributing aspect of the shader (f.e. diffuse, specular/reflection, refraction...), render the corresponding filters, and extract the raw elements that way.
        Notice this may or may not work exactly (i'm unsure as to multi-bounce results. will need to test it better.), so perhaps you'll still need some fiddling.
        thanks Lele, sorry i dont think i understood when you previously mentioned it.. unfortunately, our compositor is in a different country to me, doesnt have a vray forum account, and my understanding of layering comps and the mathematics behind it is rather...lacking. im copy pasting replies to him on skype.

        Comment


        • #5
          Originally posted by super gnu View Post

          thanks Lele, sorry i dont think i understood when you previously mentioned it.. unfortunately, our compositor is in a different country to me, doesnt have a vray forum account, and my understanding of layering comps and the mathematics behind it is rather...lacking. im copy pasting replies to him on skype.
          Lol sorry!
          In fact, rereading, that must have stayed in the keyboard.
          The rather long thread with the (inplicit, sorry!) mention of filter passes (quoted below)

          Lastly, here's an example of a "rough" LPE recomp.
          It's rough because i do not split any of the indirect contributions into specular/Reflection/diffuse (You'd need three LPEs to separate them, one per component.), and so the result is operating on the three at once, including the texture.
          It may be allright for some cases, and entirely inappropriate for others (also depending on the kind of Post operations one will use.).
          For a hue shift, like in my case, on the whole contribution of the object, it can easily be done with the method outlined here, which uses a minus, and a plus, with a CC on the LPE.
          Lele
          Trouble Stirrer in RnD @ Chaos
          ----------------------
          emanuele.lecchi@chaos.com

          Disclaimer:
          The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

          Comment


          • #6
            this bit lead me to believe that i would be ok with the simple method:

            "For a hue shift, like in my case, on the whole contribution of the object, it can easily be done with the method outlined here, which uses a minus, and a plus, with a CC on the LPE."

            for some reason, my hue shift is totally wierd. despite the floor and bounce on white sphere looking very similar in hue in the diffuse, they hue shift to totally different colours..

            also, id imagine that subtracting the LPE from the diffuse would give a black background, but it just gives a darker pink/purple
            Last edited by super gnu; 18-06-2020, 01:00 PM.

            Comment

            Working...
            X