MtlX switch textures node

   1326   6   1
User Avatar
Member
3 posts
Joined: Feb. 2016
Offline
Hi,

is there a MtlX node that allows to connect an arbitrary number of textures and have them switched per subgroup?
Similar to the VRay multi ID texture?
https://docs.chaos.com/display/VRAYHOUDINI/V-Ray+Multi+ID+Texture [docs.chaos.com]

thanks
User Avatar
Member
162 posts
Joined: Nov. 2016
Offline
Hi!

I think you can create an INT user data/attribute to control a switch, and connect the mtlx Image nodes to the switch node like this:



But I'm not sure if I'm following you right,
User Avatar
Member
3 posts
Joined: Feb. 2016
Offline
This might be what I need. Problem is I would usually need more than just 5 inputs and I don't think you can change the number of inputs?

cheers
Kai
User Avatar
Member
162 posts
Joined: Nov. 2016
Offline
You can stack multiple switches to get access to more than 5 inputs by using the If Greater node, so, if you control switch is bigger than 5, it will switch to the second switch, and so on, you can stack multiple inputs with this.



I recently made a mtlx switch node with 10 and 20 inputs because of this, where I used the same logic:



I hope I'll be able to release it next month or in two months,

Hope that helps, cheers!
Edited by cdordelly - May 30, 2024 11:30:25
User Avatar
Member
3 posts
Joined: Feb. 2016
Offline
Will give this a try. Thanks!
Would be nice though to have a more flexible node.

cheers
Kai
User Avatar
Member
162 posts
Joined: Nov. 2016
Offline
If you are doing this for instances, you can also try with the string user data workflow. Store the textures on the instances as a string attribute and load the attribute on the material, in theory this doesn't work currently with the MtlX Image because it doesn't support the variadic input yet, but it still works, there is one thread about this but I can't find it. As a plan b from this workflow, you can use the usd texture instead of the mtlx image.

User Avatar
Member
1 posts
Joined: Sept. 2015
Offline
Hey cdordelly,

Is it possible to use/download the custom switch node you created?
  • Quick Links