-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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: Batched cleanup 2 #29695
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Thanks for cleaning ! Just there is something I don’t really understand in the tiles logic you re describing. In the games and editor I’m using batchmesh I have a pool of instance and I checkout/checkin instance, update the visibility/ set the correct geometryID and done. This approach keep the code minimalist and easy and I though tiles system architecture would be the same? I was wondering if this approach could make this class much more simple than dealing with range unused etc manually as you’re describing ? |
3D Tiles streams geometry data in and out of memory as the camera moves since the whole set of data cannot be loaded at once. Inserting the newly loaded geometry and textures must be as fast as possible to keep the frame rate up. You also can't really know ahead of time how large all the tiles are in a general case, though we try to allocate a minimum amount of space ahead of time per tile assuming it will be easier to fit another tile there later, which is faster. Every tile geometry is also considered unique and no geometry is being rendered with multiple instances. So when a new tile geometry is loaded we try to add it to the BatchedMesh with the quickest method possible. So that results in the fallback approach listed above - trying to find space if it exists, and then trying some more expensive approaches to make space (optimizing, expanding geometry in-place).
It's not clear from your description whether your delete geometry data from the batched mesh. If you're not then you're avoiding the hard part of the problem I'm describing. If you delete geometries (or are left with unused, undeleted geometry) there will be dead space left in the middle of the geometry buffers that BatchedMesh won't try to automatically use. If you don't optimize / repack those buffers or at least manually try to fit other geometry in that space then it's memory. |
Thanks for taking the time to explain your problematic ! Now your use case is much more clear and this PR totally makes sense! Also you re right in my use case I just load all geometries once and then just play with the instances as the games have finite number of geometries |
Related issue: #29687
Description
Re-adds the remaining changes from #29687:
drawInfo
toinstanceInfo
for claritycount
variable tomultiDrawCount
inonBeforeRender
for clarityunusedVertexCount
,unusedIndexCount
, andinstanceCount
variables so applications can have insight into whether a geometry can be added without errors being thrown.setGeometrySize
.With this PR the class publicly exposes everything needed in order to accommodate rendering 3d tiles with BatchedMesh, which requires quickly adding and removing tiles from the batched mesh. Specifically the approach requires:
getGeometryRangeAt
).unused*Count
members).Overall it works pretty well aside from some ArrayTexture hiccups which are in-progress.