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

**URL:** <https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527>\
**Category:** General\
**Created:** [May 11, 2020, 7:52pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527 "2020-05-11T19:52:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![elrachyd](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elrachyd](https://forums.chaos.com/u/elrachyd)\
**Post date:** [May 11, 2020, 7:52pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/1 "2020-05-11T19:52:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Gosho.Genchev](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@Gosho.Genchev](https://forums.chaos.com/u/Gosho.Genchev)\
**Post date:** [May 12, 2020, 6:49am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/2 "2020-05-12T06:49:23Z")

</div>

Hey @elrachyd ,

I’ve attached an example here: [https://drive.google.com/file/d/1sA6…ew?usp=sharing](https://drive.google.com/file/d/1sA6jnGCOSUfSQCJyrj2L2nr2TnnmNK40/view?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!

---

<div class="post-metadata">

**Author:** ![elrachyd](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elrachyd](https://forums.chaos.com/u/elrachyd)\
**Post date:** [May 12, 2020, 9:04am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/3 "2020-05-12T09:04:04Z")

</div>

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

 ![objectProp.jpg](https://europe1.discourse-cdn.com/chaosprd/original/3X/5/5/553aa1e708a8d189bbd88bded54c03607fc6dbef.jpeg)  
 ![objectPropSeparated.jpg](https://europe1.discourse-cdn.com/chaosprd/original/2X/5/54a763ac1758c04802b6520cd1b6d5e72138ac68.jpeg)  
[cryptoUserAttributes\_v1.zip](https://forums.chaos.com/uploads/short-url/2bbYwWsmpWCzWoOEJmJKtjlEYtX.zip) (47.5 KB)

---

<div class="post-metadata">

**Author:** ![Gosho.Genchev](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@Gosho.Genchev](https://forums.chaos.com/u/Gosho.Genchev)\
**Post date:** [May 12, 2020, 9:54am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/4 "2020-05-12T09:54:51Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![elrachyd](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elrachyd](https://forums.chaos.com/u/elrachyd)\
**Post date:** [May 12, 2020, 11:23am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/5 "2020-05-12T11:23:13Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Gosho.Genchev](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@Gosho.Genchev](https://forums.chaos.com/u/Gosho.Genchev)\
**Post date:** [May 12, 2020, 11:35am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/6 "2020-05-12T11:35:50Z")

</div>

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/1OVWz5y2lzzJ1LB4kLp2\_A7qK9c3yNZjR/view?usp=sharing](https://drive.google.com/file/d/1OVWz5y2lzzJ1LB4kLp2%5C_A7qK9c3yNZjR/view?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!

---

<div class="post-metadata">

**Author:** ![Gosho.Genchev](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@Gosho.Genchev](https://forums.chaos.com/u/Gosho.Genchev)\
**Post date:** [May 12, 2020, 11:43am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/7 "2020-05-12T11:43:12Z")

</div>

> 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.

 ![forum_1070404_cryptoAttrib_elrachyd_scene.jpg](https://europe1.discourse-cdn.com/chaosprd/original/3X/b/d/bd935cb1a5f7c9d64c62772f575eedf1318c9c03.jpeg)

---

<div class="post-metadata">

**Author:** ![elrachyd](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elrachyd](https://forums.chaos.com/u/elrachyd)\
**Post date:** [May 12, 2020, 12:03pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/8 "2020-05-12T12:03:19Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![elrachyd](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elrachyd](https://forums.chaos.com/u/elrachyd)\
**Post date:** [May 12, 2020, 12:56pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/9 "2020-05-12T12:56:04Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![bdancer](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bdancer/32/52257_2.png) [@bdancer](https://forums.chaos.com/u/bdancer)\
**Post date:** [May 12, 2020, 1:00pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/10 "2020-05-12T13:00:31Z")

</div>

\> 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!

Sorry, I don’t understand that… could u post a screenshot of what does that mean? Which identical color? I’ve posted a screenshot with the different color per-packed…

---

<div class="post-metadata">

**Author:** ![bdancer](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bdancer/32/52257_2.png) [@bdancer](https://forums.chaos.com/u/bdancer)\
**Post date:** [May 12, 2020, 1:30pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/11 "2020-05-12T13:30:53Z")

</div>

Sorry, I don’t understand again… What is the confusion here?  
" **myAttr** look the same as **eachPackedPrim"** - because both use the same attribute and attribute value? so same attribute value results in the same “color”?

---

<div class="post-metadata">

**Author:** ![elrachyd](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elrachyd](https://forums.chaos.com/u/elrachyd)\
**Post date:** [May 12, 2020, 2:01pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/12 "2020-05-12T14:01:20Z")

</div>

I can’t explain more with my boring English but take a look at this scene with HtoA cryptomatte  
I want to achieve the same thing with Vray, can you reproduce this please?  
Thank you  
here is the hip file  
[htoaCryptomatte.zip](https://forums.chaos.com/uploads/short-url/8cyw9ZQ6wuPiKjIFf4UyqtQtbnD.zip) (105 KB)

---

<div class="post-metadata">

**Author:** ![bdancer](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bdancer/32/52257_2.png) [@bdancer](https://forums.chaos.com/u/bdancer)\
**Post date:** [May 12, 2020, 2:28pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/13 "2020-05-12T14:28:24Z")

</div>

Cryptomatte in V-Ray doesn’t support user attributes per-polygon, only for object or packed. Scene attached.  
[vray\_htoaCryptomatte.zip](https://forums.chaos.com/uploads/short-url/e1y84g1m18HfTHQM8UqkOHlfhrh.zip) (79.3 KB)

 ![crypto.png](https://europe1.discourse-cdn.com/chaosprd/original/3X/b/8/b843f73df79164f664b9c7dd53325495a724ae0a.png)  
 ![myAttr.png](https://europe1.discourse-cdn.com/chaosprd/original/3X/a/1/a1daff1370051d77321f72adfb1392de95fc0124.png)

---

<div class="post-metadata">

**Author:** ![elrachyd](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elrachyd](https://forums.chaos.com/u/elrachyd)\
**Post date:** [May 12, 2020, 2:47pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/14 "2020-05-12T14:47:41Z")

</div>

really helpful thank you

---

<div class="post-metadata">

**Author:** ![hsz](https://avatars.discourse-cdn.com/v4/letter/h/e495f1/32.png) [@hsz](https://forums.chaos.com/u/hsz)\
**Post date:** [July 10, 2020, 5:28pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/15 "2020-07-10T17:28:03Z")

</div>

It seems that none of these workflows works on the GPU+CPU. I do not get the same results at all. If that is the case, are you guys planning to support this on the GPU+CPU?

---

<div class="post-metadata">

**Author:** ![hsz](https://avatars.discourse-cdn.com/v4/letter/h/e495f1/32.png) [@hsz](https://forums.chaos.com/u/hsz)\
**Post date:** [July 22, 2020, 2:53am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/16 "2020-07-22T02:53:19Z")

</div>

Any word on this?

---

<div class="post-metadata">

**Author:** ![bdancer](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bdancer/32/52257_2.png) [@bdancer](https://forums.chaos.com/u/bdancer)\
**Post date:** [July 22, 2020, 8:10am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/17 "2020-07-22T08:10:36Z")

</div>

\> Any word on this?

We are working on this.

---

<div class="post-metadata">

**Author:** ![hsz](https://avatars.discourse-cdn.com/v4/letter/h/e495f1/32.png) [@hsz](https://forums.chaos.com/u/hsz)\
**Post date:** [July 23, 2020, 5:28am UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/18 "2020-07-23T05:28:16Z")

</div>

> [@bdancer](#):
>
> \> Any word on this?
> 
> We are working on this.

Got it, Thanks!

---

<div class="post-metadata">

**Author:** ![bdancer](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bdancer/32/52257_2.png) [@bdancer](https://forums.chaos.com/u/bdancer)\
**Post date:** [August 5, 2020, 12:57pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/19 "2020-08-05T12:57:53Z")

</div>

**[hsz](https://forums.chaosgroup.com/member/196307-hsz)**,This should work in the recent nightly, could u pls test?

---

<div class="post-metadata">

**Author:** ![hsz](https://avatars.discourse-cdn.com/v4/letter/h/e495f1/32.png) [@hsz](https://forums.chaos.com/u/hsz)\
**Post date:** [August 5, 2020, 4:12pm UTC](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527/20 "2020-08-05T16:12:40Z")

</div>

Great, I’ll test it and let you know!

[Next page](https://forums.chaos.com/t/how-to-get-user-cryptomatte-or-custom-cryptomatte-in-vray-for-houdini/98527.md?page=2)
