Dashed stroked paths are a widely-used feature found in the vast majority of vector-drawing software and libraries. They enable, for example, the highlighting of a given path, such as the current selection, in drawing software or distinguishing curves, in the case of a scientific plotting package. This paper introduces a shader-based method for rendering arbitrary dash patterns along any continuous polyline (smooth or broken). The proposed method does not tessellate individual dash patterns and allows for fast and nearly accurate rendering of any user-defined dash pattern and caps. Benchmarks indicate a slowdown ratio between 1.1 and 2.1 with an increased memory consumption between 3 and 6. Furthermore, the method can be used for solid thick polylines with correct caps and joins with only a slowdown factor of 1.1.
Full-Text PDF (3.3 MB) BibTex (414 B) Supplemental MOV Video Results (86.4 MB) Python Source Code (216 kB)
Citation: Nicolas P. Rougier, Shader-Based Antialiased, Dashed, Stroked Polylines, Journal of Computer Graphics Techniques (JCGT), vol. 2, no. 2, 105--121, 2013
Available online http://jcgt.org/published/0002/02/08/
Copyright: © 2013 Rougier
Received: 2013-09-07; Recommended: 2013-10-19; Published: 2013-12-06