Repository navigation
MaterialXLoader: Only resolve loading promises when all sub-resources are loaded. - #34439
Merged
Merged
Conversation
bhouston
force-pushed
the
materialx-loader-fix
branch
from
September 2, 2026 18:08
e6ee24c to
abbc2df
Compare
πΌοΈ E2E screenshot testsβ All examples render correctly again (run). |
Let callers await image-backed MaterialX texture loads and inspect the raw parsed graph without relying on loader internals or render-loop timing.
Keep the texture-readiness branch focused by removing raw graph access and texcoord compile-context indirection for separate review.
Attach parsed MaterialX graph handles to generated materials so tools can inspect authoring data after TSL translation.
Route MaterialX texcoord nodes through a compile-context hook so UV-space handling has one shared entry point.
This reverts commit 6216379.
bhouston
force-pushed
the
materialx-loader-fix
branch
from
September 9, 2026 15:09
5c6d424 to
de4e1a2
Compare
Expose the parsed MaterialXDocument on the loader's result instead of attaching graph references to each material. materials are keyed by name, and document.getMaterialXNode(name) looks up the matching raw graph node using that same name.
Mugen87
reviewed
Sep 11, 2026
Mugen87
reviewed
Sep 11, 2026
|
|
||
| const material = result.materials.test_material; | ||
|
|
||
| assert.false( 'texturesReady' in result, 'The result does not expose a separate readiness promise.' ); |
Mugen87
reviewed
Sep 11, 2026
Mugen87
reviewed
Sep 11, 2026
Mugen87
reviewed
Sep 11, 2026
Mugen87
reviewed
Sep 11, 2026
- Test: import LoadingManager from 'three' instead of the build bundle - Test: drop the leftover 'texturesReady' assertion - MaterialXDocument: stop exposing the raw document on parse() results - MaterialXLog: TEXTURE_LOAD_FAILED is now a warning, matching GLTFLoader - Example: restore the Calibration/Preview mesh GUI, remove window.TESTING
Downgrading TEXTURE_LOAD_FAILED to a warning (per review feedback) means a failed texture no longer rejects load()/loadAsync() by default. Update the test to assert the new GLTFLoader-like behavior instead of the old throwOnErrors/rejection expectation, which was failing CI.
Mugen87
approved these changes
Sep 11, 2026
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.
Problem
Currently,
MaterialXLoader.load()callsonLoadafter parsing and translating the MaterialX document, while image-backed nodes continue loading their textures.loadAsync()therefore resolves before those textures have image data.Fix
This PR makes
load()andloadAsync()wait for every resource request started during MaterialX translation. When either API reports completion, referenced textures have finished loading and the material is ready for immediate use.The loader follows the resource lifecycle established by
GLTFLoader:onLoadandloadAsync()complete after dependent textures settle.LoadingManageritem remains active through parsing, resource loading, and the loader callback.LoadingManager.itemError()and close the root item.onProgresscallback reports the MaterialX document transfer.LoadingManager.onProgressreports dependent texture requests.Direct calls to the synchronous
parse()API retain their existing behavior.Demo
Current behavior - totems appear without textures and then those pop in: https://threejs.org/examples/webgpu_loader_materialx.html
New behavior - clean display of each totems after its material is fully loaded: https://rawcdn.githack.com/mrdoob/three.js/de4e1a23eabfeef69224fdf5874abbdb98b99c37/examples/webgpu_loader_materialx.html