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

Suggestion: Reversed-Z Buffer for high precision #12

Open
retroluxfilm opened this issue Feb 3, 2024 · 2 comments
Open

Suggestion: Reversed-Z Buffer for high precision #12

retroluxfilm opened this issue Feb 3, 2024 · 2 comments

Comments

@retroluxfilm
Copy link

retroluxfilm commented Feb 3, 2024

I just saw you implementation note after I forked your repo and stumbled upon the Z-Fighting issue. Reverse Z-Buffer is a real improvement especially on large stages. For GTR2 it also helped to resolve a lot of Z-Fighting flickering. ( Which I personally did not yet encounter on RBR)

Just a tip you can try out:
https://developer.nvidia.com/content/depth-precision-visualized

Feel free to close this issue if its not relevant anymore.

@Detegr
Copy link
Owner

Detegr commented Feb 5, 2024

This is super interesting, I hadn't heard of reverse-z before. I'll come back to this at some point, this would be a nice thing to implement.

The current implementation reduces Z-fighting by rendering the cockpit that's near the driver with different projection matrix than the rest of the stage. It works quite well, although there are some noticeable artifacts sometimes where the stage gets clipped if it comes too near to the driver's eyes, like when driving into a snowbank. It's a bit of a hacky solution though, so this would most likely yield better results.

@retroluxfilm
Copy link
Author

retroluxfilm commented Feb 5, 2024

Great to hear that it might be helpful. Your solution to split the cockpit and the stage to different matrix is pretty smart trick as well. I did not notice any issues and possibly only happens on the edge cases you explained.
On GTR2 it was tricky as the tracks had many decals that where placed close to the track, like the line markings on the road and the light and shadow planes. Reverse Depth fixed all the flickering issues, even on using integer depth precision.

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

No branches or pull requests

2 participants