Optimisation for .glb file rendering

Hello,
I have a 250MB .glb file that has about 750 meshes, 1.4M Verts, etc…

when added to playCanvas glTF viewer, renders perfectly with very high response rate (i.e: no lags, delays)

I am using playCanvas engine coupled with typescript in a canvas component. I’m loading the file from a server, after all the assets are added with the app becomes extremely slow and laggish without rendering any collision components. just a simple call resource.instantiateRenderEntity
I have also set castShadows=false to increase performance, but little to no effect.

However, without this file, everything else (camera, movement, player 3D model, etc…) is all rendered perfectly without any delays.

is there a way to optimize the performance ?

Hi @MrKJ and welcome,

That’s quite interesting. The PlayCanvas viewer runs a regular instance of a pc.Application, so if you are getting good performance there, you should be getting similar results in your project.

Have you tried running it through the PlayCanvas editor? Since you are loading it remotely it should be trivial to set it up. From there you can use the profiler to check if the bottleneck is in the rendering side (draw calls, scene setup etc.).

https://developer.playcanvas.com/en/user-manual/optimization/profiler/

Thank you for replying,

I’m currently using localhost to serve files, but it wouldn’t be a problem to check the profiler.

However, I’m currently wondering if Batching from https://developer.playcanvas.com/en/user-manual/optimization/batching/ could be a solution? but as i understand, having them in a single .glb file the Batch Manager is already doing that.

or in general, if there’s best practice to render these types of files.

Yeah thinking about ways to optimize performance is a good strategy, but as you say given it’s a single mesh most likely you won’t see much benefit.

And definitely we should understand first why there is such a performance difference between the viewer and your project.

Difficult to tell what the issue could be without a repro. As Leonidas has mentioned, they are running the same engine and logic so it’s odd there’s such a big difference :thinking:

Have you tested against a non debug version of the engine in the Editor project?

1 Like