Announcement

Collapse
No announcement yet.

How to get user Cryptomatte or custom Cryptomatte in Vray for Houdini?

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

  • How to get user Cryptomatte or custom Cryptomatte in Vray for Houdini?

    To get user cryptomatte in arnold we use attribwrangle
    run over: primitives
    VEXpression: s@crypto = 'torus'; (as example)

    or with attribcreate:
    name: crypto
    class: primitives
    type: string
    string: torus (as example)

    How can I achieve the same thing with vray?

  • #2
    Hey elrachyd ,

    I've attached an example here: https://drive.google.com/file/d/1sA6...ew?usp=sharing

    Also added some notes in the file, I'm copying here for anyone who may stumble upon this post at a later point.

    Custom string attributes for Cryptomatte in "User Attribute" mode is supported only for packed primitives/fragments, or entire Geometry nodes. Assigning the attribute to regular (not packed) poly meshes won't work.
    You can either use:

    1. a custom string point attribute on the packed primitive, in which case you need to tell V-Ray to always export the attribute under either the Object Properties -> Main -> Forced Attributes list, or the Renderer ROP -> Objects -> Forced Attributes list. If an attribute is not used in the shading network, we discard it to speed up export times and reduce the VRScene size (each vector attribute is essentially the same as an additional point so you can imagine 1 million points with position + 9 extra vector attributes is the same as 10 million points as far as raw data export is concerned).
    2. the User Attributes field on the Geometry node -> V-Ray Object Properties -> Main tab, e.g. cryptomatteName='vray'

    Hope that helps!
    Last edited by Gosho.Genchev; 11-05-2020, 11:52 PM.
    gosho.genchev@chaosgroup.com

    Comment


    • #3
      Thank you for the scene example, I really appreciate, but I'm so confused with this setup!
      1- why the custom attributes is running over the class Point, rather than primitive?
      2- for objectProperties you defined, all object get the same color!
      as you can see in the image

      eachPackedPrim look fine

      with 02 separated objects (Sphere & Cube)
      for the Cube I put the same data you provided in your example
      User Attributes:cryptomatteName='vray'
      except for Forced Attributes:crypto( just attr name!)
      and nothing in torus object
      and here is the result different color
      First image is your example
      here is hip file
      Attached Files
      Last edited by elrachyd; 12-05-2020, 02:08 AM.

      Comment


      • #4
        There are 2 Cryptomatte elements in the file.

        The first one is using a User Attribute defined on the entire Geometry node using the V-Ray Object Properties - cryptomatteName='vray'. Then, in the Cryptomatte VOP node, in User Attribute mode, the attribute specified is 'cryptomatteName'. So, it's checking for this attribute, finds it on both the Box and the Torus, and gives them the same color.

        The second one is using a string attribute defined on each packed object. The attribute is called 'myAttr', it has different values for the box and the torus. On the second Cryptomatte VOP node, it's specified as 'myAttr' so when V-Ray starts rendering, it finds the different values for this attribute on the box and the torus, thus giving you different colors.

        I hope that makes sense ?

        One thing that may clarify what happens -- packed objects are treated as individual nodes themselves when we start exporting. So, essentially, when you pack the box and torus and place the string attribute on them, it's essentially the same as if you were to Object Merge them in separate Geometry nodes, add V-Ray Object Properties to those geometry nodes, and define the attribute there.

        1- why the custom attributes is running over the class Point, rather than primitive?
        I doubt it would make any difference from our point of view - any particular reason you would prefer them to be on the packed primitives rather than the points storing them ?

        Best regards!
        gosho.genchev@chaosgroup.com

        Comment


        • #5
          Hi, I was also looking into this issue.

          The setup you created is pretty clear, but I'm can't seem to make it work with connected primitive attribute.

          Here I unpacked the geo (to get access to all prims), created the attribute using the handy Connectivity node, and cache the geo to a new alembic (that pack node is unecessary of course).


          You can see here that this works perfectly with the multi id texture.


          But using the same attribute in the cryptomatte yelds no results (Force attribute with the same name is there, but this is only for VRay scene exports, when inside houdini this should have no effect).


          Any ideia?

          Best,
          David.
          David Anastácio // Accenture Song - VFX
          https://www.accenture.com/us-en/serv...visual-effects

          Comment


          • #6
            packed objects are treated as individual nodes themselves when we start exporting. So, essentially, when you pack the box and torus and place the string attribute on them, it's essentially the same as if you were to Object Merge them in separate Geometry nodes, add V-Ray Object Properties to those geometry nodes, and define the attribute there.
            Then why are rendered with the same color??

            The first one is using a User Attribute defined on the entire Geometry node using the V-Ray Object Properties - cryptomatteName='vray'. Then, in the Cryptomatte VOP node, in User Attribute mode, the attribute specified is 'cryptomatteName'. So, it's checking for this attribute, finds it on both the Box and the Torus, and gives them the same color.
            Why in my example with the same setup gives different color?? just look at my scene!
            Thanks

            Comment


            • #7
              Yes, the reason for this is exactly the same, and why I mentioned it won't work with regular poly geometry but will work just fine with packed primitives. Here's the relevant part from the previous post:

              Packed objects are treated as individual nodes themselves when we start exporting. So, essentially, when you pack the box and torus and place the string attribute on them, it's essentially the same as if you were to Object Merge them in separate Geometry nodes, add V-Ray Object Properties to those geometry nodes, and define the attribute there.

              With alembics, that is pretty much the same - if there is no partitioning going on, we export a single Node, and the Cryptomatte attribute can be queried from a Node only, not the actual mesh data. If you partition the alembic file (e.g. by @path), we'll export a separate Node for each @path value.

              Here's an example: https://drive.google.com/file/d/1OVW...ew?usp=sharing

              The only thing that comes to mind is to partition the object above using the connectivity attribute when exporting the alembic, if that's a possibility.

              Hope that helps!
              gosho.genchev@chaosgroup.com

              Comment


              • #8
                david.anastacio, for the attribute inside the alembic it's not that easy to implement this approach...
                However it should work if apply ids after alembic node.
                Also note that cryptomatte expects attribute of type string.
                Last edited by bdancer; 12-05-2020, 04:48 AM.
                V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
                andrei.izrantcev@chaos.com
                Support Request

                Comment


                • #9
                  Why in my example with the same setup gives different color?? just look at my scene!
                  I did - it's looking as expected on my end.

                  What Houdini and V-Ray builds are you using - might be a fixed issue although I don't recall anything like this not working during the last few months.

                  Click image for larger version

Name:	forum_1070404_cryptoAttrib_elrachyd_scene.jpg
Views:	934
Size:	914.9 KB
ID:	1070505
                  gosho.genchev@chaosgroup.com

                  Comment


                  • #10
                    elrachyd, in the scene cryptoUserAttributes_v1.zip you are settings "myAttr" for the packed, but there is no cryptomatte channel using this attribute, if I add it - it works:
                    V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
                    andrei.izrantcev@chaos.com
                    Support Request

                    Comment


                    • #11
                      really confused, I've never seen this issue with cryptomatte for Arnold
                      OK why myAttr look the same as eachPackedPrim ? it seem like duplicated ! is not?
                      Also there is no alembic file in your scene!
                      Last edited by elrachyd; 12-05-2020, 05:07 AM.

                      Comment


                      • #12
                        > really confused, I've never seen this issue with cryptomatte for Arnold

                        Well, I'm confused as well, because I don't see any issues with V-Ray either...

                        > Also there is no alembic file in your scene!

                        I haven't posted any scenes, but I could upload some...
                        Last edited by bdancer; 12-05-2020, 05:16 AM.
                        V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
                        andrei.izrantcev@chaos.com
                        Support Request

                        Comment


                        • #13
                          elrachyd, so here is a scene with packed and abc (there is alembic ROPs to write abc files).
                          Attached Files
                          V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
                          andrei.izrantcev@chaos.com
                          Support Request

                          Comment


                          • #14
                            Originally posted by bdancer View Post
                            david.anastacio, for the attribute inside the alembic it's not that easy to implement this approach...
                            However it should work if apply ids after alembic node.
                            Also note that cryptomatte expects attribute of type string.
                            Thanks bdancer, that was the missing link, it has to be a string attribute. Looking back to the example scene from Gosho.Genchev, I notice now he did create strig attributes in his wranglers.
                            With the alembics actualy the easiest thing is just to use the "path" attribute, and it works with no issues.

                            best,
                            David.
                            David Anastácio // Accenture Song - VFX
                            https://www.accenture.com/us-en/serv...visual-effects

                            Comment


                            • #15
                              bdancer thanks for the scene
                              The confusion is why myAttr look the same as eachPackedPrim what's the point to have 02 custom cryptomatte with the identical color? that's the confusion for me!

                              Comment

                              Working...
                              X