Align UsdUVTexture wrap modes with USD specification#2979
Align UsdUVTexture wrap modes with USD specification#2979pixelsandpointers wants to merge 2 commits into
Conversation
|
I think this is up for review @ld-kerley and @jstone-lucasfilm. I am not entirely sure if all the changes I introduced were necessary (still fairly new to contributing to MtlX). Therefore, I am also uncertain if the versioning code should still target 1.39, or 1.40. The Happy for feedback and comments. |
|
@pixelsandpointers I haven't yet done a full review, but on my first read-through, it looks like you're renaming the address modes of all texture nodes, including the core |
|
@jstone-lucasfilm I was not sure which files concretely touch what. I grepped for the Concretely, that means I need to revert which changes? I assume I need to revert the gltf definitions, right? |
|
|
Unfortunately, a couple of changes sneaked in when running clang-format on the files. I went down the additive approach now and added new enumerations and adjusted the handlers, respectively. Please @jstone-lucasfilm @kwokcb @ld-kerley let me know what you think. |
|
Thanks for iterating on this, @pixelsandpointers, and for your patience as this discussion has evolved. The additive approach is a clear improvement, and you've correctly preserved the important Before we go further down the current path, though, I'd like to suggest an alternative direction that I think is worth some community discussion, because it may let us solve this more cleanly than either renaming or extending the core The crux of the problem is that But MaterialX actually has an existing mechanism for precisely this kind of mapping: the specification defines So a potential path forward would be:
If that approach works out, it would let us:
There are some details to work through: where this mapping is best declared, how the exact transparent-black behavior is handled, and a likely small spec clarification, so this would want a bit of design discussion before anyone commits to it, and it implements a feature that touches the specification, so it's probably worthy of a TSC discussion. I don't want to discard the work you've already done here, and at a very minimum your PR has surfaced an important missing feature in our shader generators. Would you (along with @ld-kerley and @kwokcb) be open to exploring this direction? I'm happy to extend this idea with more context if there is interest. |
ef0deda to
8c4bb6b
Compare
|
Sorry for the delay. @kwokcb I am uncertain if you meant we have only 4 enum values. I implemented the version now on the 4 enum values. The fallbacks (default colours) were already in place and only changed the RGBA to have an alpha of 1, so we get an opaque black. As you said, the only changes now are the enumvalues and the defaults. @jstone-lucasfilm I don't mind iterating on this. I think this is also a good way to get into the intrinsics of MatX. |

Closes #2899
The wrap mode enum values for
ND_UsdUVTexture_23did not match those used byUsdUVTexturein OpenUSD, making round-trip interchange lossy. This PR aligns the names, defaults, and fallback behavior with the USD specification.Changes
libraries/bxdf/usd_preview_surface.mtlxperiodic→repeatandblackis now explicitly included (was previously namedconstant)wrapS/wrapTfromperiodictouseMetaData, matching the USD defaultsource/MaterialXRender/ImageHandler.hAddressModeenum values:CONSTANT→BLACK,PERIODIC→REPEATto match USD terminologyGL / Metal / Slang texture handlers
REPEAT(GL:GL_REPEAT, Metal:MTLSamplerAddressModeRepeat) toBLACK(GL:GL_CLAMP_TO_BORDER, Metal:MTLSamplerAddressModeClampToBorderColor), matching USD's fallback fromuseMetaDatawhen no metadata is presentNot yet addressed
useMetaDatais now accepted as the default enum value in the nodedef, but reading wrap modes from texture file metadata is not yet implemented — a follow-up is noted with aTODO (#2899)comment in both the nodedef and theAddressModeenum.