Outline for imported .stl mesh (+ smoothing)

Hi everyone,

When I try to use outline on an imported .stl mesh it seems broken:

Does this have to do with incorrect face/vertex normals? Seems like the only way to fix this is to force the mesh to use shared vertices (uncomment line 15), but for a large .stl I use in my project this operation is very costly and results in undesired mesh geometry distortion (which can also be seen in the above playground around the eyes and the mouth).

Do you have any other recommendations on how the outline quality can be improved for an imported .stl (and maybe how the mesh itself can be smoothed)?

Thank you.

unfortunately you are correct. as your faces are independent the outline algorithm is not working well.

Maybe using screen space curvature: https://www.babylonjs-playground.com/#AJJ8U5#16

Thank you, @Deltakosh. Unfortunately, I also have other meshes in the scene and I want to outline just one/few of them. As far as I understand post processes get applied to the entire scene.

On a second thought I think this would work for me: Highlight a Mesh - Babylon.js Documentation