What is the highly effective way to render thousands of 3D Models?

480 views
Skip to first unread message

anqa...@gmail.com

unread,
Aug 14, 2019, 4:12:28 AM8/14/19
to cesium-dev
This problem had perplexed me for a long while.

In my project,I want to render a large number of ship models(maybe 1000 or more),the model is loaded from a glb file and  added to CesiumJS as a primitive object,

Here is the code snippet, "this.viewer" in which is an instance of Cesium.Viewer.

this.viewer.scene.primitives.addPrimitive(Cesium.Model.fromGltf(<any>{
url: require('../../../res/model3d/ship.glb'),
modelMatrix: modelMatrix,
scale: 0.2,
minimumPixelSize: 16,
maximumScale: 1000,
silhouetteColor: Cesium.Color.GREENYELLOW,
silhouetteSize: 2
}));

In order to load 1000 ship models,I simplely loop this snippet for 1000 times with different "modeMatrix".

As I run the application, the consequence is expected but with a horrible performance(with 1FPS or even worse).

So, is there a better and highly effective way to render thousands of 3D models that share the same glb file.

I hope it can work exactly like  the GeometryInstance do, load the glp file once and reuse it in many instances

Omar Shehata

unread,
Aug 14, 2019, 8:55:34 AM8/14/19
to cesium-dev
There is indeed a ModelInstance class made exactly for this type of thing. See this thread here:


Particularly the Sandcastle example showing 10,000+ models. 

In general, if you have a lot of 3D data, even if they're not all the same model, using 3D Tiles would be the way to go. You can read more using ion to tile various types of data here:


What kind of project are you working on?

Vander

unread,
Aug 15, 2019, 3:02:26 AM8/15/19
to cesium-dev
Thanks very much for your replay.

The situation is that I have a list of ships that distribute all over the world, and I want to track the real-time postions of all ships and display them on the 3D map.

I think the 3D Tiles may not suit my case because the positon data is generally dynamic.

I have tried to use ModelInstanceCollection instead and the performance is really much better ,but it bring in a new problem that the 3D Models quivering hardly  when I translate or rotate the viewer,

Maybe I have went a wrong way to use CesiumJS I think.
So now I have compromised to display a point instead of a real 3D model on the map firstly and then switch it when the camera is near enough. 
In spite of not exactly what I want,it works fine.

在 2019年8月14日星期三 UTC+8下午8:55:34,Omar Shehata写道:

Omar Shehata

unread,
Aug 15, 2019, 10:39:27 AM8/15/19
to cesium-dev
We do have plans on the roadmap to support time dynamic data in 3D Tiles. You can see a prototype of that demo'd at SIGGRAPH last year, where Toyota Research Institute used it to visualize autonomous car sensor data: (around 1:12:00 in this video) https://youtu.be/r-5ADuoFNws?t=4320

Do you have a gif or a video (or a code example I can run on Sandcastle) that shows this quivering? Does it only happen when there are many models? 

Vander

unread,
Aug 15, 2019, 11:16:03 PM8/15/19
to cesium-dev
Hi Omar

I am trying to show you the phenomena I've mentioned before,but when I run the application with the same testing code(I think it's identical) ,it doesn't quiver any more.... what amazing!

Now,I can load more than 10,000 3D models very easily, and it works very nice with a high FPS.

thanks very very much!

微信图片_20190816111021.png

Omar Shehata

unread,
Aug 16, 2019, 3:22:55 PM8/16/19
to cesium-dev
Very cool - glad we got that figured out!

Is this a publicly accessible application? It looks very cool - might be a great guest blog like this (https://cesium.com/blog/2019/04/29/gpu-powered-wind/) or on our featured apps page: https://cesiumjs.org/demos/
Reply all
Reply to author
Forward
0 new messages