Open
Description
Both MaterialXView and MaterialXWebViewer struggle with binding looks to node names containing spaces and/or parentheses. They apply different renamings, and do the geomexpr matching differently, so the results are somewhat random. Note that not only both renderings below are wrong, they are also wrong in different ways due to these different approaches.
Test file: bugreport-materialX-bindings.zip
Tool | Result |
---|---|
MaterialXView | ![]() |
MaterialXWebViewer | ![]() |
MaterialXView with node names that don't use () . This is the expected result. |
![]() |
Some preliminary analysis on what's going wrong:
Naming issues in MaterialXView
- CgltfLoader.cpp renames "Sphere (1)" to "Sphere__1_", but materiassign does not rename anything, so names don't match.
- For some reason,
isMatching()
in Geom.h returns true when testing "Sphere (1)" and "Sphere (2)". - The GeomExts spec mentions that partitions should be separated with
/
(so they are leaf nodes), but MaterialXView does not add a ?/
, it just adds an index to the node name (e.g. Sphere, Sphere2, Sphere3 for three partitions – note the first one omits the/1
as well).
Naming issues in MaterialXWebViewer
- viewer.js does not use the original GLB names, but the potentially renamed names from the three.js scene graph. Fixed by Web Viewer: Use original object names from loaded glTF files for DAG matching and keep material names #2445
- viewer.js uses
if (dagPath.match(path))
and thus treats the geomexpr as RegExp, which is wrong – geomexpr are not regular expressions. In particular, a string like "Sphere (1)" will treat the parentheses as capture. See also Documentation: Questions regarding usage and implementation of Geometry Name Expressions #2444 for more questions on how geomexpressions are supposed to work. - I have not tested partition naming with MaterialXWebViewer yet.
Workaround
The workaround is to not use spaces or parentheses anywhere, but I don't think that's a good workaround at all, as it would potentially require users to change their files; not all industries have strict naming conventions for files/nodes/materials.
Activity