Mesh Edge render as line?

Hi all,

I tried to find resources in the forum regarding render edges as simple line but without success.

Basically I have a model that needs to render the edges. So far I used the enableEdgesRendering function. But this edge renderer draws triangles instead of lines, making the edge of the mesh barely visible from far and too thick when close. Also the edges are jittering a lot.


from far the edges are barely seen.


from close they are too thick and not even

I would like to instead render the edges as line so they have a constant look. (Something like below but this is an example from threejs)

I noticed that the boundingbox edge renderer draws line, which is something I need. But I tried to attach the boundingboxrender’s shader material to the edgeRenderer’s lineshader mesh.edgesRenderer.lineShader = _colorShader; which does not really work.

I am not familar with the shader material. So I wonder if there’s an instruction on how I can achieve line renderer for the mesh edges. And if I have to stay with the default edgeRender, how can I fixed the jittering issue at least?

Thanks!

Maybe this example can give you the right direction how to draw a lot of thin lines:

Babylon.js Playground (babylonjs.com)

You can reuse the data created by the edge renderer to generate the lines yourself (either as a line mesh or with the thin wire plugin linked by @CodingCrusader). See this post and related PG:

1 Like

There is also Barycentric stuff you could do.