1
\$\begingroup\$

How could I create programatically wireframe models like this out of a triangular mesh? What'd be the algorithm behind?

enter image description here

(Source)

Creating an additional mesh using lines instead triangles or just using a single mesh with the typical geometry shader using barycentric coordinates are the most straightforward approaches. But they're far away from being as cool as the results shown in the above link.

So I was wondering how difficult would be creating a new mesh like the shown in the above link, would it be possible to achieve by just having a simple triangle soup?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

You can find blender's code that creates the wireframe mesh here.

Effectively you want to create a tube around each edge in the mesh. So if you wanted to use eight edges to make the tube, you would create eight new edges for each existing edge, move them parallel to the edge by radius distance and using the original edge as the centre point rotate them by 45 degress each. Then subdivide and join with faces.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the answer, I'll try to decrypt that source code, in any case, when you say subdivide and join with faces... what do you mean? The creation of rounded tubes is more or less clear, problem comes when you've created the rounded tubes because the joints will look like this. Also, does the posted code apply to triangle soups (or indexed triangular meshes)? +1 in the meantime \$\endgroup\$
    – BPL
    Commented May 13, 2017 at 9:22
  • \$\begingroup\$ While I only glossed over the basic algorithm you will most likely want to find a way to join each tube cleanly or bring them out further so that the ends meet. Given the edges you have created parallel to an existing edge, you can create two tris to join each pair of edges or you can subdivide the length into x pieces and create two tris between each matching pair of verts over the length of the tube. For short edges two tris will work but for longer edges you may want to subdivide them to get a few more faces. \$\endgroup\$
    – sambler
    Commented May 14, 2017 at 0:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .