Drawing edges of Instanced Cylinders

I use the edgerenderer to draw edges of these cylinders. But I noticed that I have 1000 draw calls, even I use instanced Cylinders?

My code:
https://www.babylonjs-playground.com/#YPABS1#79

btw, renderOutline didn’t work for me on the instances.
Is there maybe another simple approach to draw the cylinders with edges like in the example`?

You need to enable the edge renderer on the parent box and set box.edgesShareWithInstances=true to reuse the renderer for all the instances:

https://www.babylonjs-playground.com/#YPABS1#83

The outline renderer will also work if you enable it on the parent box.

However, there’s a bug where the edges are not drawn when freezeActiveMeshes has been called (it’s commented in the PG above). Here’s a PR that corrects the problem:

1 Like

Thank you for the answer :slight_smile:
Now its on 2 draw calls. Shouldn’t it be 1 ?

When running on typescript, my IDE complains that there is no edgesShareWithInstances on Mesh. I’m running on “babylonjs”: “^4.2.0-rc.3”.

You have 2 draw calls because there’s one for the meshes and one for the edges.

You must have a setup problem with your IDE because edgesShareWithInstances is definitely there: if you use the playground with the default scene in Typescript mode, you will see that the intellisense does list edgesShareWithInstances as a property when you type sphere.