When a new UsdPreviewSurface Texture is created, the Shader connection is not in accordance with the specification

Hi,
I am checking to see if the USD material UsdPreviewSurface specification is reflected.

Creating-Materials-UsdPreviewSurface Texture in OmniverseCreate will create a Material for the UsdPreviewSurface.

The usda file for the material at this time is as follows.
Some parts have been omitted.

def Material "PreviewSurfaceTexture"
{
    token outputs:surface.connect = </World/Looks/PreviewSurfaceTexture/PreviewSurfaceTexture.outputs:surface>

    def Shader "PreviewSurfaceTexture"
    {
        uniform token info:id = "UsdPreviewSurface"
        float inputs:clearcoat = 0
        float inputs:clearcoatRoughness = 0
        color3f inputs:diffuseColor.connect = </World/Looks/PreviewSurfaceTexture/diffuseColorTex.outputs:rgb>
        float inputs:displacement = 0
        color3f inputs:emissiveColor = (0, 0, 0)
        float inputs:ior = 1.5
        color3f inputs:metallic.connect = </World/Looks/PreviewSurfaceTexture/metallicTex.outputs:rgb>
        normal3f inputs:normal.connect = </World/Looks/PreviewSurfaceTexture/normalTex.outputs:rgb>
        float inputs:occlusion = 1
        float inputs:opacity = 1
        float inputs:opacityThreshold = 0
        color3f inputs:roughness.connect = </World/Looks/PreviewSurfaceTexture/roughnessTex.outputs:rgb>
        color3f inputs:specularColor = (0, 0, 0)
        int inputs:useSpecularWorkflow = 0
        token outputs:surface
    }

    def Shader "diffuseColorTex"
    {
        uniform token info:id = "UsdUVTexture"
        ...
        color3f outputs:rgb
    }

    def Shader "metallicTex"
    {
        uniform token info:id = "UsdUVTexture"
        ...
        color3f outputs:rgb
    }

    def Shader "roughnessTex"
    {
        uniform token info:id = "UsdUVTexture"
        ...
        color3f outputs:rgb
    }

    def Shader "normalTex"
    {
        uniform token info:id = "UsdUVTexture"
        ...
        color3f outputs:rgb
    }
}

There are two problems.

  • UsdPrimvarReader_float2 is not specified
  • metallic/roughness map is not accepted in rgb (Received in float)

Below are the specifications for TextureReader.
https://graphics.pixar.com/usd/release/spec_usdpreviewsurface.html#texture-reader

UsdPrimvarReader_float2 is not specified

If the UV of the mesh is set to “st”,the following is the description according to the UsdPreviewSurface specification.

def Material "PreviewSurfaceTexture"
{
    token inputs:frame:stPrimvarName = "st"
    token outputs:surface.connect = </World/Looks/PreviewSurfaceTexture/PreviewSurfaceTexture.outputs:surface>

    def Shader "PreviewSurfaceTexture"
    {
        uniform token info:id = "UsdPreviewSurface"
        color3f inputs:diffuseColor.connect = </World/Looks/PreviewSurfaceTexture/diffuseColorTex.outputs:rgb>
        token outputs:surface
    }

    def Shader "stReader"
    {
        uniform token info:id = "UsdPrimvarReader_float2"
        token inputs:varname.connect = </World/Looks/PreviewSurfaceTexture.inputs:frame:stPrimvarName>
        float2 outputs:result
    }

    def Shader "diffuseColorTex"
    {
        uniform token info:id = "UsdUVTexture"
        float2 inputs:st.connect = </World/Looks/PreviewSurfaceTexture/stReader.outputs:result>
        ...
        color3f outputs:rgb
    }
}

When creating a mesh with Omniverse Create, the default UV is specified with “st”, so the preset Create UsdPreviewSurface Texture may be “st”.

“UsdPrimvarReader_float2” is added, and UsdUVTexture connects UsdPrimvarReader_float2 to trace UVs.
If you do not do this, Pixar Storm and USDView will not reflect the textures.

metallic/roughness map is not accepted in rgb

metallic and roughness should be received in float.
One element is taken from the rgb, as in “outputs:r”.

def Material "PreviewSurfaceTexture"
{
    def Shader "PreviewSurfaceTexture"
    {
        uniform token info:id = "UsdPreviewSurface"
        float inputs:metallic.connect = </World/Looks/PreviewSurfaceTexture/metallicTex.outputs:r>
        float inputs:roughness.connect = </World/Looks/PreviewSurfaceTexture/roughnessTex.outputs:r>
    }

    def Shader "metallicTex"
    {
        uniform token info:id = "UsdUVTexture"
        float2 inputs:st.connect = </World/Looks/PreviewSurfaceTexture/stReader.outputs:result>
        float outputs:r
    }

    def Shader "roughnessTex"
    {
        uniform token info:id = "UsdUVTexture"
        float2 inputs:st.connect = </World/Looks/PreviewSurfaceTexture/stReader.outputs:result>
        float outputs:r
    }
}

UsdPreviewSurface may be written as follows to get closer to a better result.
I have created a sample usda file.
create_UsdPreviewSurface_texture.usda (8.4 KB)

Check Environment

  • OS : Windows 10
  • Omniverse Create 2022.2.1
1 Like

Thank you @ft-lab for the very detailed write-up. I am able to reproduce these issues. I have created a new ticket for the dev team: OM-63158

1 Like

Improvements to UsdPreviewSurface to bring it inline with the specification will be available in the next major release.

1 Like

Oh, I have been waiting for this. Thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.