PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.98k stars 1.18k forks source link

Some MaterialX nodes don't show up in the USD stage #1502

Open numega opened 3 years ago

numega commented 3 years ago

Description of Issue

The add node in the following MaterialX text doesn't show up in the USD stage. I've verified that it works in MaterialXView though.

<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
    <add name="add1" type="color3">
        <input name="in1" type="color3" value="0, 0.5, 0"/>
        <input name="in2" type="color3" value="0, 0.5, 0"/>
    </add>
    <UsdPreviewSurface name="SR_default" type="surfaceshader">
        <input name="diffuseColor" type="color3" nodename="add1"/>
    </UsdPreviewSurface>
    <surfacematerial name="USD_Default" type="material">
        <input name="surfaceshader" type="surfaceshader" nodename="SR_default"/>
    </surfacematerial>
</materialx>

Steps to Reproduce

  1. Build USD with the UsdMtlX plugin enabled
  2. Save the MaterialX text specified above to a file
  3. Run usdcat on the file
  4. Notice how the add node is missing from the USD stage

System Information (OS, Hardware)

macOS 11, MacBookPro (15-inch, 2019)

Package Versions

USD 21.05

Build Flags

./build_scripts/build_usd.py --materialx

jtran56 commented 3 years ago

Filed as internal issue #USD-6669

dboogert commented 2 years ago

Is this because the add node needs to be in a nodegraph?

I've had some success with materialx files like this:

<?xml version="1.0"?>
<materialx version="1.38">
    <nodegraph name="ng">
        <add name="add1" type="color3">
            <input name="in1" type="color3" value="0, 0.5, 0"/>
            <input name="in2" type="color3" value="0, 0.5, 0"/>
        </add>
        <output name="out_color" type="color3" nodename="add1" />
    </nodegraph>
    <UsdPreviewSurface name="SR_default" type="surfaceshader">
        <input name="diffuseColor" type="color3" nodegraph="ng" output="out_color"/>
    </UsdPreviewSurface>
    <surfacematerial name="USD_Default" type="material">
        <input name="surfaceshader" type="surfaceshader" nodename="SR_default"/>
    </surfacematerial>
</materialx>