Announcement

Collapse
No announcement yet.

Automatically apply an mtl override on objects with no material assigned

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

  • Automatically apply an mtl override on objects with no material assigned

    Hey all,
    Maybe I'm missing something, but is it possible to have V-Ray applying a material override that only includes objects with no material applied? That way one can have a decent preview render without all those wonderful object/layer colors messing your GI...
    Any thoughts?
    Tks!
    V-Ray Evangelist, Trainer and Freelancer
    www.behance.net/rickeloy

  • #2
    This should do it:

    1. Use this script to select all objects without a shader:
    Code:
    select (for i in objects where i.material==undefined collect i)
    2. Invert the selection (Ctrl+I)
    2. Create a new layer and add the selection (Add Selection to Current Layer).
    3. Activate the Override Mtl feature (Render Setup>Global Switches>Override Mtl) and set it to Exclude Layers.
    4. Select the newly created layer.
    Aleksandar Hadzhiev | chaos.com
    Chaos Support Representative | contact us

    Comment


    • #3
      Instead of layers, you can also create a selection set, and include that into the override.
      Run the script below, and you'll get a "NoMaterial" selection set visible in the override's include/exclude dialog.

      Code:
      selectionSets["NoMaterial"] = for g in geometry where g.material == undefined collect g
      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
        Thanks, guys!
        My first attempt was doing just that, using a script to select everything without material and adding them manually. Lele's solution looks a bit more elegant in that sense, but doesn't seem to work: the selection set is indeed created, but ti does not select any of the objects, even those I just created for test purposes.
        If I use the set outside of the Exclude/Include dialog, it works fine, but doesn't seem to work in the list (Max2022).
        V-Ray Evangelist, Trainer and Freelancer
        www.behance.net/rickeloy

        Comment


        • #5
          Originally posted by Rick Eloy View Post
          the selection set is indeed created, but ti does not select any of the objects, even those I just created for test purposes.
          In my case the nodes are assigned (without being selected!) to the selection set.
          Once i open the include/exclude list for the override, i can pick the noMaterials selSet from the dropdown, which in turn selects the nodes in the list.
          Then i click the add to exclude/include, and i am done.

          See the linked capture of the process.
          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
            Hum... got it. Thanks for the video, I was going straight to the selection set instead of having it first select the objects.
            Thank you once again!
            V-Ray Evangelist, Trainer and Freelancer
            www.behance.net/rickeloy

            Comment

            Working...
            X