GSOC 26: keep bump map slopes correct at image edges - #9095
Open
Nixxx19 wants to merge 3 commits into
Open
Conversation
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.
closes #9091.
two parts, both from the seam discussion on #9068.
bump map slopes at the edge of an image
bumpTexture()works out the surface slope by comparing neighbouring pixels. it only looked one way, so at the far edge of the image that lookup ran past the end and read back the same pixel, which made the slope read as flat exactly there. it now compares both sides, so an edge still gets a real slope.on a sphere this shows up as a line down the seam. comparing the same sketch before and after, the line goes from obvious to faint. it doesn't disappear entirely without
textureWrap(REPEAT), since at the very edge one of the two lookups still stops at the end of the image, but the shader no longer flattens the slope on its own. the same fix is in the webgpu shader.docs
added a note to
normalTexture()andbumpTexture()explaining that a shape likesphere()wraps its texture coordinates all the way around, so the two edges of the image meet and the image has to tile for them to line up. thebumpTexture()note also mentionstextureWrap(REPEAT), since the slope comparison needs to carry across the join.as discussed, this stays a property of the texture rather than something forced on all maps, since on a plane u=0 and u=1 shouldn't be the same.
full webgl and webgpu suites pass, including the existing normal and bump map visual tests.
note: stacked on #9089, so that one goes in first.