Autodesk / maya-usd

A common USD (Universal Scene Description) plugin for Autodesk Maya
760 stars 202 forks source link

[EMSUSD-9] Respect upAxis metadata #227

Open pmolodo opened 4 years ago

pmolodo commented 4 years ago

The upAxis setting in the metadata (https://graphics.pixar.com/usd/docs/api/group___usd_geom_up_axis__group.html) is currently ignored, meaning that any scene which has it's upAxis set as Z will be rotated.

Usdview respects this, and rotates the geometry accordingly, to always show the upAxis as "up".

The KitchenSet is a good example of an asset with upAxis=Z

kxl-adsk commented 4 years ago

@elrond79 How should this axis be respected? (FYI. @wtelford)

pmolodo commented 4 years ago

Basically, by just applying a top-level rotation; so that if opening a scene with "upAxis = Z", the z-axis (as defined in the USD) is rotated so that it displays as aligned with maya's up-Axis. This will make it appear "right side up" in maya's viewport. You can look at how usdview handles it for an example.

Of course, this is a potentially "dangerous" operation, as a point defined as being at (1,2,3) will no longer be displayed at those coordinates in maya... and it could potentially mess up alignment of various assets, if they're all brought with separate proxy shapes, and with offsets in the "original" z-up space. So it would definitely need to be controlled by an option of some sort.

But it would be a big convenience for some common test cases (ie, all the Pixar supplied ones, like KitchenSet).

wtelford commented 3 years ago

Hey @santosg87 , Can you link this to a Jira task if it exists?

colaub commented 3 years ago

Hi, any news about this issue?

nicoluce commented 2 years ago

Hi, we're in current need of this feature, as well as to properly handle the metersPerUnit metadata (#906). After some investigation on our end we concluded that although ideally we'd want to apply transformations to vertices, normals, etc. separately, a potential first iteration for Hydra mode could be:

The reason for applying this under a layer is to have them bundled together in one place. Code-wise I believe (some) necessary steps for this would be:

  1. Add "AP_upAxis" and "AP_metersPerUnit" attributes to MayaUsdProxyShapeBase
  2. Modify ProxyAccessor::collectAccessorItems() to handle stage level metadata items
  3. Add getUpAxis() and getMetersPerUnit() to MayaUsdProxyShapeBase

As to the actual layer and transformation code, I'm unsure about the specific place to place that logic.

Does this sound ok to you? Should the export operation handle these properties properly as well to consider this complete? If you already have plans for this feature internally, any estimate on it?

[1] Applying a scale and rotation at Prim is not ideal given that child nodes coordinate space isn't at scale but that is not a problem if you only care about rendering, which for 1st iteration should be fine from our point of view.

sshklifov commented 1 year ago

Hello, I see that this issue has been references multiple times. It will be useful for V-Ray for Maya as well. I can prepare a branch with a solution similar to the one suggested by @pmolodo . In addition to it, older scenes will have to use the old behavior. This can be achieved with the checkbox that @nicoluce mentioned.

Will you be willing to merge this change if I prepare a branch for it? Or is there a problem with this solution?