Duplicate the mesh as a instance for better performance

Hi,

1. I have a huge cityscape scene in blender. In that scene some buildings are used as instanced objects which means some buildings are duplicated and placed in different roadways. So I have tested similar kind of workflow inside the playcanvas for reducing the file size and better performance.

First, I have created the cube in the playcanvas then published to new build. Thereafter the same cube duplicated (ctrl+D) in multiple times and published the another build. Both builds are same file size, so I assume duplicated object works as a instanced object in playcanvas. Can I go with this workflow for arranging the huge cityscape in playcanvas? I think in this method gives better performance instead of importing the entire buildings in to the playcanvas.Is this correct?

2. In blender I have created the mesh in specific position (location X,Y,Z). Then export that mesh in FBX format. It’s placed on the specific location in the playcanvas but the origin point looks far from the mesh. So the long white line appear from origin to the mesh. How to set the origin/pivot to center of the mesh.


Regards,
Vasanth

Hi @Vasanthakumar,

So I think you can go either way, as long as you organize everything correctly.

  1. You could model your whole city in blender properly grouping everything under the same node per material used. When that model is imported in Playcanvas all instances of the same building will use the same mesh instance. That means they will be rendered in a single draw call resulting in good performance.

That is a good method if your scene is static, you don’t care in moving those objects in the Playcanvas editor or during gameplay.

  1. You could export as a separate model each base building and setup your city in the Playcanvas editor. Then leverage batching setting all instances that are to be batched in the same batch group (check this manual page for more info).

This is a more powerful creative pipeline since each model will still be an entity that can be used by your scripts/gameplay logic. And potentially if you use dynamic batching you are able to individually move each entity.

1 Like