-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Batchmesh: Fix cases where calling optimize can result in inconsistent state #29624
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
What do you think about moving |
Is there a reason? It was requested to be moved to core, previously 😅 I think it's nice to have something that exposes this capability built into the project but if there's something that needs to change in order to accommodate that I'm happy to discuss what that looks like. |
I would say it belongs to core cause it might be the most powerful class since InstanceMesh to reduce drawcall and improve performance. I used it extensively this last 2 months in game production and therefore I might have report many bugs about it. Overall me and my teams are more than happy with BatchedMesh for the performance and versatility it offers and I can't visualize new medium/large threejs project without it. There is room for improvement and stabilization but its going in the right direction + as @RenaudRohlinger mention here its gonna gain even more performance on WebGPU soon. |
I just feel it's getting kind of big and it's for pretty advanced users that wouldn't mind adding an extra import on their projects 🤔 |
@Makio64 You make it sound as if I'm suggesting removing it from the project completely 😅 I'm just suggesting moving that file to addons. The renderers would remain intact. |
@mrdoob woops, sorry! I understand the point of the size, I think BatchedMesh can be simplified / factorized as I suggested here : #29591 (comment) . I'll PR it this weekend |
I was also wondering if we could implement a simpler basic version of |
I'm mostly trying to understand the line you're feeling for when something belongs in core and when something belongs in the examples folder and what the concerns are more exactly so I can suggest other options for mitigating them. Regarding size - this class will be treeshaken when building. I'd also like to avoid thrash with dependent projects. Moving the class (again) is a breaking change and means a major release for any dependent libraries. From my perspective this is where I'd wanted BatchedMesh to be in terms of features when I started working on it around almost a year ago (!!). In any other engine this would be considered a core feature and, in fact, is as simple as a toggle. But I understand there are concerns about complexity. In the past I've suggested adding
This is something I could support. But I'd prefer not to block this PR consider it's bug fixes on this discussion. Can we make a separate issue to discuss, instead? |
Related issue: #29527
Description
I found some issues while working on a batched mesh implementation for 3d tiles (NASA-AMMOS/3DTilesRendererJS#800) that takes advantage of the new functions from #29527, #29577 and saw that calling optimize could result in geometry displaying incorrectly.
reservedRanges
since there is now no guarantee of the ranges being presorted.Once I've gotten the 3d tiles BatchedMesh plugin completely working and merged I'll plan to submit a PR with some cleanup for BatchedMesh, as well.