Instancing Question. Can multiple meshes/instances use the same edgesRenderer

Hi, can multiple meshes use the same edgesRender? Cloning or using creatInstance on the meshes material doesn’t attach the edgesRenderer.

I ask this because my scene contains many meshes that use edgesRendering and so there are also many lineShader materials that are the same. Ideally I would like to optimize the scene and use createInstance so there is one lineShader being used by multiple meshes.

Tried this sort of thing…

sphere2.edgesRenderer = sphere1.edgesRenderer;

or something like this…

?..edgesRenderer._lineShader.clone();

Thanks in advance.

You can not share the edgesRenderer accross meshes unfortunately. But it should be totally fine with instances as long as you enable the renderer on the root mesh.

Thanks for your reply. I have enabled the edgeRenderer on the root mesh and created an instance of the root mesh, but the edgeRenderer is not shared. How can I do this?

https://www.babylonjs-playground.com/#TAZ2CB#51

Sorry for the confusion, I was looking into the depth renderer…

You are totally right the edge renderer does not support sharing at all. I wonder how hard it could be to support instances.

@Deltakosh what do you think ???

We need to add support for it. Let’s add an issue to track the idea
@Ian: do you mind creating the issue on the repo?

I’ve created the issue on the repo.

Thanks everyone for your help.