Rendering a lot of 3D models

Hello. Right now I’m developing a game, the main idea of which is really massive battles. One battle can contains 20000 units, every of which is 3d animated model (exported from blender). But the problem is in perfomance. At the moment I can render 5000 static models using three.js and 5000 cubes using Babylon.js. But that’s not enough.

So, every 3d model in fact is a set of moving boxes and ball’s, because there is cartoon graphics in game. I’ve try to render boxes and ball’s using three.js - I’ve rendered 65000 boxes and 5000 ball’s. That’s too not enough to create 20000 units :frowning:

Do you have any ideas how can I resolve this task? I see 3 ways:

  1. Create PNG sprite of model (picture with 360 possible positions of model)
  2. Or, instead, create a GIF image (with 360 possible positions of model), and then use nessesary frame from that
  3. Render every model using 2d canvas. The most difficult way, and so, it will be really hard to synchronize 3d and 2d world (because the rest graphics will be written in Babylon.js/Three.js)

PS. The realise date of game is 2020 year, so WebGPU isn’t a way :frowning:

Hello and welcome!

You should be able to render as much with bjs thant with 3js(check this page: Optimize your scene - Babylon.js Documentation)

That being said, having 20K animated meshes will be a challenge :slight_smile:

My question is why do you want to mix bjs and 3js?

Thank’s for answer. I don’t want to mix bjs and 3js, I’d like to use more productive framework. I’ve try to use instructions from Optimize your scene - Babylon.js Documentation, but globaly nothing chaned. And I doubt it is even possible. I have to render about 300,000 cubes and 50,000 balls to create enough units. That’s so large.

And what do you mean telling “having 20K animated meshes will be a challenge”? I have no any chances?) What if I’l use low-poly texture?

Are you showing everything at once? If you could only show the portion in camera view you could gain some performance but rendering all this in single view at once would be hard on any engine.

See Deltakosh’s post here for more info…

You could poll it only when camera position changes to keep optimal.

Another thing you could do is use multi-material mesh for anything that doesn’t animate. This would bring your mesh count down considerably.

For instance, if your cubes do not move you could use this on them. You can reference the submeshes should you need to update this merged mesh and for instance remove a cube.

1 Like