A new algorithm solves the long-standing “hidden line problem” of computer graphics


It has proved impossible to generate a triangle mesh fine enough to avoid every error of this kind. As Meta Reality Labs researcher Stéphane Grabli, an Oscar nominee for visual effects, explains, “The feeling was that with enough subdivision, it should be possible to create a mesh that allows exact visibility computation for these contours. This turned out to be wrong.” The resulting errors limit the complexity of nonphotorealistic illustration styles, Grabli adds.
Now, in ACM Transactions on Graphics, University of British Columbia computer scientist Chenxi Liu and her colleagues propose an algorithmic solution, called ConTesse, that focuses on fixing the contour rather than the mesh. Zooming in by a factor of 1,600 on algorithm-generated contours, Liu identified small twists where the contour lines incorrectly crossed one another—and thus the tiles could not be consistently identified as facing toward or away from the viewer. “I experimented with many surfaces and saw that the algorithm failed on most of them,” she says.

The researchers’ new algorithm first traces a 3-D shape’s edges with line segments, then squashes this approximate contour down to 2-D and tries to tile its interior with triangles. Wherever that interior mesh mistakenly crosses over itself, the algorithm modifies that part of the contour, such as by untwisting it or adding finer line segments. The algorithm then regenerates the mesh using the repaired contour and projects it all back onto the 3-D object for a final visibility check.

The team’s innovation was to realize that the problem was with the contour itself. Previously it was unclear that such invalid contours were even possible, so fixes treated the flickering symptoms rather than the cause, Liu says. Grabli, who was not involved in the new research, concurs: “The paper proves why early solutions couldn’t work.”
This article was originally published with the title “Contour Math Revealed” in Scientific American 327, 6, 18 (December 2022)
doi:10.1038/scientificamerican1222-18
ABOUT THE AUTHOR(S)
Lyndie Chiou is a scientist, a science writer and founder of ZeroDivZero, a science conference Web site. Her writing has also appeared in Sky & Telescope. Follow her on Twitter @lyndie_chiou