BlenderUSDHydraAddon icon indicating copy to clipboard operation
BlenderUSDHydraAddon copied to clipboard

'Surface' node does not work in MaterialX network

Open pablode opened this issue 3 years ago • 8 comments

Tested with latest master (1.0.77) and Blender 3.0.1.

To reproduce:

  1. open Blender, select 'USD Hydra' render engine
  2. create a cube, assign a new material, convert it to MaterialX
  3. change MaterialX graph to look like this: 2022-03-05 17_15_25-Blender
  4. observe that RPR Preview render is black
  5. export USD scene to file
  6. see that diffuse node is missing from exported material graph
def "Materials"
{
    def Material "surfacematerial_2"
    {
        token inputs:bsdf (
            renderType = "BSDF"
        )
        token inputs:edf (
            renderType = "EDF"
        )
        float inputs:opacity = 1
        token outputs:mtlx:surface.connect = </Cube/Material_001/Materials/surfacematerial_2/ND_surface.outputs:surface>

        def Shader "ND_surface"
        {
            uniform token info:id = "ND_surface"
            token inputs:bsdf (
                renderType = "BSDF"
            )
            token inputs:bsdf.connect = </Cube/Material_001/Materials/surfacematerial_2.inputs:bsdf>
            token inputs:edf (
                renderType = "EDF"
            )
            token inputs:edf.connect = </Cube/Material_001/Materials/surfacematerial_2.inputs:edf>
            float inputs:opacity.connect = </Cube/Material_001/Materials/surfacematerial_2.inputs:opacity>
            token outputs:surface
        }
    }
}

pablode avatar Mar 05 '22 16:03 pablode

Hi.

Seems like USD (our is 21.11) doesn't fully support MaterialX nodes. The MatX file we are generating is correct.

DagerD avatar Mar 21 '22 14:03 DagerD

I think this is the issue we're talking about: https://github.com/PixarAnimationStudios/USD/issues/1502

Wrapping the nodes in a nodegraph seems to work.

pablode avatar Mar 25 '22 22:03 pablode

Yes, you are right. But this method doesn't make all nodes work.

DagerD avatar Mar 29 '22 12:03 DagerD

I would expect this to be fixed in the latest USD version as multiple MaterialX issues have been addressed since USD 21.11: https://github.com/PixarAnimationStudios/USD/issues/1785 https://github.com/PixarAnimationStudios/USD/issues/1784 https://github.com/PixarAnimationStudios/USD/issues/1629 https://github.com/PixarAnimationStudios/USD/issues/1581

I've implemented construction of complex graphs in my converter and it works: https://github.com/pablode/guc/blob/97d156f0d1974aea6ba363e8ce3f0157cda02334/src/libguc/src/materialx.cpp#L388

pablode avatar May 09 '22 21:05 pablode

We have plans to update USD to latest and we will retest this issue.

DagerD avatar May 18 '22 09:05 DagerD

Great to hear! I've recently did some work to update RprUSD to v22.05 - I've set up a draft PR here: https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/557

pablode avatar May 18 '22 16:05 pablode

@DagerD please add a task to our sprint to upgrade.

bsavery avatar Jun 10 '22 14:06 bsavery

Created ticket BLEN-169.

DagerD avatar Jul 19 '22 14:07 DagerD