2
\$\begingroup\$

I have a 3D complex shape composed of simpler primitive geometric shapes. The geometric shapes are made of triangles.

I already know how to draw the edges of a single object (geometric shapes). In this case I am comparing each pair of triangles that are adjacent and comparing its normals. If the normals are not the same then it's an edge, so I draw a line.

However, when combining primitive shapes to form a more complex shape (current rendering), I don't know how to remove the edges of the faces that are coplanar with the faces of the adjacent shape.

How can I know what lines are not anymore edges in the complex shape so I get the desired rendering?

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Is combining the shapes into one shape / mesh a viable solution? Or do you need them to be separate? \$\endgroup\$
    – Charanor
    Dec 31, 2017 at 2:13
  • \$\begingroup\$ @Charanor Yes. combining the shapes into one shape would be a viable solution \$\endgroup\$ Dec 31, 2017 at 3:00
  • \$\begingroup\$ then why don't you do so? I'm confused by the use case as well (real time rendering? load time rendering? what are the constraints?), the simplest answer is just to combine shapes with the same vertexes. \$\endgroup\$
    – Krupip
    Jan 2, 2018 at 20:33
  • \$\begingroup\$ @snb It is about load time rendering. I don't know how to combine the shapes, because the faces (triangles) could not share the same vertices and I how do I combine the prim with the cube? they share only 2 vertices. \$\endgroup\$ Jan 3, 2018 at 22:00

1 Answer 1

0
\$\begingroup\$

After struggling with the problem I found a solution that solves the use case.

Here are the steps to draw the edges of the complex shape:

  1. Merge the different objects into a single mesh
  2. Remove hidden faces in object space (I use raytracing)
  3. Find and draw the edges
\$\endgroup\$

You must log in to answer this question.

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