Moving WS view direction from vertex to fragment to lower varying size by skerys · Pull Request #5509 · Unity-Technologies/Graphics · GitHub
Skip to content

Moving WS view direction from vertex to fragment to lower varying size#5509

Merged
phi-lira merged 7 commits into
universal/stagingfrom
shadergraph/urp-world-space-view-dir-to-frag
Nov 10, 2021
Merged

Moving WS view direction from vertex to fragment to lower varying size#5509
phi-lira merged 7 commits into
universal/stagingfrom
shadergraph/urp-world-space-view-dir-to-frag

Conversation

@skerys

@skerys skerys commented Sep 2, 2021

Copy link
Copy Markdown
Contributor

Purpose of this PR

These optimizations were discussed with Apple.

mobile optimizations to lower bandwidth:
completely removed viewDirectionWS variable declaration from StructField.Varyings struct and also the usage of the variable from the shader template as well.

For WorldSpaceViewDirection that is used in the ShaderGraph node, replaced the calculation from:

normalize(input.viewDirectionWS)

to:

normalize(GetWorldSpaceViewDir(input.positionWS)

Also changed the field dependency of the WorldSpaceViewDirection node to now requiring StructFields.Varyings.positionWS variable.


Testing status

local comparison test for the View Direction Node in editor and on an iOS device
all URP/all Shadergraph on Yamato


Comments to reviewers

@github-actions

github-actions Bot commented Sep 2, 2021

Copy link
Copy Markdown

@skerys skerys requested a review from phi-lira September 8, 2021 12:00
@skerys

skerys commented Sep 20, 2021

Copy link
Copy Markdown
Contributor Author

@skerys skerys marked this pull request as ready for review September 20, 2021 13:20
@skerys skerys requested review from a team as code owners September 20, 2021 13:20

@cdxntchou cdxntchou left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good!
HDRP seems to already use this approach, so only URP has the changes...

@phi-lira phi-lira left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Did a comparison test and it seems to work. 👍

@marctem marctem removed their request for review October 28, 2021 16:07
@GrantLamb-Unity GrantLamb-Unity removed the request for review from a team October 29, 2021 19:44

@GrantLamb-Unity GrantLamb-Unity left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@simon-engelbrecht-soerensen 's comparison tests should be enough for this change 👍

@phi-lira phi-lira changed the base branch from master to universal/staging November 10, 2021 08:23
@phi-lira phi-lira requested a review from a team November 10, 2021 08:23
@phi-lira phi-lira merged commit 7398235 into universal/staging Nov 10, 2021
@phi-lira phi-lira deleted the shadergraph/urp-world-space-view-dir-to-frag branch November 10, 2021 08:24
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.

6 participants