-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix OIT depth test #15991
Fix OIT depth test #15991
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I also tested this with two scenes and it's working as expected \o/
@@ -5,6 +5,12 @@ | |||
#ifdef OIT_ENABLED | |||
// Add the fragment to the oit buffer | |||
fn oit_draw(position: vec4f, color: vec4f) { | |||
// Don't add fully transparent fragments to the list | |||
// because we don't want to have to sort them in the resolve pass | |||
// TODO should this be comparing with < espilon ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this could be something like:
const EPSILON: f32 = 4.88e-04;
if color.a < EPSILON { ... }
But tbh I'm not seeing that this is done when comparing color values anywhere in the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea behind that comment is more about having a cutoff for almost transparent pixels. Instead of fully transparent, the reason is that every fragment we add to the list costs us more memory. Right now it doesn't really matter because we have a fixed buffer size, but eventually I want to work on making it smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, might be worth filing a ticket so that we don't lose track unless this is something you think you'll get to for work anyway.
All the various TODOs in the OIT code are very much for future me when I'll work on it. Some of the improvements I need for work but some are a bevy specific. |
Objective
Solution
Testing
before:
after: