Announcement

Collapse
No announcement yet.

MultiMatteElement

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

  • MultiMatteElement

    I work in layers, so everything has a place. I found a script that will assign an Object ID to everything on each layer, which is AWESOME. Now I want to automate the MultiMatteElement creation. I have 22 layers, so instead of creating 22 MultiMatteElement manually, typing the next three Object ID numbers in each MultiMatteElement, how can that be automated? Is this wishful thinking?
    Bobby Parker
    www.bobby-parker.com
    e-mail: info@bobby-parker.com
    phone: 2188206812

    My current hardware setup:
    • Ryzen 9 5900x CPU
    • 128gb Vengeance RGB Pro RAM
    • NVIDIA GeForce RTX 4090
    • ​Windows 11 Pro

  • #2
    Someone else maybe has a more elegant method - but for now, you could simply create a load of multimattes with corresponding ids in a blank scene and then merge those into whatever scene you need them.
    Then you just need to delete the ones you don't need
    https://www.behance.net/bartgelin

    Comment


    • #3
      This might do what you're looking for.
      https://www.pixamoon.com/shop/458756...anizer/9332487
      James Burrell www.objektiv-j.com
      Visit my Patreon patreon.com/JamesBurrell

      Comment


      • #4
        I saw that, but I don't need material ID's, I need Object ID.
        Bobby Parker
        www.bobby-parker.com
        e-mail: info@bobby-parker.com
        phone: 2188206812

        My current hardware setup:
        • Ryzen 9 5900x CPU
        • 128gb Vengeance RGB Pro RAM
        • NVIDIA GeForce RTX 4090
        • ​Windows 11 Pro

        Comment


        • #5
          Here you go... Just change the "MMEnumber" to the number of objectID channels you need and execute the script. I'd recommend trying in an empty file first.

          Code:
          --setMMEnumber to desired number of ObjectID's
          
          MMEnumber=0
          
          re = maxOps.GetCurRenderElementMgr()
          el = multimatteelement
          
          if MMEnumber>0 then
          (
          for i = 1 to MMEnumber by 3 do
          (
          reName="MME " + i as string + "-"+ ((i +2) as string)
          re.addrenderelement (el elementname:(reName) R_gbufID:(i) R_gbufIDOn:(on) G_gbufID:(i+1) G_gbufIDOn:(on) B_gbufID:(i+2) B_gbufIDOn:(on) )
          )
          )
          Last edited by dlparisi; 30-10-2020, 03:04 PM.
          www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

          Comment


          • #6
            I will try that. I lost the script I found to do the Object ID by layer. I'll look for that again and give your script a try.
            Bobby Parker
            www.bobby-parker.com
            e-mail: info@bobby-parker.com
            phone: 2188206812

            My current hardware setup:
            • Ryzen 9 5900x CPU
            • 128gb Vengeance RGB Pro RAM
            • NVIDIA GeForce RTX 4090
            • ​Windows 11 Pro

            Comment


            • #7
              I get this

              -- Syntax error: at ), expected <factor>
              -- In line: )
              Bobby Parker
              www.bobby-parker.com
              e-mail: info@bobby-parker.com
              phone: 2188206812

              My current hardware setup:
              • Ryzen 9 5900x CPU
              • 128gb Vengeance RGB Pro RAM
              • NVIDIA GeForce RTX 4090
              • ​Windows 11 Pro

              Comment


              • #8
                Here is the script that allowed me to create Object ID's for everything on each layer.

                (
                try(destroyDialog Test)catch()
                rollout LayerMultiMatte "Layer MultiMattes" width:162 height:77
                (
                button 'Create_Btn' "Button" pos:[10,16] width:142 height:43 align:#left

                fn GetUsedGBufferChannels sel =
                (
                MakeUniqueArray (for o in (if sel == false then objects else selection) where o.gbufferchannel != 0 collect o.gbufferchannel)
                )

                fn GetLayerNameByGBufferChannel index =
                (
                local layer_name
                for o in objects while layer_name == undefined where o.gbufferChannel == index do layer_name = o.layer.name
                layer_name
                )

                fn setLayerObjID ignoreEmptyLayersn =
                (
                local getlayer = LayerManager.getlayer, layer, idx = 0

                if not ignoreEmptyLayers then
                (
                for i = 0 to layerManager.count-1 where ((layer = getlayer i).nodes &objs; objs).count > 0 do objs.gbufferChannel = i+1

                )
                else
                (
                for i = 0 to layerManager.count-1 where ((layer = getlayer i).nodes &objs; objs).count > 0 do objs.gbufferChannel = (idx+=1)
                )
                )

                on Create_Btn pressed do
                (
                setLayerObjID() -- this will ignore empty layer (id order 1,2,3,4,5 ...)

                if matchpattern (renderers.current as string) pattern:"V-Ray*" == true then
                (
                re = maxOps.GetCurRenderElementMgr()

                VRay_mask_elements = for i=0 to re.NumRenderElements() where classof (re.GetRenderElement i) == MultiMatteElement collect re.GetRenderElement i

                for gbuffer_index in GetUsedGBufferChannels false do
                (
                exclude = false
                for m in VRay_mask_elements where m.R_gbufID == gbuffer_index do exclude = true

                if not exclude then
                (
                layer_name = GetLayerNameByGBufferChannel gbuffer_index
                mm = MultiMatteElement elementName:layer_name R_gbufIDOn:true R_gbufID:gbuffer_index G_gbufIDOn:false G_gbufID:0 B_gbufIDOn:false B_gbufID:0
                re.AddRenderElement mm
                )
                )
                )
                )
                )
                createDialog LayerMultiMatte
                )
                Bobby Parker
                www.bobby-parker.com
                e-mail: info@bobby-parker.com
                phone: 2188206812

                My current hardware setup:
                • Ryzen 9 5900x CPU
                • 128gb Vengeance RGB Pro RAM
                • NVIDIA GeForce RTX 4090
                • ​Windows 11 Pro

                Comment


                • #9
                  Originally posted by glorybound View Post
                  I get this

                  -- Syntax error: at ), expected <factor>
                  -- In line: )
                  Did you by chance run it in the listener rather than the editor? I get the same thing if I just run it in the listener and hit enter on the numpad. You can run it from the listener, just highlight everything and hit numpad enter.
                  www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

                  Comment


                  • #10
                    Okay, that worked. I am not sure if it was I didn't have it highlighted or the keypad enter. However, I got that far with the other script. I was hoping to get something to make the many MultiMatteElement
                    elements. Right now I have to make 23 MultiMatteElement and change the RBG digits in each one. It isn't the end of the world, but that will be a pain.
                    Bobby Parker
                    www.bobby-parker.com
                    e-mail: info@bobby-parker.com
                    phone: 2188206812

                    My current hardware setup:
                    • Ryzen 9 5900x CPU
                    • 128gb Vengeance RGB Pro RAM
                    • NVIDIA GeForce RTX 4090
                    • ​Windows 11 Pro

                    Comment


                    • #11
                      The Power Mask script does it, but not with G-buffer.
                      Bobby Parker
                      www.bobby-parker.com
                      e-mail: info@bobby-parker.com
                      phone: 2188206812

                      My current hardware setup:
                      • Ryzen 9 5900x CPU
                      • 128gb Vengeance RGB Pro RAM
                      • NVIDIA GeForce RTX 4090
                      • ​Windows 11 Pro

                      Comment


                      • #12
                        SUCESS!

                        https://www.awesomescreenshot.com/vi...7af45407336139
                        Bobby Parker
                        www.bobby-parker.com
                        e-mail: info@bobby-parker.com
                        phone: 2188206812

                        My current hardware setup:
                        • Ryzen 9 5900x CPU
                        • 128gb Vengeance RGB Pro RAM
                        • NVIDIA GeForce RTX 4090
                        • ​Windows 11 Pro

                        Comment


                        • #13
                          Originally posted by glorybound View Post
                          Okay, that worked. I am not sure if it was I didn't have it highlighted or the keypad enter. However, I got that far with the other script. I was hoping to get something to make the many MultiMatteElement
                          elements. Right now I have to make 23 MultiMatteElement and change the RBG digits in each one. It isn't the end of the world, but that will be a pain.
                          That's all that script does is make MMEs. Give it the number of g buffer ID's you need and it will generate multiple MMEs with sequentially numbere rgb channels.
                          www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

                          Comment


                          • #14
                            It didn't do anything for me. I did find a script that worked.
                            Bobby Parker
                            www.bobby-parker.com
                            e-mail: info@bobby-parker.com
                            phone: 2188206812

                            My current hardware setup:
                            • Ryzen 9 5900x CPU
                            • 128gb Vengeance RGB Pro RAM
                            • NVIDIA GeForce RTX 4090
                            • ​Windows 11 Pro

                            Comment


                            • #15
                              Did you change the "MMEnumber" in the script? Otherwise it won't do anything.
                              www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

                              Comment

                              Working...
                              X