-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
Docs: Clarify BufferGeometry.groups. #23740
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
Conversation
That's a surprise to me - I'd assumed groups could be resized smaller (like For another example, is it OK if all indices are used but they only point to only a subset of the vertices? This may need to be explained in a bit more detail. |
I've planned to add a helper for converting a multi-material mesh into several meshes. This feature requires merging of groups for a proper implementation. Not having the above policy makes an implementation noticeably more complex. Hence, I'd like to have a more strict usage of |
What is the use case of such a setup? TBH, I do not want to honor use cases which are theoretically possible just because the API currently allows it but are not relevant in production. There should always be a compelling reasons why edges cases should be supported. |
This is a very real use case, at least for geometry that does not use groups. For example, I might define a large vertex buffer, and then have several meshes drawn with different materials, each using indices that point to a subset of the vertex buffer. Is that a problem for the helper you want to add? Or only a problem if the mesh has ≥2 groups? GLTFLoader can create meshes like this, but never creates groups. Personally I'm lukewarm on multi-material meshes and |
No it isn't. As long as the groups cover the entire index (so there are no gaps).
Eventually, I hope we can stop multi-material support in |
I wonder if it would be worthwhile to log some kind of warning when the renderer detects a geometry that doesn't meet this requirement. That might help us to discover any use cases we've missed before enforcing this rule. I can't think of use cases myself but it would surprise me if there weren't a few... In any case, I'm comfortable with this PR. 👍 |
I'm afraid it will be a bit problematic to detect such geometries since a reliable check needs to be done per frame. And the check itself is not that trivial. Right now, I recommend to not enhance the renderer with validation checks and wait how many users actually complain about the upcoming |
Sounds good to me! |
Since #23756 has been merged, this PR can be merged, too. |
@Mugen87 By the way, thank you for all your work! |
Yes, please don't do that anymore. The reason for this is mentioned above. I would recommend to not use groups at all but model meshes independently. You can still share geometry or buffer attribute data between them. |
* Docs: Clarify BufferGeometry.groups. * Docs: More updates to BufferGeometry.groups. * Docs: Improve BufferGeometry.groups description.
Fixed #22555.
Description
I'd like to clarify the policy of using
BufferGeometry.groups
:When groups are defined, it is invalid when parts of the vertex data are in groups but others are not. Such partial definitions are problematic for logic operating on group data. It is also not valid when groups overlap.