-
-
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
BatchedMesh: Add support for per-object opaque and transparent sorting #27168
Conversation
# Conflicts: # examples/jsm/objects/BatchedMesh.js
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
@Mugen87 Are there any issues with this PR? I'd like to get it merged and make a PR moving the file into core before the next release if possible. The diff may be easier to look at with no whitespace changes: |
We should probably add increase the maximum number of objects... On a M1 Pro the Naive approach runs at 60FPS too 😅 |
mrdoob#27168) * Add support for sorting objects to BatchedMesh * Add transparency to the demo * Class rename * Comments, removed variables, fixed condition * Add copy and toJSON support for object sorting
Related issue: #22376, #27111
Description
Adds
BatchedMesh.sortObjects
which enables sorting every individual batched object from front to back or back to front depending on whether the material is transparent. This helps address GPU overdraw performance issues, as well - similar to WebGLRenderer's sort. Updated demo with new flags here.Here's a before and after enabling sorting for a 0.9 opacity material:
Upcoming PRs