Jump to content
soroush

Material ID pass

Recommended Posts

Hi,

I would like to know what is the fastest way to get the material id pass based on different materials?

My scene is not really complicated, I have only 7 shaders in total so it is possible for me to assign nodes to my shaders if it is needed.

Also I am using both Mantra Surface and Principled Shaders in my scene.

I have google it but anything I found was old from years ago, so I thought Houdini must have a new way to get the MatID pass.

Thanks

Share this post


Link to post
Share on other sites

There is still no out of the box way to do an Material ID pass. You'll have to crack open your principal shaders, or make a new a new compiled hda one. Where you expose a parameter vop that connects to a bind export export that you name MatID, and then pull those into the mantra render with an extra image plane name called MatID. It might be worth making the RFE for that. It's simple enough and it has been an issue for long enough. The only issue is for opacity, which is one reason they may have not implemented it. This is why people do RGB passes and do 3-D compositing to handle this issue of opacity. If you have the band width the 3-D compositing is an amazing solution. If it is just a simple setup with opacity RGB passes still work. If there is no opacity, the MatID pass as mentioned above should work good enough. 

Share this post


Link to post
Share on other sites
8 hours ago, LaidlawFX said:

There is still no out of the box way to do an Material ID pass. You'll have to crack open your principal shaders, or make a new a new compiled hda one. Where you expose a parameter vop that connects to a bind export export that you name MatID, and then pull those into the mantra render with an extra image plane name called MatID. It might be worth making the RFE for that. It's simple enough and it has been an issue for long enough. The only issue is for opacity, which is one reason they may have not implemented it. This is why people do RGB passes and do 3-D compositing to handle this issue of opacity. If you have the band width the 3-D compositing is an amazing solution. If it is just a simple setup with opacity RGB passes still work. If there is no opacity, the MatID pass as mentioned above should work good enough. 

Thank you Ben, I am going to try the method you mentioned.

Share this post


Link to post
Share on other sites

would be great if mantra adopt the cryptomatte plugin !

Share this post


Link to post
Share on other sites

I've used the "op_id" variable to some of my projects, the good thing is that is really easy to set it up and in nuke or even in Houdini if you normalize it you can get your id's with keyer very easy but nothing beats deep compositing for that.

Share this post


Link to post
Share on other sites

I have found the link below that the person put a sample file. I looked at it and tried to do the same things on my shaders.

https://www.sidefx.com/forum/topic/30157/

there was no problem for the Mantra Surface nodes because they have the Dif Int input. but for the Principled shader I don't see the Dif Int input!

any way to add that attribute to the principled shader?

 

Michel I am googling your method now.

Share this post


Link to post
Share on other sites
1 hour ago, soroush said:

I have found the link below that the person put a sample file. I looked at it and tried to do the same things on my shaders.

https://www.sidefx.com/forum/topic/30157/

there was no problem for the Mantra Surface nodes because they have the Dif Int input. but for the Principled shader I don't see the Dif Int input!

any way to add that attribute to the principled shader?

 

Michel I am googling your method now.

Don't worry about the dif input in those shaders the only thing you need from those shaders are the floating, JKID or Op_Id parameter nodes in the shader. The rest of the principled shader can remain the same.

Share this post


Link to post
Share on other sites
9 minutes ago, LaidlawFX said:

Don't worry about the dif input in those shaders the only thing you need from those shaders are the floating, JKID or Op_Id parameter nodes in the shader. The rest of the principled shader can remain the same.

Do you mean that I can have some nodes without any connections to my other nodes?!
So just copy that JKID in my shader is enough?

Share this post


Link to post
Share on other sites
18 minutes ago, soroush said:

Do you mean that I can have some nodes without any connections to my other nodes?!
So just copy that JKID in my shader is enough?

Yup! 

Don't do it with a multiply node for sure, or the compile will fail. However leaving stray parameter of bind vops works, especially as pass through nodes. i.e. creating random additional ui parameters, or shuttling attributes from sop to shop/vops to out. I will put a small * as it may be a bit more dependent where in the new material networks in Houdini 16 you place them, I think they will still need to be in a material shader builder to be picked up the same way.

Share this post


Link to post
Share on other sites
3 hours ago, LaidlawFX said:

Yup! 

Don't do it with a multiply node for sure, or the compile will fail. However leaving stray parameter of bind vops works, especially as pass through nodes. i.e. creating random additional ui parameters, or shuttling attributes from sop to shop/vops to out. I will put a small * as it may be a bit more dependent where in the new material networks in Houdini 16 you place them, I think they will still need to be in a material shader builder to be picked up the same way.

Great! I am using Houdini 15.5 and it works well.

Thanks a lot.

Share this post


Link to post
Share on other sites

Another automatic option is to just hash the object/material names and use that to lookup a hsv to your liking. Its also pretty stable across multiple scenes, as long as your names don't change.

Selection_066.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×