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
BatchedMesh: Add geometry groups support and multi material handling #27930
Comments
I believe this is effectively a duplicate of #27203.
Only a single material can be used across all geometry in the BatchedMesh. The demo from #27170 (comment) just demonstrates how a material can be modified to support different surface properties by packing them into a texture. BatchedMesh is designed to minimize draw calls so I don't support changing the implementation to support an arbitrary number of materials which results separate draw calls, defeating the purpose of the class. As I mention in #27203 it may be possible to shift the separate geometry tracking to the |
Description
I've tried to read all the discussions and PRs about the recent addition of BatchedMesh to Three.js.
There is still a WIP, or at least questions, about how geometry groups support could be added.
I might have a solution, that I am already using in my own version of BatchedMesh (was developing it before BatchedMesh was added).
If I understand correctly the current state of BatchedMesh:
The main goal is to be able to change the opacity per object (or proxy) embedded in the BatchedMesh.
Solution
To support multiple geometry groups, what I've done is
I already have such implementation in my project (without multi draw, I use non-visible materials instead) and I can change transparency per objet on-the-fly.
Alternatives
Currently, if I understand correctly what has been done, it is possible to use a transparent material for the BatchedMesh, and use RGBA values for vertexColors buffer to control per-object opacity. Problem is that opaque objects will be drawn with transparent objects, failing a correct drawing order, and will lead to gpu overdraw (DoubleSide drawing for opaque objects for example)
Additional context
I will be glad to contribute to improve BatchedMesh implementation and rely on it in my own project. Are you interested in this idea ? Feel free to comment and expose alternatives.
The text was updated successfully, but these errors were encountered: