Rendering object mask (Op_Id) pass/plane in Houdini 12

   11237   6   1
User Avatar
Member
109 posts
Joined: June 2008
Offline
Hi,

im trying to render an Object ID pass/plane in Houdini 12… but i does not seem to work.

The ‘Op_Id’ channel contains data, but the values are quite large: since i have only 3 objects in my scene, i was expecting values 1 - 3.

Am i missing something, or are the values correct?

Note that the attached scene contains custom Clay shader where ‘Op_Id’ param is add manually, and a Mantra render node where normally hidden ‘Generate object ids…’ option is made visible.

Attachments:
op_id_test.hipnc (412.6 KB)

User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
if you use Op_id you will generate a random number , on the other hand you could make an attribute and call your own id in the render pass. I tend to havea preference for the latter as you can assign an id to the whole object and not get an id for every part.

Rob
Gone fishing
User Avatar
Member
599 posts
Joined: May 2011
Offline
circusmonkey
if you use Op_id you will generate a random number , on the other hand you could make an attribute and call your own id in the render pass. I tend to havea preference for the latter as you can assign an id to the whole object and not get an id for every part.
It's not exactly random. It's the unique id of the OBJ that generated the geometry (see OP_Node::getUniqueId() in the HDK). However, it increases monotonically for each operator created while Houdini is running; so the longer your session lasts and more ops you create, even with New Scene in between, the higher this number will be.
Halfdan Ingvarsson
Senior Developer
Side Effects Software Inc
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
halfdan
circusmonkey
if you use Op_id you will generate a random number , on the other hand you could make an attribute and call your own id in the render pass. I tend to havea preference for the latter as you can assign an id to the whole object and not get an id for every part.
It's not exactly random. It's the unique id of the OBJ that generated the geometry (see OP_Node::getUniqueId() in the HDK). However, it increases monotonically for each operator created while Houdini is running; so the longer your session lasts and more ops you create, even with New Scene in between, the higher this number will be.


Its close enough ! LOL

Rob
Gone fishing
User Avatar
Member
109 posts
Joined: June 2008
Offline
Is there a way to create the Op_Id's automatically so that they start from 1?

I have to investigate about the custom attribute…not exactly sure how to implement that
User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
This is a simple example of how you can implement custom attr for object ID !

Also to generate automatic ID , You can take your node's full path (oppwd()) ,and convert this string to char number ,Finally use this number in the rand function to generate unique ID (use python) :?

Attachments:
JK_id_test.hipnc (500.9 KB)

https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
User Avatar
Member
109 posts
Joined: June 2008
Offline
Thanks Joker386!

The custom attribute, ‘JKID’, thats clear, but it can get a bit tedious if you have many items on which you want to attach the attribute.

But the oppwd thingy..where would i put that code? In the same place where i/you now manually assign the ‘JKID’?
  • Quick Links