InstancedMesh2 - Easy handling and frustum culling

165 FPS (monitor’s refreshrate) with an RTX 2080ti.

I’ve increased the count to a million. It gave me 40~70fps, depending on how many models are visible on screen.

1 Like

Thank you very much :slight_smile:

I’m curious if 165 fps fixed fps could be achieved with an InstancedLOD.

In any case, it seems like a good result.

I have optimised the code a little, mainly by making the initial loading faster.

Next week I should publish the first version of the package.

Besides instancedLOD I am also trying to optimise raycasting on this class.

1 Like

Small update :slight_smile:

I wrote this small example where you can see how many instances it is rendering (it’s a bit slow to start because of bvh creation):

Would this library be useful to anyone?
I would like to try it out on some already started projects if possible.
If anyone is interested please contact me in private.

const trees = new InstancedMesh2({
  geometry: treeGLTF.geometry,
  material: treeGLTF.material,
  behaviour: Behaviour.static,
  onInstanceCreation: (obj, index) => {
    obj.position.setX(Math.random() * terrainSize - terrainSize / 2).setZ(Math.random() * terrainSize - terrainSize / 2);
    obj.scale.setScalar(Math.random() * 0.1 + 0.1);
    obj.rotateY(Math.random() * Math.PI * 2).rotateZ(Math.random() * 0.3 - 0.15);
1 Like