Adding instanced geometry to a highlight layer automatically adds all the rest of instances

Hi there:

I’m making at the moment intense use of highlight layers, in order to accomplish glowing of certain parts, along a 3D web app development with heavy mechanical models.

Obviously, in this kind of mechanical projects, the best way to deal with a lot of pieces (screws, washers, nuts, plates, …) of basically the same kind is by means of instanced geometries. Also, GLTF format, that we are using here and there, has a good implementation of this technique.

The problem is that, as you can check in this PG, when an instanced geometry is added to a highlight layer, all the rest of the instances (of that same geometry) are automatically included in such a layer, so we end with all the same-origin-of-instance geometries highlighted.

Does it exist any way to bypass this behavioral?

P.S. An exception is raised when you try to add an instanced geometry to a highlight layer where an instace-of-same-geoemtry is already living.

So instances are all drawn by the GPU as part of the same Draw call, which is why instances must share the same material. That’s why it makes sense to me that this would happen

have you tried setting a layer mask for your various objects involved?

Apart from that, you could consider using clones instead of instances to get more control over individual elements but that might be too heavy for your needs

HTH!

1 Like

Hi there, @jelster ;

First, thank you for your time.

Certainly, as you say, the shown behavior is the expected.

It does not prevent that, in a broader framework of thought, we are facing a scenario in which, in practice, the instances cannot be used, when it would be in advance a perfect case for them.

The solution adopted, whether it is the cloning or the mask-layering method, is still an additional step that comes with a performance penalty, but I understand that it is a trade-off that must be accepted as is.

Best regards.

Have you tried setting vertice colors for the instance(s) you want highlighted? May not exactly be what you’re looking for, but might help?