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-102319 - Material import options rework #822

Merged
merged 5 commits into from
Oct 14, 2020

Conversation

JGamache-autodesk
Copy link
Collaborator

The major item of this work is to remove the material import dropdown in favor of a single checkbox for importing materials or not. The strategy is to provide a list of shadingModes to try in the import options and let the code execute each one in sequence until a material is found.

Major work:
The shadingMode import option is now a list of shading modes to try.

  • Added code to extract array of tokens from options string.
  • Added code to generate options string containing arrays
  • The mayaUSDListShadingModes command will list the modes in a predefined order that tries more complex shading modes first.
  • The pxrRis shadingMode import has been made more strict to let other shading modes succeed.
  • Shading modes that declare a renderContext will no longer explore the universal context. This allow universal context shading modes importers to successfully run.

Added materialConversion support for import modes. This mirrors the export mode exactly.

  • Added registry functions to register an importer with materialConversion.
  • Shares and uses the renderContext concept used for export.
  • Renamed shadingConversion to preferredMaterial to prevent confusion. This represents an optional "convertTo" that can be added on top of the "convertFrom" that materialConversion represents.

Other work:
The displayColor shading mode is removed in favor of a better handling of the exportDisplayColor geometry option. This fixes #520.

  • The exportDisplayColor now default to false
  • The exportOptions MEL script has been reworked to still present a Display Color material export that toggles the exportDisplayColor import option.

Minor work:

  • SetPlugValue can now handle 4x4 matrices
  • UsdPreviewSurface added to the list of preferred materials on import. Support for displayColor import/export added.
  • PhongE removed from list of preferred materials on import.
  • Symmetric shader writer now skips hidden attributes.
  • vp2RenderDelegate will convert linear displayColor to Maya to provide better color match between the original lambert and the displayColor.

The major item of this work is to remove the material import dropdown in favor of a single checkbox for importing materials or not. The strategy is to provide a list of shadingModes to try in the import options and let the code execute each one in sequence until a material is found.

Major work:
The shadingMode import option is now a list of shading modes to try.
  - Added code to extract array of tokens from options string.
  - Added code to generate options string containing arrays
  - The mayaUSDListShadingModes command will list the modes in a predefined order that tries more complex shading modes first.
  - The pxrRis shadingMode import has been made more strict to let other shading modes succeed.
  - Shading modes that declare a renderContext will no longer explore the universal context. This allow universal context shading modes importers to successfully run.

Added materialConversion support for import modes. This mirrors the export mode exactly.
  - Added registry functions to register an importer with materialConversion.
  - Shares and uses the renderContext concept used for export.
  - Renamed shadingConversion to preferredMaterial to prevent confusion. This represents an optional "convertTo" that can be added on top of the "convertFrom" that materialConversion represents.

Other work:
The displayColor shading mode is removed in favor of a better handling of the exportDisplayColor geometry option. This fixes #520.
  - The exportDisplayColor now default to false
  - The exportOptions MEL script has been reworked to still present a Display Color material export that toggles the exportDisplayColor import option.

Minor work:
- SetPlugValue can now handle 4x4 matrices
- UsdPreviewSurface added to the list of preferred materials on import. Support for displayColor import/export added.
- PhongE removed from list of preferred materials on import.
- Symmetric shader writer now skips hidden attributes.
- vp2RenderDelegate will convert linear displayColor to Maya to provide better color match between the original lambert and the displayColor.
lib/mayaUsd/commands/baseImportCommand.cpp Show resolved Hide resolved
lib/mayaUsd/fileio/jobs/jobArgs.cpp Show resolved Hide resolved
lib/mayaUsd/fileio/shading/symmetricShaderReader.cpp Outdated Show resolved Hide resolved
lib/mayaUsd/utils/util.cpp Show resolved Hide resolved
lib/mayaUsd/utils/util.cpp Show resolved Hide resolved
lib/mayaUsd/utils/util.cpp Show resolved Hide resolved
lib/mayaUsd/utils/util.cpp Show resolved Hide resolved
Copy link
Contributor

@mattyjams mattyjams left a comment

Choose a reason for hiding this comment

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

Looks good to me! I had a few minor notes, but nothing too critical.

I have to admit that just reading through the code, it's a little confusing to understand how the conversion aspect of it works, but I'm hoping that becomes clearer once we start playing with it.

lib/mayaUsd/commands/baseListShadingModesCommand.cpp Outdated Show resolved Hide resolved
lib/mayaUsd/fileio/jobs/jobArgs.cpp Outdated Show resolved Hide resolved
lib/mayaUsd/fileio/shading/shadingModeRegistry.h Outdated Show resolved Hide resolved
lib/mayaUsd/fileio/shading/shadingModeRegistry.h Outdated Show resolved Hide resolved
lib/mayaUsd/fileio/shading/shadingModeUseRegistry.cpp Outdated Show resolved Hide resolved
test/lib/usd/translators/testUsdImportCustomConverter.py Outdated Show resolved Hide resolved
test/lib/usd/translators/testUsdImportCustomConverter.py Outdated Show resolved Hide resolved
@kxl-adsk kxl-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Oct 14, 2020
@kxl-adsk kxl-adsk merged commit 96d40b7 into dev Oct 14, 2020
@kxl-adsk kxl-adsk deleted the t_gamaj/MAYA-102319/multi_material_import branch October 14, 2020 15:57
mattyjams added a commit to mattyjams/maya-usd that referenced this pull request Oct 14, 2020
…odesk#822

Internally, we have a post-process to the testUsdExportSkeleton test that diffs
the generated USD against this baseline. Following the merge of PR Autodesk#822, the
test began to fail since displayColor was no longer being exported with
shadingMode=none.
mattyjams added a commit to mattyjams/maya-usd that referenced this pull request Oct 14, 2020
…ing Autodesk#822

Internally, we still run the testUsdExportRenderLayerMode test with
MAYA_ENABLE_LEGACY_RENDER_LAYERS turned on. The test began failing following
the merge of PR Autodesk#822 since displayColor was no longer being exported. This
change gets the test passing again by turning on the exportDisplayColor when
calling cmds.usdExport().
mattyjams added a commit to mattyjams/maya-usd that referenced this pull request Oct 14, 2020
…utodesk#822

Internally, we have a post-process to the testProxyShapeDrawColors test that
diffs a render generated from the viewport against a baseline. Following the
merge of PR Autodesk#822, the test began to fail since displayColor was no longer being
exported with shadingMode=none, so the color represented in the image was
different. This change turns on the exportDisplayColor option to
cmds.usdExport() so that displayColor is present in the exported USD, and the
rendered image matches the baseline again.
mattyjams added a commit to mattyjams/maya-usd that referenced this pull request Oct 14, 2020
…utodesk#822

Internally, we have a post-process to the testProxyShapeDrawColors test that
diffs a render generated from the viewport against a baseline. Following the
merge of PR Autodesk#822, the test began to fail since displayColor was no longer being
exported, so the color represented in the image was different. This change
turns on the exportDisplayColor option to cmds.usdExport() so that displayColor
is present in the exported USD, and the rendered image matches the baseline
again.
kxl-adsk pushed a commit that referenced this pull request Oct 15, 2020
…aseline

update baseline USD file for testUsdExportSkeleton test following #822
kxl-adsk pushed a commit that referenced this pull request Oct 15, 2020
…rMode_displayColor_export

enable exportDisplayColor in testUsdExportRenderLayerMode test following #822
kxl-adsk pushed a commit that referenced this pull request Oct 15, 2020
…s_displayColor_export

enable exportDisplayColor in testProxyShapeDrawColors test following #822
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.

primvars:displayColor always included in export regardless of shadingMode
4 participants