Displaying a 2dSprite always above the 3d object

Hello,
i was experimenting with adding sprites to a scene and I am wondering how I can get them to be always rendered “above” the 3d content:
Here is a playground:
https://www.babylonjs-playground.com/#IGQ023
In this one when adding a spot with the pointer, parts of the sprite get “swallowed” in the Mesh.

Thanks!

You could rely on renderinggroupid to always render on top https://www.babylonjs-playground.com/#IGQ023#1

2 Likes

Thank you
I was also wndering how I could place the sprite a liitle bit more distant to the objects outer surface.
I guess I’d need to calculate a vector from the center of the mesh to the pointer position and then extend that a bit.
Or is there a built in function for that?
some kind of virtual hull or skin or “outline” ?

With the group id, I get the issue that the sprite cannot be attached in a way that it can be hidden from sight when you turn the mesh:
https://www.babylonjs-playground.com/#IGQ023#2

Does placing sphere in same group work for your use case? https://www.babylonjs-playground.com/#IGQ023#3

Have extended the position if the sprites by 50% adjust as needed.

3 Likes

Thanks a lot.
Well the position extension does work indeed.
Putting the sphere in the same group however keeps hiding parts of the Sprite inside the mesh.