Fix stray pixel artifacts when BaseMaterial3D Deep Parallax is enabled#101551
Open
Calinou wants to merge 1 commit into
Open
Fix stray pixel artifacts when BaseMaterial3D Deep Parallax is enabled#101551Calinou wants to merge 1 commit into
Calinou wants to merge 1 commit into
Conversation
Mipmaps for the heightmap seem to cause issues with the parallax occlusion mapping algorithm used.
e9fe197 to
1702a12
Compare
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.
Mipmaps for the heightmap seem to cause issues with the parallax occlusion mapping algorithm used. This is most noticeable with steep height changes where surrounding pixels will occasionally appear depending on the view angle. This occurs regardless of the Min Layers and Max Layers values.
Note that there may be a better solution to this, such as sampling the heightmap texture differently (e.g.
textureGrad()). This could result in better performance as mipmaps allow the GPU to sample a lower-resolution texture in the distance – however, for this to be beneficial, the different texture sampling method must not be more expensive than disabling mipmaps.I found this issue (and the way to fix it) using https://github.com/Calinou/godot-rendering-tests' texture sampling test.
Edit: Xtarsia mentioned on the Godot VFX Discord that this could resolved in a more optimized way in Forward+/Mobile:
Testing project: https://github.com/Calinou/godot-parallax-test-4.0
Preview
Before
parallax_before.mp4
After
parallax_after.mp4