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

[Maya] usdExport cannot export shading with instances #332

Closed
stolyaroleh opened this issue Nov 22, 2017 · 4 comments
Closed

[Maya] usdExport cannot export shading with instances #332

stolyaroleh opened this issue Nov 22, 2017 · 4 comments

Comments

@stolyaroleh
Copy link

stolyaroleh commented Nov 22, 2017

Description of Issue

There seems to be a fundamental difference between how Maya and USD handle instancing and material assignment.

In Maya, it's possible to override material assignment for instances: an instanced shape has an array attribute instObjGroups, the elements of which can be connected to multiple shading nodes. In this way, instances share geometry, but can have different materials.

As far as I understand, in USD, a reference to material lives on a Gprim. Since usdExport translates Maya instances into USD instances, authoring edits on instanced Gprims is forbidden, which is exactly what PxrUsdMayaShadingModeExporter tries to do.

Additionally, it is possible to crash usdExport and Maya if there is a name conflict between instanced shapes, coming from a referenced scene. I think this happens because PxrUsdMayaUtil::MDagPathToUsdPath, used by PxrUsdMayaShadingModeExporterContext::GetAssignments is not injective: it maps distinct MDagPaths foo|bar|baz and foo:bar|baz to the same SdfPath. This confuses usdExport: it attempts to write to a null prim, which raises a SIGABRT.

Steps to Reproduce

  1. Open attached scene usdexport_shading_instances.ma
  2. Run the following:
from maya import cmds
cmds.usdExport(
    file='~/test.usda',
    exportInstances=True,
    shadingMode='displayColor'
)
  1. Observe errors in console:
Coding Error: in _ValidateEditPrimAtPath at line 1183 of /home/oleh.stolyar/src/wwfx-bin/thirdparty/USD/pxr/usd/lib/usd/stage.cpp -- Cannot create prim at path </Cube_1/Looks>; authoring to an instance proxy is not allowed.
  1. Create a new scene, and add a cube to it.
  2. Add a reference to usdexport_shading_instances.ma (File -> Create Reference...).
  3. Rename cube transform node to usdexport_shading_instances_Cube_1 and shape node to usdexport_shading_instances_Shape.
  4. Repeat step 2.
  5. Observe a crash:
------------------------ 'maya.bin' is dying ------------------------
maya.bin crashed. FATAL ERROR: Used null prim
in Usd_IssueFatalPrimAccessError at line 224 of /home/oleh.stolyar/src/wwfx-bin/thirdparty/USD/pxr/usd/lib/usd/primData.cpp

System Information (OS, Hardware)

CentOS 7

Package Versions

v0.8.1

Build Flags

Mostly default.

@stolyaroleh
Copy link
Author

What would be a good way to handle shading and instances?
I was wondering if it's possible to isolate shading in a separate, stronger layer, which would override instanceability and provide opinions about material references at locations of instance proxies. If yes, would geometry still be shared between prims?

@spiffmon
Copy link
Member

spiffmon commented Nov 22, 2017 via email

@jtran56
Copy link

jtran56 commented Nov 22, 2017

Filed as internal issue #154222.

@sunyab
Copy link
Contributor

sunyab commented Nov 4, 2022

Maya plugin development has migrated to Autodesk's maya-usd project, so this is no longer relevant. Closing this out.

@sunyab sunyab closed this as completed Nov 4, 2022
AdamFelt pushed a commit to autodesk-forks/USD that referenced this issue Apr 16, 2024
…lve/adsk/feature/LineStyle

Merge latest adsk/feature/linestyle branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants