USD Importer - not respecting output channels #96458

Closed
opened 2022-03-14 17:44:28 +01:00 by Steven Craft · 21 comments

System Information
Operating system: Windows
Graphics card: NVIDIA GeForce GTX 1060 6GB

Blender Version
Broken: 3.01, dc2d180181, master, 2022-01-25
Worked: N/A

Short description of error

Importing USD files that have specific channels of a texture connected to material properties does not work (the channels aren't separated before being connected to the material properties).

Exact steps for others to reproduce the error

  • Author a USD file that has a texture channel that has metallic in the blue channel and roughness in the green channel
  • Note inside the USD file it specifies that float inputs:metallic.connect = texture:b and float inputs:roughness.connect = texture:g this is correct
  • Import into Blender
  • View the Shading tab and note the full-colour output of the texture is connected to both 'Metallic' and 'Roughness'

Note if you author the same file as GLTF and import that into Blender, it will correctly add a 'Separate RGB' node after the texture, then connect the B output to a 'Metallic Factor' node and then onto the 'Metallic' property, and to the 'Separate RGB' also connect the B output directly to Roughness.

This is how the GLTF shader nodes look:

Blender_GLTF.png

This is how the USD shader nodes look:

Blender_USD.png

**System Information** Operating system: Windows Graphics card: NVIDIA GeForce GTX 1060 6GB **Blender Version** Broken: 3.01, dc2d18018171, master, 2022-01-25 Worked: N/A **Short description of error** Importing USD files that have specific channels of a texture connected to material properties does not work (the channels aren't separated before being connected to the material properties). **Exact steps for others to reproduce the error** - Author a USD file that has a texture channel that has metallic in the blue channel and roughness in the green channel - Note inside the USD file it specifies that float inputs:metallic.connect = <texture:b> and float inputs:roughness.connect = <texture:g> this is correct - Import into Blender - View the Shading tab and note the full-colour output of the texture is connected to both 'Metallic' and 'Roughness' # Note if you author the same file as GLTF and import that into Blender, it will correctly add a 'Separate RGB' node after the texture, then connect the B output to a 'Metallic Factor' node and then onto the 'Metallic' property, and to the 'Separate RGB' also connect the B output directly to Roughness. This is how the GLTF shader nodes look: ![Blender_GLTF.png](https://archive.blender.org/developer/F12927467/Blender_GLTF.png) This is how the USD shader nodes look: ![Blender_USD.png](https://archive.blender.org/developer/F12927466/Blender_USD.png)
Author

Added subscriber: @scraft

Added subscriber: @scraft
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

Can you attach one such file to make testing easier?
But it does seem like the importer ignores all USD tokens except for the alpha one. So this seems like a limitation than a bug. Tagging the appropriate module for more information.

Can you attach one such file to make testing easier? But it does seem like the importer ignores all USD tokens except for the alpha one. So this seems like a limitation than a bug. Tagging the appropriate module for more information.
Author

As a side note, the GLTF specification is a little more rigid for shininess/roughness and metalicity: https:*www.khronos.org/blog/art-pipeline-for-gltf

The Ambient Occlusion, Roughness, and Metallic textures are saved in a single channel-packed texture to reduce the number of texture loads. The textures need to be packed into the channels of your texture as follows:
Red: Ambient Occlusion
Green: Roughness
Blue: Metallic

I appreciate this is GLTF and therefore doesn't apply directly to USD, but at the same time, the formats do sort of go hand-in-hand, ie if you want to author out assets that will be natively consumed on all devices then you have to export to both GLTF and USD. In general, both formats use 'standard' PBR rendering, so the idea is the result should look identical in each format. Because of the above, Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM (Occlusion, Roughness, and Metallic). It is also what is done by Unity for example when exporting to GLTF or USD.

I only point this out as a note that I am not attempting to do something exotic or unusual (which perhaps can be ignored as somewhat of an edge case) but instead am using a well-defined standard which currently Blender doesn't support.

I will try to make a simple test case USD/GLTF file for you.

As a side note, the GLTF specification is a little more rigid for shininess/roughness and metalicity: [https:*www.khronos.org/blog/art-pipeline-for-gltf ](https:*www.khronos.org/blog/art-pipeline-for-gltf) > The Ambient Occlusion, Roughness, and Metallic textures are saved in a single channel-packed texture to reduce the number of texture loads. The textures need to be packed into the channels of your texture as follows: > Red: Ambient Occlusion > **Green: Roughness** > **Blue: Metallic** I appreciate this is GLTF and therefore doesn't apply directly to USD, but at the same time, the formats do sort of go hand-in-hand, ie if you want to author out assets that will be natively consumed on all devices then you have to export to both GLTF and USD. In general, both formats use 'standard' PBR rendering, so the idea is the result should look identical in each format. Because of the above, Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM (Occlusion, Roughness, and Metallic). It is also what is done by Unity for example when exporting to GLTF or USD. I only point this out as a note that I am not attempting to do something exotic or unusual (which perhaps can be ignored as somewhat of an edge case) but instead am using a well-defined standard which currently Blender doesn't support. I will try to make a simple test case USD/GLTF file for you.

Added subscribers: @makowalski, @mont29

Added subscribers: @makowalski, @mont29

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

@scraft Please attach a small reproducible test case, otherwise we'll have to close the report.

@makowalski maybe knows better about this topic though?

@scraft Please attach a small reproducible test case, otherwise we'll have to close the report. @makowalski maybe knows better about this topic though?

I can generate a test case based on the description and will investigate.

I can generate a test case based on the description and will investigate.
Member

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
Bastien Montagne added this to the Pipeline, Assets & IO project 2023-02-09 15:40:38 +01:00
Philipp Oeser removed the
Interest
Pipeline, Assets & IO
label 2023-02-10 08:54:05 +01:00

System Information
Operating system: Windows
Graphics card: NVIDIA GeForce RTX 3070

Blender Version
Broken: 4.0.1, branch: blender-v4.0-release, commit date: 2023-11-16 16:40, hash: d0dd92834a, type: release
Worked: N/A

This problem still exists.


#usda 1.0
(
    endTimeCode = 213
    framesPerSecond = 24
    metersPerUnit = 1
    startTimeCode = 213
    timeCodesPerSecond = 24
    upAxis = "Y"
)

def Cube "cube1" (
    prepend apiSchemas = ["MaterialBindingAPI"]
)
{
    float3[] extent = [(-1, -1, -1), (1, 1, 1)]
    rel material:binding = </mat>
    double size = 2
    matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
    uniform token[] xformOpOrder = ["xformOp:transform"]
}

def Material "mat" (
    prepend inherits = </__class_mtl__/usdpreviewmaterial>
)
{
    token outputs:surface.connect = </mat/usdpreviewsurface.outputs:surface>
    matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
    uniform token[] xformOpOrder = ["xformOp:transform"]

    def Shader "usdpreviewsurface"
    {
        uniform token info:id = "UsdPreviewSurface"
        color3f inputs:roughness.connect = </mat/usduvtexture1.outputs:r>
        token outputs:surface
    }

    def Shader "usduvtexture1"
    {
        uniform token info:id = "UsdUVTexture"
        asset inputs:file = @testfile.png@
        float2 inputs:st.connect = </mat/usdprimvarreader1.outputs:result>
        float outputs:r
    }

    def Shader "usdprimvarreader1"
    {
        uniform token info:id = "UsdPrimvarReader_float2"
        string inputs:varname = "st"
        float2 outputs:result
    }
}

System Information Operating system: Windows Graphics card: NVIDIA GeForce RTX 3070 Blender Version Broken: 4.0.1, branch: blender-v4.0-release, commit date: 2023-11-16 16:40, hash: d0dd92834a08, type: release Worked: N/A This problem still exists. ``` #usda 1.0 ( endTimeCode = 213 framesPerSecond = 24 metersPerUnit = 1 startTimeCode = 213 timeCodesPerSecond = 24 upAxis = "Y" ) def Cube "cube1" ( prepend apiSchemas = ["MaterialBindingAPI"] ) { float3[] extent = [(-1, -1, -1), (1, 1, 1)] rel material:binding = </mat> double size = 2 matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ) uniform token[] xformOpOrder = ["xformOp:transform"] } def Material "mat" ( prepend inherits = </__class_mtl__/usdpreviewmaterial> ) { token outputs:surface.connect = </mat/usdpreviewsurface.outputs:surface> matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ) uniform token[] xformOpOrder = ["xformOp:transform"] def Shader "usdpreviewsurface" { uniform token info:id = "UsdPreviewSurface" color3f inputs:roughness.connect = </mat/usduvtexture1.outputs:r> token outputs:surface } def Shader "usduvtexture1" { uniform token info:id = "UsdUVTexture" asset inputs:file = @testfile.png@ float2 inputs:st.connect = </mat/usdprimvarreader1.outputs:result> float outputs:r } def Shader "usdprimvarreader1" { uniform token info:id = "UsdPrimvarReader_float2" string inputs:varname = "st" float2 outputs:result } } ```
Iliya Katushenock added
Status
Confirmed
and removed
Status
Needs Info from Developers
labels 2024-02-01 14:02:24 +01:00

Change status to Confirm after 2 years of Needs Info from Developers.

Change status to `Confirm` after 2 years of `Needs Info from Developers`.
Member

Change status to Confirm after 2 years of Needs Info from Developers.

Em, we still have to reproduce/check on this, will reset to Needs Triage

> Change status to `Confirm` after 2 years of `Needs Info from Developers`. Em, we still have to reproduce/check on this, will reset to `Needs Triage`
Philipp Oeser added
Status
Needs Triage
and removed
Status
Confirmed
labels 2024-02-01 14:24:35 +01:00

Change status to Confirm after 2 years of Needs Info from Developers.

Em, we still have to reproduce/check on this, will reset to Needs Triage

When use Separate Color / XYZ to connect channels to materials, USD export also not correct.
that can be exported, but the channel is always as 'r'.
img

#usda 1.0
(
    defaultPrim = "Cube"
    doc = "Blender v4.0.1"
    metersPerUnit = 1
    upAxis = "Z"
)

def Xform "Cube"
{
    matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
    uniform token[] xformOpOrder = ["xformOp:transform"]

    def Mesh "Cube" (
        prepend apiSchemas = ["MaterialBindingAPI"]
    )
    {
        uniform bool doubleSided = 1
        float3[] extent = [(-1, -1, -1), (1, 1, 1)]
        int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
        int[] faceVertexIndices = [0, 4, 6, 2, 3, 2, 6, 7, 7, 6, 4, 5, 5, 1, 3, 7, 1, 0, 2, 3, 5, 4, 0, 1]
        rel material:binding = </_materials/Material>
        normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, 0, -1), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)] (
            interpolation = "faceVarying"
        )
        point3f[] points = [(1, 1, 1), (1, 1, -1), (1, -1, 1), (1, -1, -1), (-1, 1, 1), (-1, 1, -1), (-1, -1, 1), (-1, -1, -1)]
        bool[] primvars:sharp_face = [1, 1, 1, 1, 1, 1] (
            interpolation = "uniform"
        )
        texCoord2f[] primvars:UVMap = [(0.625, 0.5), (0.875, 0.5), (0.875, 0.75), (0.625, 0.75), (0.375, 0.75), (0.625, 0.75), (0.625, 1), (0.375, 1), (0.375, 0), (0.625, 0), (0.625, 0.25), (0.375, 0.25), (0.125, 0.5), (0.375, 0.5), (0.375, 0.75), (0.125, 0.75), (0.375, 0.5), (0.625, 0.5), (0.625, 0.75), (0.375, 0.75), (0.375, 0.25), (0.625, 0.25), (0.625, 0.5), (0.375, 0.5)] (
            interpolation = "faceVarying"
        )
        uniform token subdivisionScheme = "none"
    }
}

def "_materials"
{
    def Material "Material"
    {
        token outputs:surface.connect = </_materials/Material/Principled_BSDF.outputs:surface>

        def Shader "Principled_BSDF"
        {
            uniform token info:id = "UsdPreviewSurface"
            float inputs:clearcoat = 0
            float inputs:clearcoatRoughness = 0.03
            color3f inputs:diffuseColor = (0.8, 0.8, 0.8)
            float inputs:ior = 1.45
            float inputs:metallic.connect = </_materials/Material/Image_Texture.outputs:r>
            float inputs:opacity = 1
            float inputs:roughness.connect = </_materials/Material/Image_Texture.outputs:r>
            float inputs:specular = 0.5
            token outputs:surface
        }

        def Shader "Image_Texture"
        {
            uniform token info:id = "UsdUVTexture"
            asset inputs:file = @./textures/CustomUVChecker_byValle_4K.png@
            token inputs:sourceColorSpace = "sRGB"
            float2 inputs:st.connect = </_materials/Material/uvmap.outputs:result>
            float outputs:r
        }

        def Shader "uvmap"
        {
            uniform token info:id = "UsdPrimvarReader_float2"
            token inputs:varname = "UVMap"
            float2 outputs:result
        }
    }
}


> > Change status to `Confirm` after 2 years of `Needs Info from Developers`. > > Em, we still have to reproduce/check on this, will reset to `Needs Triage` When use Separate Color / XYZ to connect channels to materials, USD export also not correct. that can be exported, but the channel is always as 'r'. ![img](https://i.imgur.com/aFtTEcA.jpeg) ``` #usda 1.0 ( defaultPrim = "Cube" doc = "Blender v4.0.1" metersPerUnit = 1 upAxis = "Z" ) def Xform "Cube" { matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ) uniform token[] xformOpOrder = ["xformOp:transform"] def Mesh "Cube" ( prepend apiSchemas = ["MaterialBindingAPI"] ) { uniform bool doubleSided = 1 float3[] extent = [(-1, -1, -1), (1, 1, 1)] int[] faceVertexCounts = [4, 4, 4, 4, 4, 4] int[] faceVertexIndices = [0, 4, 6, 2, 3, 2, 6, 7, 7, 6, 4, 5, 5, 1, 3, 7, 1, 0, 2, 3, 5, 4, 0, 1] rel material:binding = </_materials/Material> normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, 0, -1), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)] ( interpolation = "faceVarying" ) point3f[] points = [(1, 1, 1), (1, 1, -1), (1, -1, 1), (1, -1, -1), (-1, 1, 1), (-1, 1, -1), (-1, -1, 1), (-1, -1, -1)] bool[] primvars:sharp_face = [1, 1, 1, 1, 1, 1] ( interpolation = "uniform" ) texCoord2f[] primvars:UVMap = [(0.625, 0.5), (0.875, 0.5), (0.875, 0.75), (0.625, 0.75), (0.375, 0.75), (0.625, 0.75), (0.625, 1), (0.375, 1), (0.375, 0), (0.625, 0), (0.625, 0.25), (0.375, 0.25), (0.125, 0.5), (0.375, 0.5), (0.375, 0.75), (0.125, 0.75), (0.375, 0.5), (0.625, 0.5), (0.625, 0.75), (0.375, 0.75), (0.375, 0.25), (0.625, 0.25), (0.625, 0.5), (0.375, 0.5)] ( interpolation = "faceVarying" ) uniform token subdivisionScheme = "none" } } def "_materials" { def Material "Material" { token outputs:surface.connect = </_materials/Material/Principled_BSDF.outputs:surface> def Shader "Principled_BSDF" { uniform token info:id = "UsdPreviewSurface" float inputs:clearcoat = 0 float inputs:clearcoatRoughness = 0.03 color3f inputs:diffuseColor = (0.8, 0.8, 0.8) float inputs:ior = 1.45 float inputs:metallic.connect = </_materials/Material/Image_Texture.outputs:r> float inputs:opacity = 1 float inputs:roughness.connect = </_materials/Material/Image_Texture.outputs:r> float inputs:specular = 0.5 token outputs:surface } def Shader "Image_Texture" { uniform token info:id = "UsdUVTexture" asset inputs:file = @./textures/CustomUVChecker_byValle_4K.png@ token inputs:sourceColorSpace = "sRGB" float2 inputs:st.connect = </_materials/Material/uvmap.outputs:result> float outputs:r } def Shader "uvmap" { uniform token info:id = "UsdPrimvarReader_float2" token inputs:varname = "UVMap" float2 outputs:result } } } ```
Member

I can confirm the behavior (and sorry this has been lying around in such unclear state for so long).

BUT: this is not really expected to work in the current state of USD import/export, see https://docs.blender.org/manual/en/4.1/files/import_export/usd.html

Not all nodes are supported; currently only Diffuse, Principle, Image Textures, and UVMap nodes are supported.

Also this comment gives a hint at the limitations (this does not mention the channel mapping explicitly, just saying...):

 * Limitations: arbitrary primvar readers or UsdTransform2d not yet
 * supported. For #UsdUVTexture, only the file, st and #sourceColorSpace
 * inputs are handled.
 *
 * TODO(makowalski):  Investigate adding support for converting additional
 * shaders and inputs.  Supporting certain types of inputs, such as texture
 * scale and bias, will probably require creating Blender Group nodes with
 * the corresponding inputs.

Improvements unfortunately only come here bit by bit (e.g. in 925fb66693)

I also understand that you are not doing something out of the ordinary, but uncertain at this point if "Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM" is something we can always assume, but of course, if this is explicitly specified in the USD file, setting up blenders nodes (via a Separate RGB node) is the way to go.

Maybe @makowalski and/or @CharlesWardlaw can comment on the plans of adding support for more nodes.

That all being said, the issue here is more like a feature request than a "real bug", usually these kinds of reports get closed, but maybe we can keep this as a TODO.

I guess the first (and more straightforward) step would be to tweak the importer (this would just mean adding a single node), the exporter might be a bit more involved (since this would have to traverse all nodes between to target socket and the Image Texture node and the question always is: "what to do if there is additional stuff happening there, not just a channel separation?")

I can confirm the behavior (and sorry this has been lying around in such unclear state for so long). BUT: this is not really expected to work in the current state of USD import/export, see https://docs.blender.org/manual/en/4.1/files/import_export/usd.html >Not all nodes are supported; currently only Diffuse, Principle, Image Textures, and UVMap nodes are supported. Also this comment gives a hint at the limitations (this does not mention the channel mapping explicitly, just saying...): ``` * Limitations: arbitrary primvar readers or UsdTransform2d not yet * supported. For #UsdUVTexture, only the file, st and #sourceColorSpace * inputs are handled. * * TODO(makowalski): Investigate adding support for converting additional * shaders and inputs. Supporting certain types of inputs, such as texture * scale and bias, will probably require creating Blender Group nodes with * the corresponding inputs. ``` Improvements unfortunately only come here bit by bit (e.g. in 925fb66693ded4b8ed03cee86307682f65d6fd8a) I also understand that you are not doing something out of the ordinary, but uncertain at this point if "Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM" is something we can **always** assume, but of course, if this is explicitly specified in the USD file, setting up blenders nodes (via a `Separate RGB` node) is the way to go. Maybe @makowalski and/or @CharlesWardlaw can comment on the plans of adding support for more nodes. That all being said, the issue here is more like a feature request than a "real bug", usually these kinds of reports get closed, but maybe we can keep this as a TODO. I guess the first (and more straightforward) step would be to tweak the importer (this would just mean adding a single node), the exporter might be a bit more involved (since this would have to traverse all nodes between to target socket and the Image Texture node and the question always is: "what to do if there is additional stuff happening there, not just a channel separation?")
Member

When use Separate Color / XYZ to connect channels to materials, USD export also not correct.
that can be exported, but the channel is always as 'r'.

at the current state, this is also what the code intends to do, see the following comment

/* If the input is a float, we connect it to either the texture alpha or red channels. */

> When use Separate Color / XYZ to connect channels to materials, USD export also not correct. > that can be exported, but the channel is always as 'r'. at the current state, this is also what the code intends to do, see the following comment `/* If the input is a float, we connect it to either the texture alpha or red channels. */`
Member

Actually, I would like to check on this for a bit, maybe it is just a really quick thing to support

Actually, I would like to check on this for a bit, maybe it is just a really quick thing to support
Philipp Oeser added
Type
To Do
Status
Confirmed
and removed
Type
Report
Status
Needs Triage
labels 2024-02-02 10:27:52 +01:00
Philipp Oeser self-assigned this 2024-02-02 10:28:00 +01:00
Member

OK, I got a POC working (both on the export and the import side).

A roundtrip looks like this atm.:

Nodetree that gets exported

image

Nodetree after import

image

So next to testing some more real-world examples, it "just" needs a bit more work to get node placement right and it might make sense to cache the Separate Color nodes as well (so we dont create multiple of these for a single texture).

OK, I got a POC working (both on the export and the import side). A roundtrip looks like this atm.: Nodetree that gets exported ![image](/attachments/4b49cb0e-f61e-4a04-b8e5-48406d0f70c5) Nodetree after import ![image](/attachments/a3385589-3d37-433d-93ea-f18abcef5cc3) So next to testing some more real-world examples, it "just" needs a bit more work to get node placement right and it might make sense to cache the Separate Color nodes as well (so we dont create multiple of these for a single texture).

@mikan233 @lichtwerk Thanks for following up on this.

My apologies that this issue fell to the wayside. As mentioned above, improvements to the USD Preview Surface IO have been incremental. We've been planning to add support for handling texture channels, but no one has started work on this yet, so this contribution is most welcome.

@lichtwerk Thanks for the prototype! It seems to me you're on the right track. If you'd like to create a pull request with these changes, I would be happy to review it and also discuss further any issues you're encountering.

@mikan233 @lichtwerk Thanks for following up on this. My apologies that this issue fell to the wayside. As mentioned above, improvements to the `USD Preview Surface` IO have been incremental. We've been planning to add support for handling texture channels, but no one has started work on this yet, so this contribution is most welcome. @lichtwerk Thanks for the prototype! It seems to me you're on the right track. If you'd like to create a pull request with these changes, I would be happy to review it and also discuss further any issues you're encountering.

I can confirm the behavior (and sorry this has been lying around in such unclear state for so long).

BUT: this is not really expected to work in the current state of USD import/export, see https://docs.blender.org/manual/en/4.1/files/import_export/usd.html

Not all nodes are supported; currently only Diffuse, Principle, Image Textures, and UVMap nodes are supported.

Also this comment gives a hint at the limitations (this does not mention the channel mapping explicitly, just saying...):

 * Limitations: arbitrary primvar readers or UsdTransform2d not yet
 * supported. For #UsdUVTexture, only the file, st and #sourceColorSpace
 * inputs are handled.
 *
 * TODO(makowalski):  Investigate adding support for converting additional
 * shaders and inputs.  Supporting certain types of inputs, such as texture
 * scale and bias, will probably require creating Blender Group nodes with
 * the corresponding inputs.

Improvements unfortunately only come here bit by bit (e.g. in 925fb66693)

I also understand that you are not doing something out of the ordinary, but uncertain at this point if "Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM" is something we can always assume, but of course, if this is explicitly specified in the USD file, setting up blenders nodes (via a Separate RGB node) is the way to go.

Maybe @makowalski and/or @CharlesWardlaw can comment on the plans of adding support for more nodes.

That all being said, the issue here is more like a feature request than a "real bug", usually these kinds of reports get closed, but maybe we can keep this as a TODO.

I guess the first (and more straightforward) step would be to tweak the importer (this would just mean adding a single node), the exporter might be a bit more involved (since this would have to traverse all nodes between to target socket and the Image Texture node and the question always is: "what to do if there is additional stuff happening there, not just a channel separation?")

You are right. But the USD specification allows that, Blender to be unable to follow the import and export rules of USD. that be incompatible with most supported software.

> I can confirm the behavior (and sorry this has been lying around in such unclear state for so long). > > BUT: this is not really expected to work in the current state of USD import/export, see https://docs.blender.org/manual/en/4.1/files/import_export/usd.html > > >Not all nodes are supported; currently only Diffuse, Principle, Image Textures, and UVMap nodes are supported. > > Also this comment gives a hint at the limitations (this does not mention the channel mapping explicitly, just saying...): > > ``` > * Limitations: arbitrary primvar readers or UsdTransform2d not yet > * supported. For #UsdUVTexture, only the file, st and #sourceColorSpace > * inputs are handled. > * > * TODO(makowalski): Investigate adding support for converting additional > * shaders and inputs. Supporting certain types of inputs, such as texture > * scale and bias, will probably require creating Blender Group nodes with > * the corresponding inputs. > ``` > > Improvements unfortunately only come here bit by bit (e.g. in 925fb66693ded4b8ed03cee86307682f65d6fd8a) > > I also understand that you are not doing something out of the ordinary, but uncertain at this point if "Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM" is something we can **always** assume, but of course, if this is explicitly specified in the USD file, setting up blenders nodes (via a `Separate RGB` node) is the way to go. > > Maybe @makowalski and/or @CharlesWardlaw can comment on the plans of adding support for more nodes. > > That all being said, the issue here is more like a feature request than a "real bug", usually these kinds of reports get closed, but maybe we can keep this as a TODO. > > I guess the first (and more straightforward) step would be to tweak the importer (this would just mean adding a single node), the exporter might be a bit more involved (since this would have to traverse all nodes between to target socket and the Image Texture node and the question always is: "what to do if there is additional stuff happening there, not just a channel separation?") You are right. But the USD specification allows that, Blender to be unable to follow the import and export rules of USD. that be incompatible with most supported software.
Member

PR is up , see #117901

PR is up , see https://projects.blender.org/blender/blender/pulls/117901
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-02-08 10:01:56 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#96458
No description provided.