[rlsw] Subpixel correction #5300
Merged
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.
I finally managed to fix the triangle cracking and jittering issues!
The problem was actually pretty silly, the difference between the triangle edge and the first pixel of each line wasn't accounted for in the interpolation. Very, very silly...
While I was at it, I also made a bunch of other logical adjustments and renamed several variables to be more "standard" with what you usually see in papers.
I also fixed the same subpixel correction issue for quads and lines.
Additionally, I replaced the Bresenham line algorithm with a DDA. The new version has the advantage of being much more temporally stable during motion. It uses more floating-point calculations than Bresenham (which previously used some fixed point), but it's also much more vectorizable.
And for the most important and visible part, the triangles, here's a before/after comparison.
Note: The small flickering that remains in the second version is due to z-fighting with the lines under the mesh
Before
vid0.mp4
Now
vid1.mp4