-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add udimextract and udimtexcoord nodes #1381
Conversation
…IM support for texture variation.
While these nodes are related to the same artistic needs motivating issue #878, they are not intended to be a complete solution. What this does provide is a very simple way for artists to drive texture variation with primvars. Other than UDIM support, no additional work is needed on the part of the renderer or MaterialX. Currently these nodes limit the UDIMs to 1001-1099 (inclusive), which is the range of UDIMs that USD supports. However if UDIM ever becomes an actual specification, we can adjust the limits accordingly. |
@crydalch How does this proposal relate to the existing support for These tokens currently work as expected in MaterialXView, for example, and I've successfully tested multi-UDIM MaterialX files in Houdini/Karma as well. As far as I can tell, Houdini/Karma correctly integrates the native UDIM support in MaterialX, and will assign each UDIM texture to the associated geometric UDIM at render time: https://www.sidefx.com/docs/houdini/solaris/materialx.html#textures |
Thanks @jstone-lucasfilm! Yeah this isn’t trying to “fix” UDIM support. These nodes allow users to leverage existing UDIM support, to drive texture variation using primvars. Full string/primvar token support (i.e. what’s been discussed in #878) is going to require more work on the part of MaterialX, UsdMaterialX, USD, and render delegates. While eventually that would likely be the more flexible approach, this seemed like a good alternative, which requires nothing beyond UDIM support. So even when primvar-substitution lands, (ab)using UDIM textures like this proves useful. Maybe changing the names would help clarify things. Instead of BTW, I actually haven’t been able to get a Maybe something with my local build is the culprit? Or is there something messed up with this dataset? The bunny works in Houdini just fine. Does MaterialX have example geometry/texture resources for UDIMs? Here is the .obj: Thanks! |
In MaterialX, you just need to state the Here's a multi-UDIM version of the bunny, with the corresponding render in MaterialXView: I like the idea of including a multi-UDIM example asset in the MaterialX repository, and let me know if you have ideas for one! |
Ah - it was me :) Thank you for that example, I see it working now in MaterialX tools! Just to clarify the usage a bit better, I've attached image shows some usage examples. The shader has Maybe we can chat about this a the next TSC meeting? I'm still wrapping my head around the whole |
@crydalch Sure, let's plan to pick up this topic in our upcoming MaterialX TSC meeting. I think the difference you're encountering may not be between MaterialX and USD/MaterialX workflows (which have nearly identical interpretations of UDIMs), but between real-time and off-line renderers (e.g. Storm vs. Karma). Real-time renderers traditionally require all textures referenced by an asset to be loaded in advance of shader execution, while off-line renderers can make this decision dynamically at shade time. This makes it much more challenging for a real-time renderer to respond to shader-computed UDIM indices by loading a new set of textures from disk, and it's common for this category of renderer to disallow this approach. |
Adding some small notes based thoughts from the TSC. This is in the context that a texture atlas is used for real-time:
So I think as long as the udim lookup does not go outside the udim set per image then it's something that can work theoretically if you have normalized udim atlas (static or dynamic). BTW, I've always found the MaterialX udim set specification is a bit "odd" in that it's Document level however -- but these nodes are for a specific image, so I think the new wrinkle is that this adds a different "scope" of udim evaluation. |
Just to align our two discussions of this subject, I'll forward a high-level summary from today's MaterialX TSC meeting, where we had the chance to discuss this topic a bit:
My sense is that approach (3) is the ideal, but a more practical alternative would be for MaterialX to support both (1) and (2), allowing clients of the library to choose which one they prefer. This would allow applications such as Storm to continue using pre-generated texture arrays, and would allow MaterialXView to switch between these two approaches dynamically as needed by users. |
In a side discussion with @crydalch, we resolved that it makes more sense to work with the USD/MaterialX teams to resolve the core issue in #878, so I'm going to close this pull request for now. There's a USD/MaterialX working group within the ASWF that focuses on these alignment issues, and this subject would be a great one to bring up at their next meeting. |
These are two new nodes which let users commandeer UDIM support, to drive texture variation.
udimtexcoord
- provides the texture coordinates of the specified UDIM patch. The UDIM patch can be driven by geometry properties, letting users drive texture maps using primvars.udimextract
- extracts the UDIM patch from the given texture coordinates.MaterialXViewer and MaterialXGraphEditor both don't recognize image paths with the
<UDIM>
token, but here is a render from Karma. Each rubber toy is assigned a random integer primvar between 1001 and 1025.