Object silhouette. Edge Rendering. Dashed line effect

How could I achieve this “selection” effect on the object silhouette. I need to be able to switch selection quickly to some other object, so this effect might be switched from object to object fairly often.

maybe this? “Cavity” shader effect like Blender 2.8 viewport for Babylon.js? - Questions - Babylon.js (babylonjs.com)

Highlight layer? Babylon.js docs

There are several solutions

  • display the edges of your mesh : mesh.enableEdgesRendering() with a color and a width of the line
    (Babylon.js docs)

  • adding a color on the material of your mesh when it is selected

  • highlight your mesh

may be some more others.



Hi. Thanks for your answers. But I am specifically aiming for dashed line effect around the object.

Would it be possible to write shader to create this effect (like Sobel edge detection) Either shader somehow as post-process effect or on the object itself as shaderMaterial, maybe rendered in the separate pass and overlaid with the original material of the object?

This area is kinda vague for me, so I might not even know what I am talking about here. I tried this approach but I am not getting results I want, basically I am not finding and rendering edges properly.