cesium
cesium copied to clipboard
Will the ModelInstanceCollection class be restored?
I've noticed the ModelInstanceCollection has been removed since 1.96. It used to be placed in the Development category in the Cesium sandcastle.
ModelInstanceCollection is really useful and efficient to display a large amount of same models. Will it be restored in a subsequent version?
Hi @zhwy, ModelInstanceCollection was marked as a private class, so it was not an official part of the API and was subject to change.
@j9liu Is there anyway for a user to hook into model instancing without 3D Tiles?
Hi @zhwy,
Models can be instanced on the GPU if they contain the EXT_mesh_gpu_instancing extension, but as of now there's no class to instance models without the extension, or instance them on the CPU.
You can still manually create a collection of Models with different model matrixes -- is there a reason that you needed ModelInstanceCollection in particular?
Hi @j9liu ,
I use ModelInstanceCollection to generate large batches of models dynamiclly. One application is that I need to display many vehicle models based on GPS data and update each instance's model matrix regularly.
Hi @zhwy,
Thanks for the response. I'm not sure how much effort this would be to implement since ModelInstanceCollection may not be compatible with the new Model architecture. For now I've marked this as an enhancement to consider adding this in the future.
+1. The same usage like what zhwy said, displaying large numbers of the same model. It would be nice to see that.
+1,ModelInstanceCollection is convenient for implementing gltf instance,Look forward to seeing this feature again.
has other way ?
@ptrgags Would you be able to advise on how something like ModelInstanceCollection could be implemented with the new model architecture?
Using ModelInstanceCollection to creating gltf instances is efficient and it can raplace the modelMatrix of each instance.Creating hundreds of moving cars is an easy thing by using ModelInstanceCollection ,but now i cannot do it. Looking forward to seeing this feature again.
Thinking about this a bit, rendering a static set of instances would be relatively straightforward to implement, since all the building blocks exist from the EXT_mesh_gpu_instancing code. However, dynamic updating of the model matrices would take more thought.
Let's start with the static case:
- When parsing the glTF into a
ModelComponents, the main difference is we want to add aModelComponents.Instancesto the result. This is quite similar to howI3dmLoaderworks (see here), except the attributes/model matrices would now be supplied by the user. - This means we might want to create an
InstancedModelLoaderclass that uses aGltfLoaderfor the basic glTF parsing/loading but then modifies theModelComponentsto add the instances (much likeI3dmLoaderdoes, and howB3dmLoader, etc. adds metadata) - As far as the entry point goes... not sure the best API for this, perhaps add
Model.fromInstances()?
As for the dynamic case (updating the model matrices on the fly):
- For reference, the old code used ModelInstanceCollection, which contained ModelInstance objects to track the model matrix.
ModelInstanceCollectioninvolved a large amount of code duplication of the oldModel, let's avoid doing that again.- As for
ModelInstance, I notice that the old code required allocating separate objects for every single instance. Was this ever a memory issue for large numbers of instances? If so, maybe consider a single "view" like object that lets you update a matrix by index (e.g.modelInstances.setMatrix(index, updatedMatrix). Though that might still require some typed arrays on the CPU... - Either way, we'd need to attach this object to the
Model, and we'd need a way to update the instancing matrices (when necessary) each frame. Maybe it would be good to look at how we implemented animations (especially handling the node matrices).
Also requested on the forum: https://community.cesium.com/t/the-modelinstancecollection-is-canceled-how-can-i-load-thousands-dynimic-models-in-cesium/21797/2.
So is that possible to restore the ModelInstanceCollection class or add a class that has similar functionality in the new version of Cesium? Our projects about geographic visualization really need it!
hi, @ggetz, Is there a plan to restore this functionality with the new model architecture?
地理类项目无比需要这个功能
This feature is used in many scenarios, hope to see it again.🙂
hope to see it come back, we need this
Also requested in https://community.cesium.com/t/using-modelinstancecollection/7473/6
Hi, any update on this ? Like many others in this issue thread, I generate glb blobs on the fly and then need a way to make 100s/1000s of instancing of this one model. ThreeJS supports it out of the box as you know and CesiumJS used to ... please bring it back :) Even static model instancing as suggested by @ptrgags is sufficient for now !
Sounds like another case where this would be a desired solution: https://community.cesium.com/t/gltf-scenes-to-3d-tiles/30305/4
Hi I'm also interesting of this feature.
Thanks,
Bump :)
badly needed
How is the progress?
There hasn't been any activity on this item recently, but we are definitely receiving the message that this is an important feature!
If you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR.
badly needed
badly needed +1
So is that possible to restore the ModelInstanceCollection class or add a class that has similar functionality in the new version of Cesium? Our projects about geographic visualization really need it!
really need it!
It keeps popping up in the forum: https://community.cesium.com/t/using-modelinstancecollection/7473/7
Needed feature