Questions on Hardware Instancing

Hello Fellow Developers!

I am currently working out a way to use Hardware-Instancing. I have followed the tutorial on : https://developer.playcanvas.com/en/user-manual/optimization/hardware-instancing/ which is very helpful!

I got it to work in my application but I have 2 Questions so far.

In the link above it is stated:

Each instance of the mesh can have a different limited amount of state (for example, position or color).

I got how you can do instancing with position. But how would instancing with color work ? And could you do both at once ?

My second question is about the instancing itself. I am currently trying to spawn different trees in the same area. So far for performance reasons, I have only used a FBX which is a plane that has a PNG texture of a tree as a material. But now when I spawn let say 2 different type of trees. One tree is always rendered infront of the other. Is there a way around this problem, or do I have to use a real 3D-Model in order for the instancing to work properly. If so, won’t it be much more performance dependend than using just a plane with a texture ?

Thank you very much!

Hi @Bfischlin, check the following thread on how to customize colors per instance:

For your other question instancing can work with any kind of model. What is important here is to enable instancing per mesh instance. So if you have two different models, you will have to go through the process twice, for each model/mesh instance.

1 Like