The MaterialX <displacement> construct can either be a float scalar or a vector3 vector[1] which should end up resolving to either a ND_displacement_float or a ND_displacement_vector3 respectively[2].
However, it looks like the USD MaterialX reader doesn't take the input type into account and always assigns scalar float displacement as ND_displacement_vector3
Adding mtlxMaterial 'TestMaterial'
Adding shaderNode 'Displacement' type: 'displacementshader'
Created shader mtlx ND_displacement_vector3, as usd ND_displacement_vector3
Add shader output out of type displacementshader
Coding Error: in _SetValueImpl at line 6725 of C:\db\build\S\VS1564R\build\usd\src\external_usd\pxr\usd\usd\stage.cpp -- Type mismatch for </root/Materials/TestMaterial.inputs:displacement>: expected 'GfVec3f', got 'float'
Description of Issue
The MaterialX
<displacement>
construct can either be a float scalar or a vector3 vector[1] which should end up resolving to either aND_displacement_float
or aND_displacement_vector3
respectively[2].However, it looks like the USD MaterialX reader doesn't take the input type into account and always assigns scalar float displacement as
ND_displacement_vector3
[1] https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/Specification/MaterialX.Specification.md#standard-library-shader-nodes [2] See the nodedefs inside: https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/pbrlib/pbrlib_defs.mtlx
Steps to Reproduce
Given the following MaterialX document:
Observe what happens while loading it -- here I'm also using
TF_DEBUG=USDMTLX_READER
Output:
System Information (OS, Hardware)
Package Versions
Build Flags