Different Mtlx Constant or Image for specific UDIMs?

   313   3   1
User Avatar
Member
661 posts
Joined: 8月 2014
Offline
Given two Mtlx Constant or Image nodes, Is it possible to choose one for UDIMs from a to b, but the second node for UDIM c? Maybe with Mtlx Switch? But how to detect UDIM for whichparameter?

I have some areas of my model (placed at the last UDIM tile) for which I need to change only the base color. I'd like to avoid duplicating the material just to alter this small detail.
Edited by ajz3d - 2026年5月26日 17:35:21
User Avatar
Member
661 posts
Joined: 8月 2014
Offline
Okay, I managed to solve it in the following way:
First I created a udim_tilefor each SOP primitive (using Labs UDIM Tile Number SOP). Then I read this attribute with Mtlx Geometry Property Value VOP and compared it with my target UDIM (the one I want to be using a different base color) with Mtlx If Equal VOP.
Edited by ajz3d - 2026年5月26日 18:37:31
User Avatar
Member
9679 posts
Joined: 7月 2007
Offline
ajz3d
First I created a udim_tilefor each SOP primitive
you should be able to just use MtlX UDIM Patch node directly in the shader to get UDIM number from provided texture coordinate value
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
661 posts
Joined: 8月 2014
Offline
tamte
you should be able to just use MtlX UDIM Patch node directly in the shader to get UDIM number from provided texture coordinate value
Thanks for pointing this out, Tamte. Indeed, this solution feels more elegant and theoretically should work, but for some reason it doesn't and I'm currently trying to figure out why.

As I understand it, hmtlxudimpatch is supposed to return an integer value of the currently processed patch (polygon?). If I replace mtlxgeompropvalue (which reads udim_tile primvar) with this node, and feed it into one of the value inputs of the mtlxifequal VOP, it never doesn't match my last UDIM defined in the other value input (more on this at the end of this post). I tried plugging in mtlxtexcoord into texcoord input of the hmtlxudimpatch, but nothing changes. I also tried plugging in st (retrieved with mtlxgeompropvalue) into texcoord, but to the same effect.



In the setup with hmtlxudimpatch, mtlxifequal matches UDIM 1001 when last_udim_tile mtlxconstant VOP is set to 1001. If it's set to any other UDIM tile, mtlxifequal returns false. Which is strange and suggests that hmtlxudimpatch always returns 1001.

Is there some additional step I'm missing here?
Edited by ajz3d - 2026年5月28日 08:09:21

Attachments:
last_udim_if_equal.png (11.6 KB)

  • Quick Links