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-112227 - UV set renamed to st, st1, st2 #1528

Merged
merged 2 commits into from
Jul 6, 2021

Conversation

JGamache-autodesk
Copy link
Collaborator

Implements automatic UV set renaming.

  • The sets will be renamed st, st1, st2, st3,... in the order they are found in the mesh.
  • The original name will be stored in custom data for roundtripping
  • On import, the names will always be restored if the roundtripping information is found
  • On import, the UV sets are restored in the same order as found in the USD primitive
  • The environment variables MAYAUSD_IMPORT_PRIMARY_UV_SET_AS_MAP1 and MAYAUSD_EXPORT_MAP1_AS_PRIMARY_UV_SET were removed as their functionnality is subsumed in the global renaming.

Caveat:
If you have a mesh with multiple UV sets, and a UV set named "map1" is not the first UV set, then it will not automatically be renamed "st" as was previously the case using MAYAUSD_EXPORT_MAP1_AS_PRIMARY_UV_SET. We expect these cases to be quite rare, but if you have post-processing scripts that are expecting "st" and scenes where "map1" is not the first UV sets; then the results at the other end of the post-processing pipeline will be different.

Implements automatic UV set renaming.
- The sets will be renamed st, st1, st2, st3,... in the order they are found in the mesh.
- The original name will be stored in custom data for roundtripping
- On import, the names will always be restored if the roundtripping information is found
- On import, the UV sets are restored in the same order as found in the USD primitive
- The environment variables MAYAUSD_IMPORT_PRIMARY_UV_SET_AS_MAP1 and  MAYAUSD_EXPORT_MAP1_AS_PRIMARY_UV_SET were removed as their functionnality is subsumed in the global renaming.

Caveat:
If you have a mesh with multiple UV sets, and a UV set named "map1" is not the first UV set, then it will not automatically be renamed "st" as was previously the case using MAYAUSD_EXPORT_MAP1_AS_PRIMARY_UV_SET. We expect these cases to be quite rare, but if you have post-processing scripts that are expecting "st" and scenes where "map1" is not the first UV sets; then the results at the other end of the post-processing pipeline will be different.
@@ -148,7 +173,7 @@ createNode transform -n "pPlane3";
rename -uid "A9516DAE-46FB-C555-7036-F5BFA863699B";
setAttr ".t" -type "double3" 2.4 0 0 ;
setAttr ".r" -type "double3" 89.999999999999986 0 0 ;
createNode mesh -n "pPlaneShape3" -p "pPlane3";
createNode mesh -n "pPlane3" -p "|pPlane3";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dgovil , @ysiewappl This makes the shape name identical to the transform name and makes sure the code in _UVMappingManager is still correctly handling that situation.

("/pPlane5", "/blinn1SG_p5a_p5b_p5c", "p5a", "p5b", "p5c"),
("/pPlane6", "/blinn1SG_p62_p63_p61", "p62", "p63", "p61"),
("/pPlane7", "/blinn1SG_p7r_p7p_p7q", "p7r", "p7p", "p7q"),
("/pPlane1", "/blinn1SG", "st", "st", "st"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The automatic renaming does reduce the number of specializations created.

JGamache-autodesk added a commit that referenced this pull request Jun 30, 2021
MaterialX has a lot of node definitions that use a UV0 defaultgeomprop to automatically connect to UV stream at index zero. Since USD is name based, and we specified a canonical naming scheme for UV sets in PR #1528, we can insert a geompropvalue primvar reader that will allow that shader to work.
MaterialX can also specify a UV stream by index using a "texcoord" geometry node. For these, we substitute a geompropvalue primvar reader that refers to the primvar name we assigned for that index: UV2 -> st2
@kxl-adsk kxl-adsk requested a review from dj-mcg July 5, 2021 17:38
@kxl-adsk
Copy link

kxl-adsk commented Jul 5, 2021

@dj-mcg Can you help review this change and confirm that it works for Pixar as well?

Copy link

@kxl-adsk kxl-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dj-mcg
Copy link
Collaborator

dj-mcg commented Jul 6, 2021

This looks good to me, and I believe it allows me to delete one of our internal patches. I'll fix up whatever internal tests are affected, so lgtm!

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Jul 6, 2021
@kxl-adsk kxl-adsk merged commit 4fdbb37 into dev Jul 6, 2021
@kxl-adsk kxl-adsk deleted the t_gamaj/MAYA-112227/ordered_uv_export branch July 6, 2021 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
import-export Related to Import and/or Export ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants