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

Importing an asset with blendshapes and then re-exporting the imported asset will not yield correct blendshapes #3921

Open
BeardedPlatypus opened this issue Sep 18, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@BeardedPlatypus
Copy link

Hi all,

I have had the opportunity the past days to finally test the latest release of maya-usd with our own implementation. One of the important features for us is support for importing blendshapes. While testing I noticed some weird behavior. Hopefully, it is either a mistake by me or something that could be addressed easily.

Describe the bug

when importing an USD asset with blendshapes and then re-exporting it, the blendshapes on the re-exported asset seem incorrect (for how to create the assets see the reproduction steps below).

The starting usd asset has the following blendshape definition:

    def Mesh "WiggleCube_LOD0" (
        prepend apiSchemas = ["SkelBindingAPI", "MaterialBindingAPI"]
    )
    {
        ...
        uniform token[] skel:blendShapes = ["_WiggleCube_Deformer_Big", "_WiggleCube_Deformer_Smol"]
        rel skel:blendShapeTargets = [
            </WiggleCube/WiggleCube_LOD0/Big>,
            </WiggleCube/WiggleCube_LOD0/Smol>,
        ]
        ...

        def BlendShape "Big"
        {
            uniform vector3f[] normalOffsets = [...]
            uniform vector3f[] offsets = [...]
            uniform int[] pointIndices = [...]
        }

        def BlendShape "Smol"
        {
            uniform vector3f[] normalOffsets = [...]
            uniform vector3f[] offsets = [...]
            uniform int[] pointIndices = [...]
        }
        ...

trimmed down for clarity, original file is included below as example_export.from_maya_scene.usda

Note that there are blendshapes which are correctly set up through blendShapeTargets.

When we import this asset, and re-export without changing anything, the following warning is shown in Maya:

// Error: Duplicate item '/example_export_from_maya_scene_WiggleCube/example_export_from_maya_scene_WiggleCube_LOD0/example_export_from_maya_scene_WiggleCube_LOD0' not allowed for field 'targetPaths' on </example_export_from_maya_scene_WiggleCube/example_export_from_maya_scene_WiggleCube_LOD0.skel:blendShapeTargets>
// Warning: Blendshapes were requested to be exported, but no upstream blendshapes could be found.
// Warning: Invalid prim name 'example_export_from_maya_scene:WiggleCube'
// Warning: Cannot append child 'mtl' to path ''.
// Error: Path must be an absolute path: <>
// Saving stage

And the resulting usd contains the following blendshape data:

    def Mesh "example_export_from_maya_scene_WiggleCube_LOD0" (
        prepend apiSchemas = ["SkelBindingAPI"]
    )
    {
        ...
        uniform token[] skel:blendShapes = ["_example_export_from_maya_scene_blendShape1_example_export_from_maya_scene_WiggleCube_LOD0", "_example_export_from_maya_scene_blendShape1_example_export_from_maya_scene_WiggleCube_LOD0"]
        rel skel:blendShapeTargets = None
        ...

        def BlendShape "example_export_from_maya_scene_WiggleCube_LOD0"
        {
            uniform vector3f[] normalOffsets = [...]
            uniform vector3f[] offsets = [...]
            uniform int[] pointIndices = [...]
        }

trimmed down for clarity, original file is included below as example_export.from_usda_import.usda

Note that we now only have a single blendshape, the blendShapeTargets has not been set correctly, and the tokens in blendShapes contain two duplicate values.

I would have expected values similar to the original usda file. I am assuming there is some difference between the way blendshapes are configured upon import that causes this issue, however I have not dug into the code to confirm that.

Steps to reproduce

  • Creating the initial usda file
    1. Open example.usda in Maya 2023
      image
    2. Select the WiggleCube transform
    3. Export selection to usda (I set the file to be a polygonal subdivision scheme and turned on all export options, including animation data and skelroots and skinning)
      The produced file is included as example_export.from_maya_scene.usda
  • Importing the initial usda file
    1. Create a new scene in Maya
    2. Press the import and select USD Import
    3. Make sure that "Animation Data" is enabled
    4. Select the usda file and press import
      The produced scene is included as example.import_usda.ma
    5. note: If the Shape Editor window was open, it does not update upon importing, or selecting a mesh afterwards. It has to be re-opened in order to display the newly imported blendshapes. Not sure if that's related.
      image
  • Re-exporting the asset
    1. Select the WiggleCube transform (which now has a prefix depending on the import settings).
    2. Export selection to usda with the same settings as previously. The produced file is included as example_export.from_usda_import.usda
    3. Note the inconsistencies in the usda file.

Expected behavior
When I import an asset with blendshapes and re-export it, the blendshapes should be exported correctly without issue.

Attachments

  • blendshape-issue.zip
    • Initial scene: example.ma
    • Initial usda export: example_export.from_maya_scene.usda
    • Re-imported scene: example.import_usda.ma
    • Incorrect export from re-imported scene: example_export.from_usda_import.usda

Specs (if applicable):

  • OS & version Windows 11
  • Maya version Maya 2023
  • Maya USD 0.29 release version

Additional context

Just putting out here, but thanks again for the work you guys are putting into maya-usd!

@BeardedPlatypus BeardedPlatypus added the bug Something isn't working label Sep 18, 2024
@wallworm
Copy link

Thank you for sharing this. We will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants