How can I dynamically load part of my model?

Hi, there! Can someone help me with this?

I’ve my glb model loaded on the scene. Now, I want to load the part of continents dynamically as per the camera frustum and zoom level. My use case is like -

  1. The model loaded and only the part that are inside the camera frustum should be visible and as I move my camera, I need to dynamically load the other parts of continents.
  2. After a certain camera zoom level, I want to dynamically load other models like boxes, and buildings over my continents and write text over it.

I search a little things, like camera.onViewMatrixChangedObservable event or adding LOD level which can help me to achieve little things. The main part is I’m stuck into dynamic loading part on certain camera movement or zoom level.

Here is my playground link you guys can refer -
https://playground.babylonjs.com/#G95938

Here I’ve commented on the other model “medium-light-new.glb”, which is a sample building the I want to dynamically load over my continents.

Please, help me with your guidance!!! Thanks!

You would need several glb for this I believe or do you mean loading in the scene only ?

cause the hot path on glb is about network + parsing once done aside of a bit of memory culling and such is already handled for you.

Hey, @sebavan, I mean loading in the scene only. So, by default I have my continent model loaded. And as I move my camera or zoom I need to dynamically load building models and place them over the loaded continents.

And I want only those parts should be visible which are inside the camera frustum. As I move the camera and it appears inside the camera frustum it should be loaded/visible.

I guess you could try Asset Containers | Babylon.js Documentation so that all your models are ready there and you dynamically pick what is loaded in the main model ?

1 Like