Babylonjs Viewer with 2 models at same time

Hello BJS community,

I would like to display on my web page a glb model with an idea of its scale.

My first idea was to import glb and create a ground with GridMaterial.
But I don’t succeed to use GridMaterial with Viewer.

Second idea is to create my grid as a glb, and import (and positionned) both models.
But I don’t know to import 2 models at same time. So far I have tried including with element and with onSceneInitObservable event .

Do you have any advice on how to use viewer for this purpose ?
Or do you recommand to use non-viewer bjs ?

Also (last question I swear) is there any technical reason why minified bjs viewer is 4.5Mo, it seems like a lot, is there a way to reduce the size of it ?

Thanks by advance.

cc @RaananW

I believe that creating a ‘usual’ BJS scene will be much simpler and will give you much more flexibility.

1 Like

As the GridMaterial is an external material (from the mat lib), it might be a bit of an issue initializing a grid material. And you will need to write code to do that (as the viewer doesn’t directly support it). I believe a non-viewer implementation would be simpler in that case, though it could be a nice feature for the viewer (show the scale of the mesh somehow). You can create a feature request for that, we can add that to the list of issues to tackle in the future. Can’t promise an end date, so i wouldn’t count on it for your implementation.

1 Like