Clamping UVs in order to mitigate wraparound effect - #40
Closed
snajder-r wants to merge 3 commits into
Closed
Conversation
…t the top of the screen also show up at the bottom and vice versa as well as for left and right.
Sorry - this wasn't meant to be part of the PR This reverts commit 347fba0.
Author
|
Closing it, as I found a better solution. PR #41 replaces this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Clamping UVs in order to mitigate wraparound effect, where Outlines at the top of the screen also show up at the bottom and vice versa as well as for left and right.
Tested in
Before this PR:
The outline (white in my example) around the cube touches the screen on the right and left side. Because the UVs have the outline width added and subtracted, some UVs will have negative values in the bottom and left, and some will have values above 1 at the top and right. This results in a wraparound when sampling the Normal Texture, and in the end results in Outlines showing up at the opposing screen border:
Before this commit, the Normal sampled for +1/+1 UVs looked like this. Note the blue line at the top right.

And the Outline like this:
Changes in this PR:
The following nodes have been added to the Outlines Shadergraph:
After this PR:
After clamping the UVs to [OutlineScale, 1-OutlineScale] this wraparound is fixed. Normals:
And the Outline after the patch:
Unintentional side-effect:
The Outline is no longer drawn along the screen border. Note the bottom-right corner on the before and after images. But I personally think that's better anyways.