Improve UsdPreviewSurface shading logic #1082
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've compared parts of MaterialX's UsdPreviewSurface BSDF implementation against Pixar's current shading logic and believe to have found some discrepancies:
Commit be438a4 addresses the calculation of F0 and F90 values for the specular BSDF when the metallic workflow is selected. It now implements the reference logic:
https://github.com/PixarAnimationStudios/USD/blob/3abc46452b1271df7650e9948fef9f0ce602e3b2/pxr/usdImaging/plugin/usdShaders/shaders/previewSurface.glslfx#L219-L227
Commit 25fb016 properly attenuates the weight of the diffuse BSDF when the metallic workflow is selected: https://github.com/PixarAnimationStudios/USD/blob/3abc46452b1271df7650e9948fef9f0ce602e3b2/pxr/usdImaging/plugin/usdShaders/shaders/previewSurface.glslfx#L229-L230
Commit dd4eba2 changes the clearcoat layer implementation to Pixar's reference logic:
https://github.com/PixarAnimationStudios/USD/blob/3abc46452b1271df7650e9948fef9f0ce602e3b2/pxr/usdImaging/plugin/usdShaders/shaders/previewSurface.glslfx#L247-L252