Announcement

Collapse
No announcement yet.

Complex Material Swapping at Render Time?

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

  • Complex Material Swapping at Render Time?

    Hi all, I've got a problem that I'm trying to find a scalable solution for - see the attached images for context. Similar to how the V-Ray clipper can clip within a mesh volume at render time, is there a way to swap (or override) a material within that volume without clipping the geometry? The reason this needs to be scalable is because the volume shape needs to be arbitrary, or may be animating, and making every effected material into a multi-sub would be prohibitively time-consuming considering how many images we need to get out.
    I've also thought of doing this in post. Generate a mask from a VRayDistanceTex and the volume object set to not renderable, then render two versions of the scene - one with full materials and the other with the color paint materials.

    I suppose this is similar in effect to doing a Union Imprint boolean and then swapping the operand material, but I'm hoping to find a less destructive method...
    Last edited by thwalker; 24-01-2019, 01:38 PM.

  • #2
    Sure you can do this with a VrayBlendMtl, An object that defines the shape of your 'cutout' controls the VrayDistanceTex, which is the blend map between the 2 materials (white vs color in this case). The object can be animated so the blend map changes every frame. Some videos and a scene attached. Click image for larger version  Name:	Test20026.jpg Views:	1 Size:	17.8 KB ID:	1024263
    Click image for larger version  Name:	Test0026.jpg Views:	1 Size:	72.0 KB ID:	1024262





    Attached Files
    Last edited by Vizioen; 26-01-2019, 03:30 AM.
    A.

    ---------------------
    www.digitaltwins.be

    Comment


    • #3
      I might not have read your entire post haha. Depends on how many materials are effected but looking at the examples there aren't that many.
      A.

      ---------------------
      www.digitaltwins.be

      Comment


      • #4
        Originally posted by thwalker View Post
        Hi all, I've got a problem that I'm trying to find a scalable solution for - see the attached images for context. Similar to how the V-Ray clipper can clip within a mesh volume at render time, is there a way to swap (or override) a material within that volume without clipping the geometry? The reason this needs to be scalable is because the volume shape needs to be arbitrary, or may be animating, and making every effected material into a multi-sub would be prohibitively time-consuming considering how many images we need to get out.
        I've also thought of doing this in post. Generate a mask from a VRayDistanceTex and the volume object set to not renderable, then render two versions of the scene - one with full materials and the other with the color paint materials.

        I suppose this is similar in effect to doing a Union Imprint boolean and then swapping the operand material, but I'm hoping to find a less destructive method...
        It looks to me as if post is your only really scalable option.
        Given mask shapes have to be arbitrary (some samples seem screen-based, or could be approached as such, other geometry sensitive), your best bet is surely to render two versions, and treat the mask in a third pass, which then needn't be that compute-heavy.
        It's non-destructive, and doesn't lock you into a fixed mask, as you'd have the A and B versions and could blend at will with as many different mask shapes (combined or just different versions) as you felt like rendering.

        On top of this, you'd be free to play with masks and REs to achieve deeper customisation (ie. treat just the GI, or one light contribution, or specific shaders, and so on), something hard to achieve and set up, and very unwieldy to change, directly in 3d.
        Deeps may help for better geometrically sensitve masking.
        Last edited by ^Lele^; 26-01-2019, 05:23 PM.
        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


        • #5
          I think the easiest would be to do ExtraTexture pass as part of the same render using your VrayDistanceTexutre, you can then use that mask to colourize in post. I would suggest rendering to exr and recombining passes so you can colourize just the diffuse and GI separately .

          Comment


          • #6
            Thanks for all of the ideas everyone! Because of the time constraint and realization that post work is prohibitively time consuming (considering the thousands of images we need to do). There was also a need to have this done in the look-dev phase while still in Max, and we couldn't really afford the time to render out, go to PS, see what it looks like, then go back in Max.
            I opted to just do a per-material blend with a VRayDistanceTex. Wrote a little script to go through everything pretty quickly and create the blend material and distance tex node with the selected objects (though I can't distribute this). It pretty much looks like Vizioen's node graph above, just done for every material affected.

            Comment


            • #7
              Originally posted by thwalker View Post
              Thanks for all of the ideas everyone! Because of the time constraint and realization that post work is prohibitively time consuming (considering the thousands of images we need to do). There was also a need to have this done in the look-dev phase while still in Max, and we couldn't really afford the time to render out, go to PS, see what it looks like, then go back in Max.
              I opted to just do a per-material blend with a VRayDistanceTex. Wrote a little script to go through everything pretty quickly and create the blend material and distance tex node with the selected objects (though I can't distribute this). It pretty much looks like Vizioen's node graph above, just done for every material affected.
              ah! if i knew you could script, and you did not use Nuke, i'd have given you a different suggestion, perhaps.
              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

              Working...
              X