Grid with hundreds of identical objects

I need to make many grids of hundreds of identical meshes (chairs in an arena). They’re basically static and barely need any scripting or interaction (just a collision component, at most, but I could fake that with an invisible box).

In other platforms, this turns to a big performance hit and usually takes some kung fu around GPU instancing.

What’s the best way in playcanvas? I see there’s a batch system - didn’t find an example for that yet. I’ve messed with cloning, but I thought that made heavyweight objects.

I can make the grid/objects externally and bring in blocks or create in a script - whatever is best. I guess ideal would be to make the grid in playcanvas with a bounding box, but performance is more important than convenience (would like to support WebVR).

Bruce

Batching is your best friend here. Actually it is really easy to use the PlayCanvas batching system:

  • You setup your batching groups in your Project Settings, usually you group your models per used material.
  • You set the batchGroup property on the Model Compoment of each entity.

That’s it, on runtime batching will be automatically enabled, your geometry batched and your draw calls get reduced.

Here is the official PlayCanvas tutorial:
https://developer.playcanvas.com/en/user-manual/optimization/batching/

Of course if your art pipeline is flexible and you don’t care at all of how your models edit in PlayCanvas, you can just import them as a big block of model. But beware that will increase your app download size.

1 Like