Dip when joining blended antialiased lines
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The visible "dip" at the join between blended antialiased lines is usually a coverage or blending artifact, not a mysterious bug in line math. It appears when two line segments are rendered separately, each with softened edge pixels, and the join region ends up darker or lighter than the rest of the stroke because the coverage and alpha contributions do not combine the way your eye expects.
Why the join looks wrong
Antialiasing works by assigning partial coverage to edge pixels. A standalone line segment looks smooth because pixels near the edge get intermediate intensity values rather than a hard on-off decision.
The problem appears at joins because the renderer is no longer dealing with one simple segment. It is combining two independently antialiased segments whose edge coverage in the join area may:
- overlap too little, causing a visible gap or dark dip
- overlap too much, causing a bright lump
- blend inconsistently because of straight-alpha composition or gamma issues
So the artifact is often a mismatch between geometry coverage and blending math.
The root cause is often separate-segment rendering
If you draw two connected line segments independently, each segment computes antialiasing without global awareness of the join. That means the shared corner is treated as two separate edge problems rather than one continuous stroke.
This is why polyline rendering with proper join geometry usually looks better than drawing many isolated antialiased lines end to end.
Render joins as geometry, not as accidental overlap
The best fix is usually to construct proper join geometry:
- miter joins for sharp corners
- bevel joins for clipped corners
- round joins for smoothed corners
That turns the polyline into one coherent filled shape. The antialiasing then applies to the outer stroke boundary instead of trying to reconcile two separate blended segments.
In other words, draw the stroke, not the pieces.
Premultiplied alpha often helps
Straight alpha blending can exaggerate edge artifacts, especially when multiple partially covered pixels are composed repeatedly. Premultiplied alpha tends to behave more predictably for layered antialiased rendering because color is already weighted by alpha before composition.
If your line renderer is blending partially covered samples with straight alpha, the join dip may be partly a compositing issue rather than only a geometric one.
Gamma-correct blending also matters
Even when coverage values are reasonable, blending in a nonlinear color space can make the join appear darker than expected. This is a classic graphics issue: mathematically plausible interpolation can still look wrong if it is done in the wrong color space.
That means a join dip can persist even after geometry is improved, especially in high-contrast strokes.
A simplified coverage example
Imagine two segments meeting at an angle. If each segment gives a join pixel 0.4 coverage and the renderer blends them independently in a non-ideal way, the visual result may not match the 0.8 coverage your eye expects from one continuous stroke.
The exact formula depends on the renderer, but the practical lesson is stable: partial coverage at joins needs coordinated treatment.
Better strategies than post-fixing pixels
The most reliable fixes usually happen earlier in the pipeline:
- tessellate the full polyline with explicit joins
- use multisampling or supersampling on the stroke shape
- use premultiplied alpha
- use gamma-aware blending when appropriate
Trying to patch the dip after rasterization is usually a weaker approach than fixing how the join is represented in the first place.
Common Pitfalls
- Rendering connected segments independently and expecting the join to look like one continuous stroke.
- Treating the artifact as purely a color problem when the geometry itself is incomplete.
- Ignoring the difference between straight-alpha and premultiplied-alpha composition.
- Forgetting that gamma-incorrect blending can make join artifacts look worse.
- Post-processing pixels instead of generating proper join geometry for the stroke.
Summary
- The join dip is usually a coverage and blending artifact at connected antialiased segments.
- Independent segment rendering is a common cause.
- Proper stroke join geometry is usually the most effective fix.
- Premultiplied alpha and gamma-aware blending can improve the result further.
- The best long-term solution is to render the stroke as one shape instead of blending disconnected pieces.

