Instances performance

hey guys, can you tell me, can I boost up performance of instances in this code?

It contains 50k triangles and it is too slow if compare with THREE js instances demo

image vs image

may be I have to switch on some scene optimizations?

1 Like

How about using the Solid Particle System instead?:


sorry but the question was only about performance of instances. I made that simple demo just to show the problem (same faces count - variuos FPS)

Well, the comparison with the 3js example is not that fair because this example uses a dedicated vertex shader to animate the triangles.

That said, the BJS instances can be optimized. By default, each instance World Matrix, then each BoundingInfo is recomputed each frame and each instance is checked against the camera frustum.

You could then skip all these computations and update by yourself the instance world matrix buffer directly like explained here : Use Instances - Babylon.js Documentation

In the example from the documentation, you can see 20K dodecahedrons moving at a decent framerate.

That’s what I’m using in this demo : Test Babylon Instances Terrain
There are 6000 instances (each way higher poly than a triangle or a dodecahedron) whose world matrix buffers are updated by hand.


@jerome thank you very much!


perfect perf :slight_smile: