-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
BufferGeometryUtils: Add mergeGroups(). #23756
Conversation
Thanks! |
However... I'm starting to really dislike groups and multi materials... I'm not sure if it helps, but what about an API like this? const geometry = new BufferGeometry();
geometry.addAtrribute( 'position', new BufferAtrribute( data, 3 ) );
// SubBufferGeometry is basically like geometry.group... maybe BufferGeometryView is a better name?
const subGeometry1 = new SubBufferGeometry( geometry, 0, 100 );
const subGeometry2 = new SubBufferGeometry( geometry, 100, 200 );
// Compound would be like Group, but transforms for the children are ignored
const compound = new Compound();
compound.add( new Mesh( subGeometry1, material1 ) );
compound.add( new Mesh( subGeometry2, material2 ) );
scene.add( compound ); I feel like something like this could be easier to handle (for the developer and for the renderer). @Mugen87 @donmccurdy Thoughts? |
That looks indeed cleaner however I'm not sure multi-materials or a similar feature like
|
I think something like It also makes it much easier to render different parts of the same geometry data in different parts of the scene. With groups is much more convoluted to do that. Hmm... The @donmccurdy What do you think? |
Hmm... This approach would also make multi-material obsolete, which is also code/design I would love to get rid of... The only use case I can think of where this makes things more difficult are when dealing with |
MMD might be a good example to check if the functionalities keep working because it consists of groups, SkinnedMesh, morph, and keyframe animations. |
multi-material /
|
Depends on #23740.
Description
Introduces a utility function to merge groups in geometries. Can be used to optimize the rendering of multi-material meshes by lowering draw calls. Also required for an upcoming routine that converts a multi-material mesh into separate meshes.
As suggested in #13748 (comment), this PR adds an index if not present and only sorts the index. It can also work on interleaved index data.
Closes #13748.