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

Fix display color not matching the source Lambert materials #2049

Merged
merged 2 commits into from
Feb 1, 2022

Conversation

JGamache-autodesk
Copy link
Collaborator

No description provided.

We previously only color corrected when the displayColor was single
valued. The color correction was moved upstream to also cover CPV
scenarios.
This means lambert setups exported as displayColors will match perfectly
when loaded as stages.
@JGamache-autodesk
Copy link
Collaborator Author

To see where we come from, here is the added unit test without the fix:
image
Row1: 1 plane, 12 separate faces, one lambert per face.
Row2: The plane exported as displayColors, loaded as USD stage using CPV shader.
Row3: 12 planes, one lambert per plane.
Row4: 12 planes exported as displayColors, loaded as USD stage using solid color shader.
Here is the result after the fix:
image
This impacts all scenes that use display colors, which comprises a large number of unit tests, as can be seen in the diff.
Here is the kitchen set scene with a band of updated shading in the middle to give an idea on a known scene:
KitchenSet

@@ -1933,9 +1937,12 @@ void HdVP2Mesh::_UpdateDrawItem(
if ((colorInterp == HdInterpolationConstant || colorInterp == HdInterpolationInstance)
&& (alphaInterp == HdInterpolationConstant
|| alphaInterp == HdInterpolationInstance)) {
const GfVec3f& clr3f = MayaUsd::utils::ConvertLinearToMaya(colorArray[0]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved upstream. See line 376.

const MColor color(clr3f[0], clr3f[1], clr3f[2], alphaArray[0]);
shader = _delegate->GetFallbackShader(color);
if (shader) {
shader->setParameter("diffuse", 1.0f);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We already multiply the exported display color by the diffuse coefficient of 0.8. We need not apply it a second time.

@kxl-adsk kxl-adsk added the vp2renderdelegate Related to VP2RenderDelegate label Feb 1, 2022
@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Feb 1, 2022
@kxl-adsk kxl-adsk merged commit 0dc8929 into dev Feb 1, 2022
@kxl-adsk kxl-adsk deleted the t_gamaj/fix_display_color_too_dark branch February 1, 2022 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge vp2renderdelegate Related to VP2RenderDelegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants