Skip to content

Conversation

@joshua-davis
Copy link
Contributor

@joshua-davis joshua-davis commented Jan 20, 2021

Backport fix for #3044

Please read the Contributing guide before making a PR.

Checklist for PR maker

  • Have you added a backport label (if needed)? For example, the need-backport-* label. After you backport the PR, the label changes to backported-*.
  • Have you updated the changelog? Each package has a CHANGELOG.md file.
  • Have you updated or added the documentation for your PR? When you add a new feature, change a property name, or change the behavior of a feature, it's best practice to include related documentation changes in the same PR. If you do add documentation, make sure to add the relevant Graphics Docs team member as a reviewer of the PR. If you are not sure which person to add, see the Docs team contacts sheet.
  • Have you added a graphic test for your PR (if needed)? When you add a new feature, or discover a bug that tests don't cover, please add a graphic test.

Purpose of this PR

The calculation for the ViewNode in Tangent space used an old method that assumed the tangent space basis was orthonormal. The Transform node was updated but the view node wasn't. For this backport, the length of the original view direction is preserved in case anyone was relying on that.


Testing status

Tested the attached shader graph in the bug: https://fogbugz.unity3d.com/f/cases/1296788/


Comments to reviewers

There looks to be a unrelated failed test with Android Vulkan due to an incorrect image in this branch (on a nan node).

@joshua-davis joshua-davis changed the title [ShaderGraph] [master] [bugfix 1296788] Bugfix for view direction node in tangent space being not using the calculation [ShaderGraph] [2021.1/staging] [bugfix 1296788] Bugfix for view direction node in tangent space being not using the calculation Jan 20, 2021
@joshua-davis joshua-davis changed the title [ShaderGraph] [2021.1/staging] [bugfix 1296788] Bugfix for view direction node in tangent space being not using the calculation [ShaderGraph] [2021.1/staging] [bugfix 1296788] Backport bugfix for view direction node in tangent space being not using the calculation Jan 20, 2021
@joshua-davis joshua-davis changed the title [ShaderGraph] [2021.1/staging] [bugfix 1296788] Backport bugfix for view direction node in tangent space being not using the calculation [ShaderGraph] [2021.1/staging] [bugfix 1308156] Backport bugfix for view direction node in tangent space being not using the calculation Jan 21, 2021
@joshua-davis joshua-davis requested a review from a team January 21, 2021 18:44
@joshua-davis joshua-davis marked this pull request as ready for review January 21, 2021 18:45
@joshua-davis joshua-davis requested a review from a team January 22, 2021 17:25
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Tested everything I tested in the original PR (except with normalization steps added). Tested that the length of the tangent space view dir node matched the world space length.
Results of additional test to validate that the length matches the original length "close enough":
image
After on the left, before on the right, with the length of the vector mapped the hue in an HSV to RGB colorspace conversion. Users can expect extremely similar results, but with less artifacts caused by the previously incorrect calculation.

Copy link
Contributor

@jessebarker jessebarker left a comment

Choose a reason for hiding this comment

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

LGTM

@joshua-davis joshua-davis force-pushed the 2021.1/sg/bufix-1296788-transform-tangent-to-world branch from e771cbb to 71b6903 Compare February 3, 2021 17:03
@joshua-davis
Copy link
Contributor Author

Failures seem to match the current state of upstream (2021.1/staging)

@joshua-davis joshua-davis merged commit 4b08634 into 2021.1/staging Feb 4, 2021
@joshua-davis joshua-davis deleted the 2021.1/sg/bufix-1296788-transform-tangent-to-world branch February 4, 2021 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants