How does hardware tessellation work?

I would just like someone to explain in relativly clear terms how hardware tessellation works considering it is the new buzzword with DX11.

Thanks.

I'll give you the "simple" version and let someone else fill you in on the details if you're interested :).

There are basically two ways to model 3D objects. The first is one you don't see a lot of in games, and it involves using precise, mathematically defined curves to define the shape of an object. Using this method, the level of detail is (practically speaking) "infinite". Take a cylinder for example. A cylinder can be defined in very simple mathematical terms: all you really need to know is the radius at the ends and the length of the cylinder. In terms of the geometry, this information is all we need in order to render the cylinder in a 3D scene. Moreover, we can easily scale the cylinder to make it larger or smaller; all we need to do is maintain the ratio of the length to the radius. We can use the same formulas to represent the geometry, but with different parameters. We can represent a torus ("donut" shape) easily as well: we simply need to know the inner radius and outer radius. From that, we can compute the diameter (and therefore the radius) of the donut's body (the "cake") by subtracting the inner radius from the outer radius. The circular body wraps along the arc defined by the inner radius. This type of 3D definition is nice because it is relatively simple (resulting in a small model file), and there is no significant limit to the level of detail. The downside is that today's video hardware isn't designed to process these types of models efficiently (if at all).

The other way is to combine simple geometry to approximate the shape we want to represent. We do this with a process called tessellation. We could tessellate a cylinder by breaking it down into more primitive shapes: two circles and a series of long rectangles, which wrap around the outer edge. The circles can be further broken down into many tiny triangles, as can the rectangles along the edge. The end result is a model comprised only of triangles: Or, for the torus: The good news is that video hardware is optimized to handle this sort of geometry. Today's GPUs have no trouble churning out tons and tons of triangles every second. However, there's an obvious problem: we are trying to represent curved surfaces using shapes that have flat edges. In order for our cylinder to look like a cylinder (as opposed to a cube), we want to break it down into a lot of little triangles. Well, how many do we want? It depends. What kind of hardware will be used to render the scene? Faster hardware can render triangles faster than slower hardware, producing faster frame rates. There are other factors to consider, like how many other objects will be present in the scene, and how complex will they be? In games, there are typically a lot of objects in a given scene. Moreover, objects may travel through different scenes, each with different levels of visual complexity. It's hard to figure out the level of detail to use when we tessellate our models.

Another problem is that of geometric complexity: whereas a curve-based definition of a cylinder is very simple (radius and length), a tessellated definition likely combines hundreds of triangles, each of which needs to be defined independently. Consequently, our tessellated model file will be much, much larger. Let's say we have a mathematically defined model of something complex, like a person. Our model file may be a mere 24kb in size. Well, once that model is tessellated, the resulting file could be 24mb (24,000kb). That's quite a difference.

Hardware tessellation takes advantage of geometry shaders to perform hardware-assisted tessellation in real time (or in nearly real time). Essentially, it provides a mechanism to take a mathematically defined 3D model and transform it into a tessellated format that the video card can render efficiently. Traditionally, game developers have performed tessellation at the studio and shipped the tessellated models with the game. Hardware tessellation allows us to defer this process until the game is actually running on the player's computer. This has some serious benefits:

1. The size of the game's 3D content decreases dramatically (fewer discs or smaller downloads, and less hard disk space required).

2. We can control the level of detail in real time. Are we running on a cutting-edge beast of a gaming machine? If so, we can tessellate using a very high level of detail. Are we running on an old laptop with integrated graphics? No problem; we can simply reduce the level of detail to boost performance.

So that's the gist of it. It's probably not 100% accurate, as I am not a 3D programmer, but that should give you a better idea of what all the fuss is about :).

Cheers,
Mike

• Wow... brilliant! Longest 'overview' I've ever read :P
– InfernoZeus
Jul 14 '10 at 23:27
• There's one other thing that determines the level of tessellation required - size of the object on screen. Runtime tessellation lets you have the correct level of detail everywhere, without creating multiple versions of each object.