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

Sort triangles inside a transparent mesh based on distance to camera #154

Open
asny opened this issue Nov 1, 2021 · 3 comments
Open

Sort triangles inside a transparent mesh based on distance to camera #154

asny opened this issue Nov 1, 2021 · 3 comments
Labels
renderer In the renderer module

Comments

@asny
Copy link
Owner

asny commented Nov 1, 2021

If a mesh is transparent and the blend mode is not ADD, the triangles has to be rendered back to front which requires sorting them cpu-side. In principle it should be done every time the camera changes, but can probably be done less often.

See also discussion in #141 .

@Nevsden
Copy link

Nevsden commented Feb 6, 2024

As this issue is still open, I assume this is not yet implemented?
I was looking into the issues surrounded by this topic a little and found that there is a function that is not yet used properly. Is this where the problem is left at?

@asny
Copy link
Owner Author

asny commented Feb 23, 2024

This is not yet implemented no. The issue here is about sorting the triangles inside a mesh which is not easy to do fast. The function you refer to sorts the mesh instances which is implemented and working.

@asny
Copy link
Owner Author

asny commented Feb 23, 2024

Maybe that was obvious 👆 But we can't just use that same approach because sorting all triangles that way every frame is super expensive. If we do that, I will get a lot of issues about the application being slow 😆 We could sort the triangles CPU-side at some frames instead of all frames, but that's also not very easy to implement so it generally works and doesn't affect performance too much. There's another approach called order independent transparency but that is not super easy to implement in a generic way, I haven't had time to think if it's doable, that's why this issue haven't had any progress.

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

No branches or pull requests

2 participants