renderOutline and renderOverlay on instancied meshes

If it’s possible make the renderOutilne and renderOverlay available on instancied meshes.

Should I create an issue on github ?

Hmm, weirdo. It’s in the API for instancedMesh but it doesn’t seem to work the way I expected and I cannot find any working examples. May be it needs a custom buffer? I’m eager to hear the answer from an expert cc @Evgeni_Popov

A mesh and its instances are rendered in a single draw call, so you can’t have a different setting for the mesh and each of the instances: it’s the mesh setting that’s used to render the outline/overlay for all instances + mesh.

If you have only a few meshes to outline/overlay, the workaround would be to clone these meshes and to apply outline/overlay on these meshes instead.

2 Likes

EDIT: actually found this post that explains more in detail and has a solution: Issue with highlighting instances - #5 by Calsa


I’m trying to use instancing on my project for all the loot on the ground and it works amazing even with 5000 items on the ground.

I’ve realized now that I can no longer use the overlayColor and renderOverlay to highlight items when I hover over them with the mouse.

As I’m not quite sure I understand what you were saying in previous post (…the workaround would be to clone these meshes and to apply outline/overlay on these meshes instead…), do you have any advice @Evgeni_Popov ?

Prepare two different source objects. One of them is used as a highlighter. Use it to create a new instance object and replace the object that needs to be highlighted when it needs to be highlighted.

You should clone the object that needs to be highlighted (either ahead of time as a preprocess or at the time you need to highlight), apply the highlight to this object (which is not an instance, it’s a regular mesh!) and hide the original instance.

Make sense, thanks @xiehangyun and @Evgeni_Popov