Announcement

Collapse
No announcement yet.

cryptomatte by object attribute - how to?

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

  • cryptomatte by object attribute - how to?

    Hi all,

    I am trying to get CryptoMatte working by object attributes, so I can continue to use one ReadGeo with one material branched several times via TransformGeo nodes.
    I thought I just have to assign user attributes to each branch via VrayObjProp, I can't get it to work though.
    I also tried CryptoMatte's group mode but couldn't get that work work either. Not sure if it's Vray, CryptoMatte or user error.
    Example script attached in which I'd like to get a crypto matte for each individual sphere without duplicating material or sphere node.
    Could somebody please have a look?

    Cheers,
    frank
    Attached Files

  • #2
    Hi Frank,

    Looking at your setup, the only thing that's missing is to assign some values to the user attributes in the VRayObjProp nodes. They work like this: <attributeName>=<value>. In your case, in each VRayObjProp node after each sphere, you can just put CryptomatteName=1, CryptomatteName=2 and so on for each one. Then the VRayCryptomatte render element will produce a separate mask for each object when used in the Node User Property Mode.
    However, depending on the project, different approaches might be better. For example: with the Node User Property, you only include the nodes that have the respective user attribute name, but will not include other objects (that have no user attributes assigned at all). If that's the goal - then this would be a good approach. If you simply want a separate mask for all objects in your scene, then using the "Node Name" mode of the VRayCryptomatte will save you the trouble of assigning user attributes.

    The Node Name works for me with your scene, I don't see any problems there. I'm trying 10.5 with VRay 3.6 (the latest official relese).
    Let me know if what I've suggested works for you and if you're still having issues with the Node Name mode, please let me know the VRay version you're using.
    Alex Yolov
    Product Manager
    V-Ray for Maya, Chaos Player
    www.chaos.com

    Comment


    • #3
      Ah, edit: the Node Name won't work in your case, since the objects are merged from the same readGeo (or primitive as in the example). In which case the user attributes approach is better.
      But I think you could avoid adding all the VRayObjProp and user attributes if you cloned the readGeo.
      It would look somewhat like this: ReadGeo > clone > transformGeo > mergeGeo. Then the simple Node Name mode of the VRayCryptomatte should work (at least it does in a simple test on my end).
      Would that work for you?
      Attached Files
      Alex Yolov
      Product Manager
      V-Ray for Maya, Chaos Player
      www.chaos.com

      Comment


      • #4
        Ah, thanks. I was not aware of the required syntax for the attribute. Is this mentioned int he docs? If so I couldn't find it.
        And yes, I could clone/copy the ReadGeo, but this is a heavily simplified example and in my production it's exactly what I was trying to avoid.
        I will have another play, thanks!

        frank

        Comment


        • #5
          Hi Frank,

          In the test scene you provided, you can simply use Node name as id type and it will behave as you want.
          The reason is that the name is retrieved from the last geometric node connected to a merge node/scene node. So here one of the direct node name is the sphere node name, but the other is the transform geo node name.

          You can easily see what id are used by connecting a "ViewMetaData" to to VRayRenderer node and looking at the manifest key (screenshot attached for reference)
          Click image for larger version

Name:	2018-01-08 16_18_58-cryptomatte_example.nk [modified] - NukeX.png
Views:	846
Size:	45.1 KB
ID:	979695

          The node name with hierarchy might also be useful for larger scene where 2 different nodes might have the same name, however each be handled through a different branch of the DAG. Again use the ViewMetaData and it will give you a good idea about what it does.

          You also mentioned you had problems with the Group id type. Can you share some more info about what you did and what did not go as expected ?

          Chris
          Attached Files
          Christophe COT
          Software Developer - Chaos
          christophe.cot@chaos.com

          Comment


          • #6
            Great, thank you. I could have sworn I tried the Node name option. All good now, thanks!

            Comment

            Working...
            X