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

#1

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).

#2

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
#3

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.

#4

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

#5

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
#6

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

1 Like
#7

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
#8

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.