Fix ND_UsdTransform2D implementation - #2924
Merged
jstone-lucasfilm merged 1 commit intoMay 14, 2026
Merged
Conversation
…e transformations were being applied in reverse.
Member
|
Great to see this fix, @ld-kerley! I'm CC'ing @kwokcb, who should be the one to formally review this, but it seems like the right path forward. |
kwokcb
approved these changes
May 14, 2026
kwokcb
left a comment
Contributor
There was a problem hiding this comment.
This looks good and matches exactly https://openusd.org/dev/spec_usdpreviewsurface.html.
Nice to avoid the extra math for pivots and TRS ordering support.
jstone-lucasfilm
merged commit May 14, 2026
9ebe5f1
into
AcademySoftwareFoundation:main
36 checks passed
ashwinbhat
added a commit
to autodesk-forks/MaterialX
that referenced
this pull request
Jun 3, 2026
* Improve handling of top-level inputs in Graph Editor (AcademySoftwareFoundation#2830) - Fix setting of interface names on connection - Copies logic from commit: [PR](AcademySoftwareFoundation#2785) - This is a general logic fix. AcademySoftwareFoundation@09f66bb - Fix connection renaming setting on input rename. Was not considering nodegraph to upstream connections * Improve build configuration in GitHub CI (AcademySoftwareFoundation#2861) This changelist improves the build configuration in GitHub CI, reducing duplication across the build matrix and adjusting parallelism per platform. The following specific changes are included: - Consolidate extended build configuration as a local `extended_cmake_config` field on each matrix row, reducing the CMake Generate step to a single call. - Adjust build parallelism per platform through the CMAKE_BUILD_PARALLEL_LEVEL environment variable, defaulting to 4 and reduced to 1 on Windows, as the MSVC `/MP` flag already handles file-level parallelism within each project. - Simplify the MacOS rendering setup to setting a debug flag in extended builds, as the `MTL_HARDWARE_RENDERING` and `LIBGL_ALWAYS_SOFTWARE` overrides are not actually supported in Metal rendering. * Update changelog for latest work (AcademySoftwareFoundation#2862) * Omit `specular_weight` from metal edge tint in OpenPBR (AcademySoftwareFoundation#2863) This changelist removes `specular_weight` from the computation of metal edge tint in OpenPBR Surface, aligning the behavior of this shading model with a [proposed fix](AcademySoftwareFoundation/OpenPBR#240) for OpenPBR 1.2. As described in the proposed fix, the edge-tint color for the `generalized_schlick_bsdf` should not be multiplied by `specular_weight`, as the whole lobe is multiplied by `specular_weight` as well. * Update OpenPBR to v1.1.1 (AcademySoftwareFoundation#2867) This changelist updates the version string of OpenPBR Surface to `1.1.1`, aligning the MaterialX project with the latest release of OpenPBR at https://github.com/AcademySoftwareFoundation/OpenPBR/releases/tag/v1.1.1. * Update changelog for latest work (AcademySoftwareFoundation#2868) * Fix crash on exit with a debug Python (AcademySoftwareFoundation#2866) Under the hood (in both before and after code), this statement is adding the Exception instance as an attribute to the module. Other examples found using the pattern, suggesting the static variable scope was not needed: - py::register_exception<mx::ExceptionOrphanedElement>(mod, "ExceptionOrphanedElement"); - py::register_exception<mx::ExceptionFoundCycle>(mod, "ExceptionFoundCycle"); - py::register_exception<mx::ExceptionParseError>(mod, "ExceptionParseError"); - py::register_exception<mx::ExceptionFileMissing>(mod, "ExceptionFileMissing"); Fixes AcademySoftwareFoundation#2749 * Unify environment light texture handling in MaterialXRenderMsl (AcademySoftwareFoundation#2870) This PR seeks to address AcademySoftwareFoundation#2851. The core issue is that the Metal rendering code wasn't honoring the indirect lighting property of the light handler. However, changing the logic to match that of the implementation in `bindLighting()` in [GlslProgram](https://github.com/AcademySoftwareFoundation/MaterialX/blob/d69fcb10283f0bbc5f17415c33a6f2e6b63622ad/source/MaterialXRenderGlsl/GlslProgram.cpp#L585-L600) isn't quite enough. There were actually two independent paths for binding IBL textures in the Metal implementation, one in `bindLighting()` and one in the lower-level `bindTextures()`. This change unifies those two paths into a single path relying on the _explicit bound texture_ mechanism currently used for shadow mapping. * Add specification proposal for maxcomponent and mincomponent nodes (AcademySoftwareFoundation#2876) ## Summary Add specification proposal for `maxcomponent` and `mincomponent` nodes to the Math Nodes section of the Specification Proposals document. Closes AcademySoftwareFoundation#2802 ## Description Per the discussion in AcademySoftwareFoundation#2802 with @jstone-lucasfilm : - These nodes support **all vectorN and colorN types** (`vector2`, `vector3`, `vector4`, `color3`, `color4`) - Output type is **float** The proposal format follows existing nodes such as `magnitude` and `dotproduct` in the Standard Nodes document. ### Use Cases As mentioned in the issue, two places in the MaterialX data libraries currently use verbose 5-node patterns (3 `extract` + 2 `max`/`min`) that these nodes would simplify to a single node: 1. **Sheen intensity for glTF PBR** (`libraries/bxdf/gltf_pbr.mtlx`) — uses `maxcomponent` pattern 2. **Absorption coefficient for OpenPBR Surface** (`libraries/bxdf/open_pbr_surface.mtlx`) — uses `mincomponent` pattern ### Scope This PR addresses the specification proposal only. I can work on the follow-up implementation via graph definitions as a separate PR once the proposal is reviewed and merged. * Refactor runRenderer to use structured types (AcademySoftwareFoundation#2869) Replace the 10-parameter runRenderer signature with RenderSession, RenderItem, and RenderProfileResult value types. Each call now returns isolated profiling data that the caller accumulates. Test run is now decoupled, so in future, we would be able to introduce some parallelism in these tests if needed. Minor fixes: - correct ScopedTimer scoping in validate(), - fix a copy-paste timer name in the Slang renderer. * Stabilize flake `id` across floating-point precisions (AcademySoftwareFoundation#2877) This changelist reduces the scale factor for flake `id` from `INT32_MAX` to `2^24 - 1`, providing a stronger guarantee of consistency between 64-bit and 32-bit shading environments. * Fix uninitialized member variable in MetalState (AcademySoftwareFoundation#2884) This PR seeks to address issue AcademySoftwareFoundation#1518. I believe the first part of this issue to be obsolete. The CMake targets have changed substantially since the issue was reported, and I was able to build with Xcode 12.4 on macOS Catalina 10.15.8 without errors. The second part of the issue is still relevant. When compiled on a system with a macOS 11+ SDK but running on an OS version prior to macOS 11, the `supportsTiledPipeline` member variable is not initialized by the constructor or the `initialize()` method, and can hold an invalid value. This doesn't cause a crash because of further runtime checks in `initLinearToSRGBKernel()`, but it does raise a runtime issue when compiled with UBSAN. These changes ensure that the `supportsTiledPipeline` variable is always initialized, regardless of SDK version or OS version. Tested on macOS Catalina 10.15.8 with Xcode 12.4 and macOS Tahoe 26.4.1 with Xcode 26.4.1. * Fix tiling/scaling order in OSL hextiling to match GLSL (AcademySoftwareFoundation#2888) This fix addresses the bug outlined here: AcademySoftwareFoundation#2885 * Use `windows-2022` for VS2022 in GitHub CI (AcademySoftwareFoundation#2907) This changelist updates GitHub CI to use `windows-2022` consistently for VS2022 builds, as an upcoming change to GitHub Actions will replace `windows-2025` with a VS2026-focused environment. * Fix incorrect transpose in Metal inverse world matrices (AcademySoftwareFoundation#2904) The world inverse matrix uniforms in metal are incorrectly transposed. This removes this incorrect transposes You can tell pretty clearly that this is incorrect because when it sets the WORLD_MATRIX just a few lines above, it doesn't transpose it, so why transpose the inverse? https://github.com/bhouston/MaterialX/blob/fe92050e77f6f64984958abf0461747369c713b4/source/MaterialXRenderMsl/MslPipelineStateObject.mm#L1163 This was found via the fidelity test suite. * Fix edge case behavior of `dielectric_bsdf` in MDL (AcademySoftwareFoundation#2910) Address an issue that was discovered with OpenPBR. The specular lobe was still visible with specular_weight=0 and specular_ior=1. Improved the comment that explains the reasoning for chosing custom_curve over fresnel in the dielectric_bsdf. * Optimize GLSL/OSL `rotate3d` using Rodrigues' rotation formula (AcademySoftwareFoundation#2890) While fixing some issues with the rotate3d for my blender importer, I noticed that we can replace the matrix44 construction for just rotating a vector with Rodrigues' formula: https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula This PR makes that change. Fidelity test passes with successful results so there was no degradation. * Align OSL implementation of `cellnoise3d` with GLSL (AcademySoftwareFoundation#2906) Prior to this fix cellnoise3d looked different for OSL as compared to Metal/GLSL. After this fix they match. * Fix ND_UsdTransform2D implementation (AcademySoftwareFoundation#2924) Addresses AcademySoftwareFoundation#2901 Reversed the direction of the transformations applied - aligning the MaterialX implementation with the USD implementation. * Fix createValidChildName for Documents with referenced data libraries (AcademySoftwareFoundation#2923) * Fix createValidChildName for Documents with referenced data libraries Document::createValidChildName previously only considered local children, so name generation could produce collisions with elements in a data library attached via setDataLibrary (the reference path), while importLibrary (the copy path) worked correctly. Make Element::createValidChildName virtual and override it in Document to also consult the referenced data library when uniquifying names. Add tests covering both the imported and referenced data library paths, including collisions with library-defined nodedef names. * Make Element::getChild data-library-aware Prior commit fixed Document::createValidChildName by overriding it to also check the attached data library, but left two issues: the override duplicated the base name-uniquification logic (risking drift if the base ever changes), and a latent API inconsistency where Element::getChild did not consult the data library while getChildOfType and getChildrenOfType already did. Push the data-library lookup into Element::getChild itself (mirroring the asA<Document>() + hasDataLibrary() pattern already used by getChildOfType). With getChild now library-aware, the base createValidChildName naturally handles both local and referenced libraries by switching its loop condition from _childMap.count to getChild, so the Document override is removed and createValidChildName no longer needs to be virtual. * Add iridescence support to Standard Surface to glTF PBR translation (AcademySoftwareFoundation#2892) This PR maps the thin_film_thickness and thin_film_IOR to the glTF iridescence, iridescence_ior, and iridescence_thickness outputs. The iridescence weight is derived from the thickness being non-zero, as Standard Surface has no separate iridescence weight input. * Update StbImage dependencies (AcademySoftwareFoundation#2917) There's a known issue where StbImage hangs when loading an invalid HDR nothings/stb#1224 which is used by `ImageHandler.acquireImage()`. Currently Fixed in v2.28. MaterialX is using v2.23 [MaterialXRender/External/StbImage/stb_image.h](https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXRender/External/StbImage/stb_image.h). I've upgraded std_image to latest v2.30 and std_image_write to v1.16 which resolve this. And added a regression test that triggers this StbImage issue that hangs indefinitely if this issue re-occurs * Fix alpha handling in HSV/RGB conversion in GLSL/OSL (AcademySoftwareFoundation#2926) `mx_rgbtohsv` and `xm_hsvtorgb` had hardcoded output alpha set to `1.0`. The alpha channel should forward the preexisting alpha value `_in.a` unchanged. Changes made in - `/libraries/stdlib/genglsl/mx_hsvtorgb_color4.glsl` - `/libraries/stdlib/genglsl/mx_rgbtohsv_color4.glsl` - `/libraries/stdlib/genosl/mx_hsvtorgb_color4.osl` - `/libraries/stdlib/genosl/mx_rgbtohsv_color4.osl` This fixes AcademySoftwareFoundation#2765 * Fix material switching in the MaterialX Web Viewer (AcademySoftwareFoundation#2931) This changelist fixes a regression in the MaterialX Web Viewer, where switching to any example material other than Standard Surface Default would fail to update the rendered material. Since the update to `Element::getChild` in AcademySoftwareFoundation#2923, calling `Element::getDescendant` on a Document with a referenced data library can resolve uniform paths _into_ the library, returning elements such as NodeDef inputs whose parent is not a Node. The Web Viewer's property editor then throws a `TypeError` when calling `getNodeDef` on the NodeDef parent, preventing materials other than Standard Surface Default (which declares all inputs explicitly) from displaying. The fix is to skip descendants whose active source URI differs from that of the working document, ensuring the property editor only processes elements from the content document. * Make mxvalidate autoload std libraries (AcademySoftwareFoundation#2932) Make mxvalidate autoload std libraries * Fix nullptr dereference in MaterialNode (AcademySoftwareFoundation#2927) Fixes AcademySoftwareFoundation#2918 ## Summary - Add `isAGraph()` guard in `MaterialNode::emitFunctionCall` to return early with default output variables when the `surfaceshader` input is bound through a graph interface with no upstream shader node, preventing a null dereference on `ShaderNode::getImplementation()` - Add `isAGraph()` guard in `MaterialNode::addClassification` to skip classification inheritance in the same case ## Test Regression test added by @seang-ilm in the linked branch covering the case where a `<surfacematerial>` is placed inside a `<nodegraph>` whose `surfaceshader` input is bound via `interfacename` to a graph interface input with no upstream node. * Initial render comparison in GitHub CI (AcademySoftwareFoundation#2908) This changelist takes a step toward broader render validation in our GitHub CI, adding an extended job that generates a downloadable HTML/PDF report comparing rasterized (MSL) and ray-traced (OSL) renders of the test suite side-by-side with per-pixel differences, allowing contributors to validate shading updates in their fork without building OSL locally. The following specific changes are included: - Add an extended CI job that builds OSL v1.14.10.0 from source, runs MSL and OSL render tests at reference quality, and uploads an HTML/PDF comparison report as an artifact. - Add the `OpenPBR` and `UsdPreviewSurface` example folders to the render test suite, replacing the less-critical `pbrlib/surfaceshader` folder, and adding a `renderTestExcludeFiles` option to skip individual files. - Tune reference-quality sample counts to fit within the render capabilities and time budget of GitHub CI: rasterization supersample factor 8 -> 2, OSL lit -aa 32 -> 16 (1024 -> 256 spp), OSL unlit -aa 8 -> 2 (64 -> 4 spp). - Centralize reference quality parameters in `getRasterEnvSampleCount` and `getRasterSupersampleFactor` helpers, removing duplicated constants across hardware shading targets. - Replace the `MATERIALX_RENDER_MSL_ONLY` flag with `MATERIALX_TEST_RENDER_GLSL` for clarity, and replace the `enableReferenceQuality` test flag with a `MATERIALX_TEST_REFERENCE_QUALITY` build option. As a logical next step, we might consider publishing the HTML artifact as a MaterialX Fidelity Suite (in the spirit of https://github.com/bhouston/material-fidelity), allowing any member of the community to view the current state of MaterialX render parity at a glance. * Fix translation of semi-transmissive Standard Surface materials to glTF PBR (AcademySoftwareFoundation#2912) This PR address translation of semi transmissive standard surface materials to gltf_pbr. It closes AcademySoftwareFoundation#2898. A mix node has been added taking the transmission weight into account. The weight have been square as it better matches the final result. The translation is not perfect, the base color will be more influence by either **transmission color** (if **transmission_depth**=0) or white color, when transmission weight approaches 1. It would be nice if its more correct, and I would love some input from anyone with more knowledge about standard surface and **gltf_pbr** how to mix it to get a better result. For anyone reconstructing this issue, note that **attenuation color** in **gltf_pbr** is not implemented, so use white **transmission color**/**attenuation color** when comparing the materials. * Finalize changelog for 1.39.5 (AcademySoftwareFoundation#2945) --------- Co-authored-by: Bernard Kwok <kwokcb@gmail.com> Co-authored-by: Jonathan Stone <jstone@lucasfilm.com> Co-authored-by: Mark Final <31315860+foundry-markf@users.noreply.github.com> Co-authored-by: Warren Moore <39937547+warrenm@users.noreply.github.com> Co-authored-by: Chinmay <chinmay.cc.06@gmail.com> Co-authored-by: Ashwin Bhat <1727158+ashwinbhat@users.noreply.github.com> Co-authored-by: Ben Houston <ben@ben3d.ca> Co-authored-by: Ben Houston <neuralsoft@gmail.com> Co-authored-by: krohmerNV <42233792+krohmerNV@users.noreply.github.com> Co-authored-by: Lee Kerley <154285602+ld-kerley@users.noreply.github.com> Co-authored-by: Ben Beilharz <b@ben.graphics> Co-authored-by: seang-ilm <sgilligan@ilm.com> Co-authored-by: Payton Gilbertson <45208074+paytonGilbertson@users.noreply.github.com> Co-authored-by: zychen8 <152906171+zychen8@users.noreply.github.com> Co-authored-by: Suriya D Murthy <surya.dakshina@gmail.com> Co-authored-by: Johan Bowald <johan.bowald1@inter.ikea.com> Co-authored-by: Ashwin Bhat <ashwin.bhat@autodesk.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #2901
Reversed the direction of the transformations applied - aligning the MaterialX implementation with the USD implementation.