Autodesk / maya-usd

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

[vp2] preview shader textures do not show up properly in viewport 2.0 #1959

Closed nxkb closed 2 years ago

nxkb commented 2 years ago

Describe the bug Assets with preview shaders that have textures do not display properly in viewport 2.0.

Steps to reproduce Steps to reproduce the behavior:

  1. Make a USD proxy shape (I'm using AL) that loads attached asset-prpNikeShoes.usd file
  2. View asset in vp2
  3. See that the proxy shape displays all one color

Expected behavior I want the preview shader's textures to display as they do in usdview.

Attachments prpNikeShoes.zip

Specs (if applicable):

JGamache-autodesk commented 2 years ago

Usually good to compare with a working version from ArKit.

The problem is a typo in the material definition of your asset. The output name of UsdPrimvarReader_float2 is result, not results. You might as well replace token outputs:glslfx:surface.connect with token outputs:surface.connect while you are editing the file so it is closer to standards.

Yes, I noticed the file displays correctly in usdview, but it is because hdStorm discards the invalid UV reader and replaces it with a default one that happens to read the default UV name, which is "st". Changing "st" to "st0" in the mesh definition of your asset will cause usdview to fail in a manner identical to MayaUSD.

nxkb commented 2 years ago

Awesome, thanks for catching that @JGamache-autodesk. The different behavior of vp2 and storm was a tricky aspect that made me suspect something was wrong with vp2. I've updated and it works well now.

You might as well replace token outputs:glslfx:surface.connect with token outputs:surface.connect while you are editing the file so it is closer to standards.

We added that glslfx specifier to our assets for specificity and future proofing because it seems to be what is recommended here: "Typically [UsdMaterial] consists of one or more UsdRelationship properties that target other prims of type Shader - though a target/client is free to add any data that is suitable. We strongly advise that all targets adopt the convention that all properties be prefixed with a namespace that identifies the target, e.g. "rel ri:surface = </Shaders/mySurf>"."

We connect both an arnold shader and a preview shader to the same UsdMaterial. Although those use different connection styles anyway (rel/output), the advice seems applicable there too.

Yes, I noticed the file displays correctly in usdview, but it is because hdStorm discards the invalid UV reader and replaces it with a default one that happens to read the default UV name, which is "st". Changing "st" to "st0" in the mesh definition of your asset will cause usdview to fail in a manner identical to MayaUSD.

Got it. Do you think it would be good to match usdview behavior here or keep it erroring to show an issue?

santosg87 commented 2 years ago

@nxkb based on the conversation above, can we close this issue?

santosg87 commented 2 years ago

closing this one for now. if this is still an issue, please feel free to re-open

nxkb commented 2 years ago

@santosg87 yep, ok to close. I just wanted to make sure you thought about this question internally:

Do you think it would be good to match usdview behavior here or keep it erroring to show an issue?