Is there a way to show Highlight layer on 'hidden' objects?

I have been trying to add a highlight layer on a transparent object, but the highlight layer will not be shown on any objects with alpha/visibility less than 1

PG example: https://www.babylonjs-playground.com/#1KUJ0A#172

Is there a way to get around this ‘limitation’? I would like to just see a highlight without the mesh itself (a hollow outer-glow effect).

Hi. I think it is not possible to use HighlighLayer with transparent objects.

But maybe this can help you. It is using edgeRenderer instead.

https://playground.babylonjs.com/#M0XJR4#4

1 Like

Unfortunately that is not what I’m looking for. Try enabling it on the sphere instead of the ground and you will get what I mean: https://playground.babylonjs.com/#M0XJR4#5

I’m trying to create an outer glow, and I don’t need any of the inner edges.

Actually, to simplify the problem (possibly), I just need to hide the mesh somehow while displaying the highlight layer (or some other possible solutions).

Well. I have no other solutions, except maybe this one. But you cannot play with glow with this.

https://playground.babylonjs.com/#M0XJR4#7

Lines 35 and 36. Simply show boundingBox of the mesh, and you can see this while mesh is invisible.

1 Like

Pinging @sebavan (when he will be back from holidays )

1 Like

This is unfortunately not possible at the moment and I am wondering how we could do this. Actually, Hightlights do not support transparency due to the incompatibility with blend mode and depth writes.

I am wondering if we could “fake it” by disabling color draw for the dedicated mesh in the main rendering and then re-enabling it (keeping it not transparent to be compatible with highlights).

https://www.babylonjs-playground.com/#1KUJ0A#178

2 Likes

Nice trick! I think that is basically what I am looking for, and it’s usable if I abstract away some of the uglier implementation details.

Hi @sebavan, Can something like this be done with mesh.renderOutline?

I’m getting black here:
https://playground.babylonjs.com/#DG8AFQ

I do not think we have available callbacks in between the outline steps :frowning: so it might not be as simple.