Abstract
The spatial anti-aliasing technique for line joins (intersections of the road segments) on vector maps is exclusively crucial to visual experience and system performance. Due to limitations of OpenGL API, one common practice to achieve the anti-aliased effect is splicing multiple triangles at varying scale levels to approximate the fan-shaped line joins. However, this approximation inevitably produces some unreality, and the system rendering performance is not optimal. To circumvent these drawbacks, in this paper, we propose a simple but efficient algorithm which uses only two triangles to substitute the multiple triangles approximation and then renders a realistic fan-shaped curve with alpha operation based on geometrical relation computing. Our experiment shows it has advantages of a realistic anti-aliasing effect, less memory cost, higher frame rate, and drawing line joins without overlapping rendering. Our proposed spatial anti-aliasing technique has been widely used in Internet Maps such as Tencent Mobile Maps and Tencent Automotive Maps.
Introduction
In digital mapping, roads are represented as vector lines. However, rendering where these lines meet—the "line join"—is surprisingly difficult in OpenGL. The native GL_LINES API is too limited for high-quality maps; it doesn't support wide lines, varying widths, or smooth joins. Consequently, developers must construct complex geometry to represent these intersections.
The Problem: Limitations of Triangle Fans
To create a rounded intersection, the industry standard has been to "splice" together many small triangles into a fan shape. This "triangle fan" approach has three major flaws:
- Visual "Unreality": No matter how many triangles are used, the curve remains a series of flat edges rather than a true arc.
- Performance Bottlenecks: Rendering hundreds of road intersections, each composed of many triangles, requires a high number of draw calls and consumes significant GPU memory.
- Overlapping Artifacts: When multiple triangles overlap at an intersection, they can create "overdraw" issues, leading to dark spots or inconsistent color blending.
Proposed Method: Geometric Substitution and Shader Logic
The proposed algorithm shifts the complexity from the geometry stage to the fragment shader stage of the OpenGL pipeline. Instead of a complex fan of triangles, the method uses only two triangles to define the area of the join.
Inside the fragment shader, the algorithm calculates the distance ($d$) from any given pixel (fragment) to a center point ($A$). The shader then applies the following logic:
- If $d < N$ (a threshold), the pixel is fully opaque.
- If $N \le d \le 1$, the shader performs a linear interpolation of the alpha (transparency) value to create a soft, anti-aliased edge.
- If $d > 1$, the pixel is transparent.
This mathematical approach results in a "perfect" arc regardless of zoom level, as the curve is calculated per-pixel rather than approximated by vertices.
Key Results and Real-World Impact
The researchers evaluated the algorithm using 10 road networks in Beijing, China, and integrated it into Tencent Mobile Maps and Tencent Automotive Maps. The method outperformed the traditional approach across all metrics:
- Draw Call Reduction: Average draw calls dropped from 33.7 to 12, a nearly 3x improvement in efficiency.
- Memory Efficiency: Fewer triangles lead to significantly lower vertex cache requirements.
- Visual Quality: The method eliminates "repeated corner drawing," resulting in smoother intersections without jagged edges or overlapping artifacts.
Conclusion
By prioritizing fragment-level mathematics over complex geometry, this approach provides a lightweight, production-ready solution for high-quality vector map rendering. While currently focused on rounded joins, the underlying logic of geometric substitution offers a promising path for optimizing other map rendering primitives on mobile and automotive hardware.
Summary updated