Align UsdUVTexture wrap modes with USD specification#2979
Align UsdUVTexture wrap modes with USD specification#2979pixelsandpointers wants to merge 12 commits into
Conversation
Note: `useMetaData` requires more clarification and will not be included in the current PR.
Renames CONSTANT→BLACK and PERIODIC→REPEAT in ImageSamplingProperties::AddressMode to match standard GPU/USD terminology, and changes the default (UNSPECIFIED) address mode from Repeat to ClampToBorder across GL, Metal, and Slang backends so unspecified samplers black-border rather than tile.
|
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? |
|
…istinct Per review feedback: revert the address-mode renaming in gltf_pbr.mtlx, stdlib_ng.mtlx, and the affected test resources, since only UsdUVTexture should pick up the OpenUSD wrap mode naming. The generic image node keeps its original "constant"/"periodic" defaults, with "black", "repeat", and "useMetaData" added as new enum options rather than replacements, so UsdUVTexture's wrapS/wrapT can still pass through to the inner image node. AddressMode in ImageHandler.h now keeps CONSTANT and PERIODIC alongside the new BLACK, REPEAT, and USE_META_DATA values, since constant (clamp to a configurable default color) and black (always clamp to black) are not interchangeable. Updated the GL/Metal/Slang texture handlers accordingly, and the 1.39 upgrade path no longer rewrites "constant" to "black".
|
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. |
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.