Create mesh from edgesRenderer

The lines are really triangles, so linesIndices gives you the indices of the 3 vertices of each triangle.

Also, the triangles are degenerated in the linesPositions array:

  • for each line between P1 and P2 you can see on screen you have in fact 4 vertices V0/V1/V2/V3 where V0=V1=P1 and V2=V3=P2
  • the first triangle is V0/V1/V2 and the second one is V0/V2/V3. As V0=V1 and V2=V3, those two triangles are degenerated (so if displayed “as is” you won’t see anything)

It’s the shader used by the edge renderer (Babylon.js/line.vertex.fx at master · BabylonJS/Babylon.js · GitHub) that creates non degenerated triangles at display time by moving the vertices according to the normal so that the triangles have a thickness corresponding to the width parameter you provide to the edge renderer.

In your case, as you only want to draw lines, simply pick the first and third vertex to draw a line between them:

2 Likes