Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues and expectations on import/export #3319

Open
csyshing opened this issue Sep 8, 2023 · 1 comment
Open

Issues and expectations on import/export #3319

csyshing opened this issue Sep 8, 2023 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@csyshing
Copy link
Collaborator

csyshing commented Sep 8, 2023

Describe the bug

Hi,

We recently have tested the USD import/export and found some issues:


  1. Import Does not import custom attributes (non-primvars)
  • Example:
    • See the example USD file with custom attributes and primvars below
    • Custom attributes, "my_int", "my_bool" etc. are missing after importing
    • Import_custom_attr_primvars
  • Question:
    • Is it configurable for the import command?
    • If not, is it the only way by implementing custom adaptor / chaser?
  • Expectation:
    • Custom attributes can be imported as Maya attributes in Maya

  1. Import Does not import color4f/float4f/vector4f and their array form, the plugin throws error saying "not supported"
  • Example:
    • See the notes in the example USD file with custom attributes and primvars below
  • Expectation:
    • Support importing color4f/float4f/vector4f and their array form

  1. Import Does not have option to import displayColor and displayOpacity as combined RGBA color set (comparing with AL_USDMaya), these two special primvars are always created as separated color sets, separately
  • Example:

    • See the example USD file with constant displayColor and displayOpacity below
    • displayColor_displayOpacity_imported_separately
  • Expectation:

    • Provide configurable option to combine displayColor and displayOpacity as one RGBA color set

  1. Import float[]/float3[]/color3f[] primvars are handled differently
  • Problems:

    • By default, float[] becomes alpha (A); float3[] and color3f[] become RGB channel
    • These primvars can be configured to not become 'color set' via import options 'excludePrimvar', but this is not ideal:
      • Those primvars would be ignored completely (missing after importing) if they are marked with 'excludePrimvar' option
      • User (or the pipeline tool) will need to know the list of exclusive names beforehand, otherwise the tool will need to traverse the hierarchy to collect the list of primvar names. this might not be practical: imaging if the tool needs to import a heavy scene with different kinds of meshes and those meshes have different custom primvars for different purposes.
    • Using 'excludePrimvarNamespace' might work for excluding a set of primvars but unfortunately it does not work for workflow that does not have namespaced primvars
  • Example:

    • See the example USD file with custom attributes and primvars below
    • Import_custom_attr_primvars
  • Expectation:

    • Have option to import float[]/float3[]/color3f[] primvars as Maya custom attributes, just like other primvar types

  1. Export The custom primvars are imported as Maya custom attributes (on the shape), but the exporter does not seem to export them back to USD except the ones that previously imported as 'color set'
  • Example:
    • See the example USD file with custom attributes and primvars below
    • Example output:
#usda 1.0
(
    defaultPrim = "root"
    metersPerUnit = 0.01
    upAxis = "Y"
)

def Xform "root" (
    kind = "component"
)
{
    def Mesh "geo" (
        kind = "component"
    )
    {
        float3[] extent = [(-0.5, 0, -0.5), (0.5, 0, 0.5)]
        int[] faceVertexCounts = [4, 4, 4, 4]
        int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
        point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
        color3f[] primvars:custom_color3f_array = [(1, 1, 1)]
        int[] primvars:custom_color3f_array:indices = [0]
        color3f[] primvars:custom_float3_array = [(1, 2, 3)]
        int[] primvars:custom_float3_array:indices = [0]
        float[] primvars:custom_float_array = [1]
        int[] primvars:custom_float_array:indices = [0]
        color3f[] primvars:displayColor = [(0.13320851, 0.13320851, 0.13320851)] (
            customData = {
                dictionary Maya = {
                    bool generated = 1
                }
            }
        )
    }
}
  • Expectation:
    • Support exporting custom Maya attributes on the shape as custom USD primvars

  1. Export Constant color sets seem to be always exported as indexed primvars without correct interpolation
  • Example:
    • See the example USD file with constant displayColor and displayOpacity below
    • Example output:
        def Mesh "plane_constant" (
            kind = "component"
        )
        {
            uniform bool doubleSided = 1
            float3[] extent = [(-0.5, 0, -0.5), (0.5, 0, 0.5)]
            int[] faceVertexCounts = [4, 4, 4, 4]
            int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
            point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
            color3f[] primvars:displayColor = [(1, 0, 0)]
            int[] primvars:displayColor:indices = [0]
            float[] primvars:displayOpacity = [0.2]
            int[] primvars:displayOpacity:indices = [0]
        }
  • Expectation:
    • Being able to export constant color sets with correct interpolation ('interpolation = constant')

Steps to reproduce
Steps to reproduce the behavior:

  1. Launch Maya and import these two USD example files

Expected behavior

See the individual expectations on each item above.

Attachments

Example USD file with custom attributes and primvars:

#usda 1.0
(
    defaultPrim = "root"
)

def Xform "root"
{
    def Mesh "geo" (
        kind = "component"
    )
    {
        float3[] extent = [(-0.5, 0, -0.5), (0.5, 0, 0.5)]
        int[] faceVertexCounts = [4, 4, 4, 4]
        int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
        normal3f[] normals = [(0, 1, 0)] (
            interpolation = "constant"
        )
        point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
        double3 xformOp:translate = (0, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]

        # Custom attributes
        custom bool my_bool = 1
        custom int my_int = 1
        custom int[] my_int_array = [1, 2, 3, 4]

        custom float my_float = 2
        custom float[] my_float_array = [1, 2, 3, 4]
        custom float3[] my_float3_array = [(1, 2, 3)]
        # custom float4 my_float4 = (1, 2, 3, 4)  # NOTE: maya-usd does not support "float4"
        # custom float4[] my_float4_array = [(1, 2, 3, 4)]  # NOTE: maya-usd does not support "float4[]"

        custom color3f my_color3f = (1, 1, 1)
        custom color3f[] my_color3f_array = [(1, 1, 1), (1, 1, 1), (1, 1, 1)]
        # custom color4f my_color4f = (1, 1, 1, 1)  # NOTE: maya-usd does not support "color4f"
        # custom color4f[] my_color4f_array = [(1, 1, 1, 1), (1, 1, 1, 1), (1, 1, 1, 1)]  # NOTE: maya-usd does not support "color4f[]"

        custom point3f my_point3f = (1, 2, 3)
        custom point3f[] my_point3f_array = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]

        custom normal3f my_normal3f = (1, 2, 3)
        custom normal3f[] my_normal3f_array = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]

        custom vector3f my_vector3f = (1, 2, 3)
        custom vector3f[] my_vector3f_array = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]

        custom token my_token = "custom token value"
        custom token[] my_token_array = ["A", "B", "C"]

        # Custom primvars
        custom bool primvars:my_bool_primvar = 1
        custom int primvars:my_int_primvar = 2
        custom int[] primvars:my_int_array_primvar = [1, 2, 3, 4]

        custom float primvars:my_float_primvar = 2
        custom float[] primvars:my_float_array_primvar = [1, 2, 3, 4]
        custom float3[] primvars:my_float3_array_primvar = [(1, 2, 3)]
        # custom float4 primvars:my_float4_primvar = (1, 2, 3, 4)  # NOTE: maya-usd does not support "float4"
        # custom float4[] primvars:my_float4_array_primvar = [(1, 2, 3, 4)]  # NOTE: maya-usd does not support "float4[]"

        custom color3f primvars:my_color3f_primvar = (1, 1, 1)
        custom color3f[] primvars:my_color3f_array_primvar = [(1, 1, 1), (1, 1, 1), (1, 1, 1)]
        # custom color4f primvars:my_color4f_primvar = (1, 1, 1, 1)  # NOTE: maya-usd does not support "color4f"
        # custom color4f[] primvars:my_color4f_array_primvar = [(1, 1, 1, 1), (1, 1, 1, 1), (1, 1, 1, 1)]  # NOTE: maya-usd does not support "color4f[]"

        custom point3f primvars:my_point3f_primvar = (1, 2, 3)
        custom point3f[] primvars:my_point3f_array_primvar = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]

        custom normal3f primvars:my_normal3f_primvar = (1, 2, 3)
        custom normal3f[] primvars:my_normal3f_array_primvar = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]

        custom vector3f primvars:my_vector3f_primvar = (1, 2, 3)
        custom vector3f[] primvars:my_vector3f_array_primvar = [(1, 1, 1), (2, 2, 2), (3, 3, 3)]

        custom token primvars:my_token_primvar = "custom primvar token"
        custom token[] primvars:my_token_array_primvar = ["primvar A", "primvar B", "primvar C"]
    }
}

Example USD file with constant displayColor and displayOpacity

#usda 1.0
(
    defaultPrim = "root"
)

def Xform "root" (
    kind = "group"
)
{
    def Mesh "plane_constant" (
        kind = "component"
    )
    {
        int[] faceVertexCounts = [4, 4, 4, 4]
        int[] faceVertexIndices = [0, 1, 4, 3, 1, 2, 5, 4, 3, 4, 7, 6, 4, 5, 8, 7]
        point3f[] points = [(-0.5, 0, 0.5), (0, 0, 0.5), (0.5, 0, 0.5), (-0.5, 0, 0), (0, 0, 0), (0.5, 0, 0), (-0.5, 0, -0.5), (0, 0, -0.5), (0.5, 0, -0.5)]
        color3f[] primvars:displayColor = [(1, 0, 0)] (
            interpolation = "constant"
        )
        float[] primvars:displayOpacity = [0.2] (
            interpolation = "constant"
        )
        uniform bool doubleSided = 1
        double3 xformOp:translate = (0, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
    }
}

Specs (if applicable):

  • OS & version: CentOS 7.8
  • Compiler & version: GCC 6.3
  • Maya version: Maya-2023.3
  • Maya USD commit SHA: Official v0.24.0
  • Pixar USD commit SHA: Tested against official USD-21.8/22.5/23.2
@csyshing csyshing added the bug Something isn't working label Sep 8, 2023
@santosg87
Copy link
Collaborator

@csyshing thank you for reporting this. since there are multiple cases here, and a lot of it are unsupported workflows, I will change the label on this to an enhancement.

I will bring this to the team for a larger discussion, but from an initial assessment/testing, I can answer some of your questions :)

  1. import chasers would indeed be the way to handle this kind of data here, not entirely sure why the array attributes are not being imported, will need to investigate a bit deeper.
  2. for custom attributes to be exported, there are a couple of ways of handling those, although they would require some work on defining the desired attrs. before exporting.

thank you for all the detailed usage and cases. I will see what i can find on more info.

@santosg87 santosg87 added the enhancement New feature or request label Sep 20, 2023
@neilh-adsk neilh-adsk moved this to Needs triage in maya-usd Nov 6, 2023
@Autodesk Autodesk deleted a comment from maya-usd-git-sync bot May 23, 2024
@github-project-automation github-project-automation bot moved this to Needs triage in Issue Triage Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: Needs triage
Status: Needs triage
Development

No branches or pull requests

2 participants