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

Particles rendered in front of laser bitmaps #1335

Open
asarium opened this issue Apr 14, 2017 · 4 comments
Open

Particles rendered in front of laser bitmaps #1335

asarium opened this issue Apr 14, 2017 · 4 comments
Labels
bug An issue from unintended consequences graphics A feature or issue related to graphics (2d and 3d)

Comments

@asarium
Copy link
Member

asarium commented Apr 14, 2017

@AxemP reported this on IRC.

Opaque particle effects obscure laser bitmaps even though those bitmaps are located in front of them in the world. This is caused by how the particle shader uses the position or depth buffer for determining the soft-particle intensity. Since laser bitmaps are not rendered into either of those buffers, the particle shader doesn't know that there is a bitmap there and renders the particle bitmap on top of the laser bitmap.

Test mod provided by @AxemP: https://drive.google.com/open?id=0B_q0tkX7VcSaZXZHQ0w4bDZsLTg

@asarium asarium added the bug An issue from unintended consequences label Apr 14, 2017
@SamuelCho
Copy link
Contributor

No, this has nothing to do with the position or depth buffer. Quite simply, there's no sorting of batched effects being done. Particles rendered additively (stuff without alpha channel) turn out fine because they're order-independent. But then you start running into problems with alpha-minus-one blending (stuff with alpha channel).

Unless we sort and render particles one by one (which would kill our frame rate because that would end up breaking the batches), we probably can't fix this very easily.

@asarium
Copy link
Member Author

asarium commented May 21, 2017

Indeed, after thinking about it a bit more I realized that using the position or depth buffer doesn't work here. I guess this is just an issue with how our alpha blending works. I read about order independent blending but that would probably change how particles look like and break other stuff as well.

Should we keep this issue open? It's not really necessary anymore since you determined that opaque particle simply don't work with the FSO rendering engine. One possible solution could be to render those particles with additive or multiplicative blending but I don't know if and how well that would work.

@SamuelCho
Copy link
Contributor

Order independent blending might be actually a valid solution for this. Probably linked-lists fragments. But that's going to require a compute shader and shader atomics.

I've also looked into weighted blended order independent transparency but that ends up producing the same results as this issue when opacity is 1.0.

@asarium
Copy link
Member Author

asarium commented May 29, 2017

Are compute shaders a problem? Sure, we would have to have a fallback for hardware that doesn't support them but we already have a code path that does this so the feature could be enabled whenever support for compute shaders is detected.

@JohnAFernandez JohnAFernandez added the graphics A feature or issue related to graphics (2d and 3d) label Sep 9, 2020
@JohnAFernandez JohnAFernandez moved this from To Sort to Low Impact in Issue Management Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue from unintended consequences graphics A feature or issue related to graphics (2d and 3d)
Projects
Status: Low Impact
Development

No branches or pull requests

3 participants