Vector graphics includes both filled and stroked paths as the main primitives. While there are many techniques for rendering filled paths on GPU, stroked paths have proved more elusive. This paper presents a technique for performing stroke expansion, namely the generation of the outline representing the stroke of the given input path. Stroke expansion is a global problem, with challenging constraints on continuity and correctness. Nonetheless, we implement it using a fully parallel algorithm suitable for execution in a GPU compute shader, with minimal preprocessing. The output of our method can be either line or circular arc segments, both of which are well suited to GPU rendering, and the number of segments is minimal. We introduce several novel techniques, including an encoding of vector graphics primitives suitable for parallel processing, and an Euler spiral based method for computing approximations to parallel curves and evolutes.
Click and drag the control points (black circles) to reshape the cubic Bézier curve below. The source curve is first approximated by Euler spiral segments that satisfy an error tolerance (shown as colorful strokes). The two parallel curves of each Euler spiral segment are then lowered to line or arc segments (shown in dark green).
@article{LevienUguray2024,
author={Raphael L. Levien and Arman Uguray},
title={GPU-friendly Stroke Expansion},
doi={10.1145/3675390},
journal={Proceedings of the ACM on Computer Graphics and Interactive Techniques},
year={2024},
volume={7},
number={3},
url={https://linebender.org/gpu-stroke-expansion-paper}
}