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

usdValidation: usdShade: NormalMapTextureValidator #3443

Conversation

beersandrew
Copy link
Contributor

Description of Change(s)

Added an implementation of NormalMapTexture validation rules

Link to proposal (if applicable)

Fixes Issue(s)

Note: this PR is a replacement for #3359

Checklist

[X] I have created this PR based on the dev branch

[X] I have followed the coding conventions

[X] I have added unit tests that exercise this functionality (Reference:
testing guidelines)

[X] I have verified that all unit tests pass with the proposed changes

[X] I have submitted a signed Contributor License Agreement (Reference:
Contributor License Agreement instructions)

@beersandrew beersandrew changed the title usdValidation: usdShade: Validation usd shade normal map texture usdValidation: usdShade: NormalMapTextureValidator Dec 2, 2024
@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-10485

@jesschimein
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@tallytalwar tallytalwar left a comment

Choose a reason for hiding this comment

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

Looks great, @beersandrew and very thorough test.

Just a few adjustments required for coding conventions, code cleanup etc.

Copy link
Contributor Author

@beersandrew beersandrew left a comment

Choose a reason for hiding this comment

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

@tallytalwar I believe all notes have been addressed

@@ -8,7 +8,7 @@ if (EXISTS "${PROJECT_SOURCE_DIR}/pxr/exec")
add_subdirectory(exec)
endif()

if ($(PXR_BUILD_USD_VALIDATION))
if (${PXR_BUILD_USD_VALIDATION})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tallytalwar I believe this is a typo in dev

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup @beersandrew , it was fixed with last dev push: 1f0b71a

Can you update your dev branch?

- added all necessary files to move  the NormalMapTexture validator from complianceChecker.py to the new Validation Framework
- fixed many code styling bugs, including missing const's
- applied calls to ValidateError in all usdShade tests
- adding usdShadeShader schema to NormalMapTextureValidator
- fixing a CMake typo to include usdValidation
- address tabs in error messages
- address long lines
@beersandrew beersandrew force-pushed the validation-usdShade-NormalMapTexture branch from 06f80fd to 0a27df9 Compare December 10, 2024 22:03
Copy link
Contributor

@tallytalwar tallytalwar left a comment

Choose a reason for hiding this comment

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

Thanks all looks, good will sync this one in now.

Comment on lines +589 to +603
const TfToken expectedErrorIdentifier(
"usdShadeValidators:NormalMapTextureValidator.NonCompliantBiasAndScale");
const std::string expectedErrorMsg =
TfStringPrintf("UsdUVTexture prim <%s> reads 8 bit Normal Map "
"@./normalMap.jpg@, which requires that "
"inputs:scale be set to (2, 2, 2, 1) and "
"inputs:bias be set to (-1, -1, -1, 0) for proper "
"interpretation as per the UsdPreviewSurface and "
"UsdUVTexture docs.",
usdUvTextureShader.GetPath().GetText());
ValidatePrimError(errors[0],
expectedErrorIdentifier,
usdUvTextureShader.GetPath(),
expectedErrorMsg);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this one is failing:

Output from the ValidatePrimError seems to say that error identifier is file error and not NonCompliantBiasAndScale:

Error: usdShadeValidators:NormalMapTextureValidator.InvalidFile
Expected Error: usdShadeValidators:NormalMapTextureValidator.NonCompliantBiasAndScale

Can you make sure the test is passing on your end?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is passing for me locally, unfortunately unable to reproduce what you're seeing.

The check for InvalidFile does happen before the NonCompliantBiasAndScale check so the if check here must be true for that test but I'm not sure why I'm not seeing the same

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh I see, weirdly the normalMap.jpg didn't get synced for me.

@jessey-git
Copy link

This validator will end up flagging errors in https://github.com/usd-wg/assets/tree/main/test_assets/NormalsTextureBiasAndScale

That example uses scale-bias to adjust from DirectX to OpenGL normal map conventions for example. The validation error is noted there though, in the section for "r_normal_map_reversed_y.png". Would it be worthwhile to also allow the DirectX convention scale-bias to pass validation?

@jesschimein
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tallytalwar
Copy link
Contributor

Thanks @jessey-git for bringing this up. To begin with we can do the same treatment for directx related scale/bias values for normal maps as is being done for some scenarios here: b718721

So instead of erroring, usdchecker will report these as warnings. Feel free to file a PR for this. Thanks

@pixar-oss pixar-oss merged commit b9eece2 into PixarAnimationStudios:dev Dec 13, 2024
3 of 5 checks passed
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

Successfully merging this pull request may close these issues.

5 participants