Hidden line removal

 from Red Blob Games
11 May 2022

For some of my art projects I want to have lines drawn on a 3d surface. For drawing to the screen, it’s easy, as I have webgl. But for drawing to a plotter, I need to remove the hidden lines.

The idea is to have a surface made up of triangles. I need to sort these using painter’s algorithm and hope there are no glitches. I assume no overlapping cycles and no intersections.

All lines must be placed on that surface, and already broken down into segments for each triangle. This is a big limitation and means I’m not making a general purpose algorithm.

On a screen: for each triangle draw the lines for that triangle, then draw the triangle.

On a plotter: for each triangle, clip the lines then draw them, then add the triangle to the clip set.

I’m going to write a test program for the screen first.

Email me , or tweet @redblobgames, or comment: