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

WebGPURenderer: Apply batching matrice before instancing and Expand multiDraw Support #27950

Merged

Conversation

RenaudRohlinger
Copy link
Collaborator

Related issue: #27937

Description

This fix addresses an issue where the batching matrices should be applied before the instancing matrices. It also introduces support for multiDrawElementsInstancedWEBGL and multiDrawArraysInstancedWEBGL, which offer comparable functionality to the basic multiDraw methods and have the same browser support (95%+).

The WebGPURenderer and Nodes makes this combination pretty straightforward to achieve and works on both backends, for example this scene is rendered in a single draw call:
image

This enhancement also aims to provide guidance for the WebGLRenderer, for example with renderMultiDrawInstances.
In the future, we might witness the introduction of an InstancedBatchMesh or some improvements to the BatchMesh. The current implementation of BatchMesh inefficiently allocates excessive memory by redundantly replicating geometries instead of utilizing a Map for referencing and instancing them.
That said, these changes extend to a much wider scope which I do not plan to explore any time soon, unless a bounty or a similar incentive is provided, allowing me the time to do so.

This contribution is funded by Utsubo

@RenaudRohlinger RenaudRohlinger added this to the r163 milestone Mar 20, 2024
@RenaudRohlinger RenaudRohlinger merged commit 70aed3d into mrdoob:dev Mar 20, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant