5

II

Inexpensive Antialiasing of

Simple Objects

Mikkel Gjøl and Mark Gjøl

5.1 Introduction

In the age of mobile devices, every algorithm gets a second chance. This article

explores a use of discontinuity edge overdraw [Sander et al. 01] for antialiasing

simple objects on 3D-capable mobile devices. The essence of this technique is to

render a “smooth” line on top of aliasing primitive edges in order to cover the

aliasing edge.

The method is trivially useful for rendering objects whose outline is geomet-

rically deﬁned or easily derived. This applies to everything from GUI-elements

to 2D objects positioned in 3D, or even simple 3D-objects—anything where the

outline is deﬁned by geometry. For textured 2D-elements, the usual way to deal

with antialiasing is to use textures with a translucent edge, relying on texture-

sampling to produce a smooth transition at the boundary. While this is a good

solution, it requires careful construction of the mip-chain to avoid artifacts during

scaling or when viewed at steep angles.

5.2 Antialiasing via Smoothed Lines

The founding observation of [Sander et al. 01] was that aliasing in 3D scenes

appears mostly at geometric silhouette edges and crease edges, and so only pixels

along these lines require antialiasing. As these boundaries can be described as

lines, and since line smoothing is widely available in hardware, aliasing can be

reduced by rendering smooth lines on top of the aliasing edges. The main contri-

bution of [Sander et al. 01] was an algorithm to ﬁnd the aliasing edges. For some

applications, the potentially aliasing edges are trivially available, allowing us to

use this method easily. It is worth noting that the resulting algorithm does not

work for translucent objects, and does nothing to improve upon texture-aliasing,

169

170 II Rendering

Figure 5.1. Basic rendering setup.

including aliasing when rendering 2D sprites. Hardware texture ﬁltering mostly

solves this issue however, and is available on the majority of modern mobile GPUs.

Applying the algorithm consists of just two steps (see Figure 5.1):

1. Determine the geometric edges that are causing aliasing.

2. Render aliasing edges as smooth lines.

In the general case it is not trivial to determine which edges cause aliasing, and

we refer readers to the exhaustive discussion in [Sander et al. 01]. In summary,

three sets of geometric edges should be considered for any visible object:

• silhouette edges,

• discontinuous edges, e.g., “hard” edges or texture seams,

• intersection-edges between geometric objects.

While discontinuous edges are typically static for a triangle mesh and can

be precomputed, silhouette edges change with the viewer. Dealing with scenes

constructed entirely of triangles, a geometric approach to ﬁnding silhouette edges

is to locate all edges where one of the adjacent triangles faces towards the viewer

and the other faces away. Computing exact intersections between geometric ob-

jects is computationally expensive, and a solution was not presented in [Sander

et al. 01].

When rendering lines to cover the detected aliasing edges, “over” alpha-

blending is applied (src_alpha,one_minus_src_alpha), and depth buﬀering is

used to achieve correct occlusion. While the rendered lines are potentially sub-

ject to z-ﬁghting, the ﬁghting pixels have the same color as the object on which

they are rendered. Since the main contribution of the smooth lines is outside

the aliasing object, z-ﬁghting causes minimal issues. Rendering multiple layers

of alpha-blended pixels necessitates composition in a back-to-front manner. This

Start Free Trial

No credit card required