Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a more accurate algorithm for z interpolation #2000

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Jaklyy
Copy link
Contributor

@Jaklyy Jaklyy commented Mar 17, 2024

Implements a more accurate model for z interp which results in closely replicating the precision loss.

The amount of precision lost is directly correlated to how wide a polygon is.
This behavior seems to only apply to interpolation along x?
One theory I have is that it takes the difference between the left and right depth value and right shifts by 1. Followed by, in the case where z0 > z1, adding the remainder of the division of (z0-z1) and xdiff towards the end of the process.
Note: there are a few alternative ways to do this, while still getting an equivalent result. Such as by left shifting xdiff by 1 before division.

Some samples:
before > after > console
image image image
image image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant