TruForm

TruForm TruForm

17.12.2012 Views

ATI TECHNOLOGIES WHITE PAPER TRUFORM Introduction Visit ATI.com The graphical quality of computer games has improved by leaps and bounds from the early days of Doom to today’s Quake III and is on track to rival the quality of movie special effects in a few years. Despite recent improvements, most game objects—especially characters—still do not appear very lifelike. They still tend to look like a collection of geometric blocks with textures painted on them. This blocky computer generated world is generally a result of limited bus and memory bandwidth. Objects in virtual worlds, like the head in Figure 1 below, are represented by groups of connected triangles, which collectively form the surface of a virtual object. Each triangle in a virtual object is defined by 3 vertices and 3 normals. As developers create more detailed and realistic 3D virtual worlds, the number of triangles required to represent each scene increases at a tremendous rate. This presents two problems for the graphics system: • Increased bandwidth required to transfer the triangles to the GPU • Increased memory required to store more triangles TRUFORM, a new technology developed by ATI, overcomes these problems to deliver the smoothest and most natural images ever seen on a PC. This document describes how TRUFORM works and what benefits it can provide to application developers and end-users. 3D Model (represented by triangles) TRUFORM capable GPU Traditional GPU TRUFORM Transformed & Lit Triangles Figure 1: TRUFORM: On the left is the input triangle geometry, which is compatible with any renderer. On the top right is shown the result of using TRUFORM; note the realistic highlights and smooth silhouette. On the bottom right, we show that the input model is still compatible with traditional GPUs.

ATI TECHNOLOGIES<br />

WHITE PAPER<br />

TRUFORM<br />

Introduction<br />

Visit ATI.com<br />

The graphical quality of computer games has improved by leaps and bounds from the early days of Doom to<br />

today’s Quake III and is on track to rival the quality of movie special effects in a few years. Despite recent<br />

improvements, most game objects—especially characters—still do not appear very lifelike. They still tend to<br />

look like a collection of geometric blocks with textures painted on them. This blocky computer generated<br />

world is generally a result of limited bus and memory bandwidth.<br />

Objects in virtual worlds, like the head in Figure 1 below, are represented by groups of connected triangles,<br />

which collectively form the surface of a virtual object. Each triangle in a virtual object is defined by 3 vertices<br />

and 3 normals. As developers create more detailed and realistic 3D virtual worlds, the number of triangles<br />

required to represent each scene increases at a tremendous rate. This presents two problems for the<br />

graphics system:<br />

• Increased bandwidth required to transfer the triangles to the GPU<br />

• Increased memory required to store more triangles<br />

TRUFORM, a new technology developed by ATI, overcomes these problems to deliver the smoothest and<br />

most natural images ever seen on a PC. This document describes how TRUFORM works and what benefits<br />

it can provide to application developers and end-users.<br />

3D Model<br />

(represented by<br />

triangles)<br />

TRUFORM capable GPU<br />

Traditional GPU<br />

TRUFORM<br />

Transformed & Lit<br />

Triangles<br />

Figure 1: TRUFORM: On the left is the input triangle geometry, which is compatible with any renderer. On the top right is shown<br />

the result of using TRUFORM; note the realistic highlights and smooth silhouette. On the bottom right, we show that the input<br />

model is still compatible with traditional GPUs.


Bandwidth<br />

In order for the GPU to perform the required vertex shading calculations on this increased number<br />

of triangles, the vertices of every triangle must be read from memory. This vertex data competes<br />

with textures, shaders and other data for space in local graphics memory (on the physical card)<br />

and AGP memory (across the AGP bus in system memory). Graphics memory bandwidth is<br />

limited by memory technology and is often a performance bottleneck. This problem is made even<br />

worse when the GPU has to fetch data from the system memory side of the AGP bus. By<br />

converting 3D models with low polygon counts to smoother, high polygon count versions in the<br />

graphics chip (a process known as tessellation), TRUFORM effectively increases the memory<br />

bandwidth available to the GPU.<br />

Memory Usage<br />

As mentioned above, geometry data competes with other data like textures and shaders for space<br />

in memory. This ultimately limits how much variety can exist in a virtual environment. For<br />

example, to conserve memory, a game developer may have to create one tree model with many<br />

polygons and replicate it in multiple locations to make a forest. This repetition is often visible to<br />

the user and reduces realism. With TRUFORM, the developer can create multiple low-polygon<br />

trees and use N-Patches when rendering to effectively decompress them. This makes better use<br />

of the available memory and increases variety in the world, which enables greater immersion of<br />

the user.<br />

N-Patches (also known as PN Triangles) are a type of Higher Order Surface, a new feature<br />

introduced in DirectX ® 8 and OpenGL ® that allow the transfer of a reduced amount of data across<br />

the AGP bus, while the majority of vertices required for high detail geometry are generated inside<br />

the GPU. As a result of sending a smaller amount of data across the AGP bus, there is also a<br />

saving in graphics memory usage.<br />

HIGHER ORDER SURFACES<br />

Whereas standard polygonal surfaces are made up of flat planes, Higher Order Surfaces are<br />

curved. A first order surface, such as a flat triangle, is based on straight lines defined by the<br />

linear equation y = ax + b. A second order surface contains one bend (parabolic in shape), and is<br />

based upon the quadratic curve equation y = ax 2 + bx + c. A third order surface has two bends<br />

(S-shaped) and is based upon the cubic curve defined by y = ax 3 +bx 2 + cx +d. See Figure 2.<br />

1 st order (linear)<br />

2 nd order (quadratic)<br />

3 rd order (cubic)<br />

Figure 2: Different classes of curves with increasing order.<br />

TRUFORM White Paper - Page 2


A slight variation of these types of curves is the Bezier curve, which provides the basis of many<br />

higher order surface methods. A Bezier curve is a special type of curve described by control<br />

points. A control point has local control over its portion of the curve. If a control point is moved,<br />

the part of the curve closest to the control point is affected the most. A cubic Bezier curve has<br />

four control points: one for each endpoint and 2 inside the curve. See Figure 3.<br />

Figure 3: A cubic Bezier curve described by its 4 control points.<br />

The concept of the Bezier curve can be extended to construct a Bezier surface, in which the<br />

surface curvature is also described using control points.<br />

TYPES OF HIGHER ORDER SURFACES<br />

The two types of Higher Order Surface methods supported in DirectX ® 8 are Polynomial Surfaces<br />

and N-Patches. Although, both approaches use Bezier surfaces, they are implemented in<br />

significantly different ways. Polynomial Surfaces require that every patch must be created by the<br />

developer, rather than being generated in the graphics processor. This means that models created<br />

with Polynomial Surfaces will not be compatible with existing hardware. Polynomial Surfaces are<br />

also computationally expensive, which can lead to degradation in performance.<br />

Figure 4: Polynomial surfaces. Note the large number of control points required to define the surface, the additional<br />

driver setup step, and the game art’s lack of compatibility with older graphics processors.<br />

TRUFORM White Paper - Page 3


N-Patches, on the other hand, generate every curved surface in the graphics processor, allowing<br />

for complete compatibility with all existing hardware. As a result, N-Patches offer the most<br />

efficient and practical Higher Order Surface implementation, and form the basis of TRUFORM.<br />

N-PATCHES<br />

N-Patches require only the vertices and normals at the vertices of flat triangles (see Figure 5<br />

below) to create detailed and visually impressive models, while maintaining total backward<br />

compatibility with existing hardware and APIs.<br />

Figure 5: N-Patches. Note how the input data consists of just three vertices and three vertex normals, and how the<br />

game art is compatible with any graphics processor.<br />

As a result, N-Patches allow for a high level of scalability, meaning the number of triangles in a 3D<br />

model can be scaled according to the available graphics hardware. Software developers usually<br />

create low triangle count models so that their games can run well on the low-end systems that<br />

make up the majority of the market, and never create high detail models for users with more<br />

powerful systems. N-Patches can take these low-polygon models and generate smooth, highly<br />

detailed models.<br />

Using the N-Patch technique, the graphics processor converts every flat triangle into a curved<br />

triangular patch. Using the mathematics of Bezier surfaces, a curved triangular surface can be<br />

described with a small amount of data. Once every flat triangle is converted to a curved surface,<br />

the model is then tessellated into triangles again, so that they can be transformed and lit by the<br />

Transform and Lighting engine of the graphics processor. Although the final model is still<br />

described with triangles, for a given input the number of triangles describing a model is greatly<br />

increased, resulting in a major improvement in the model silhouette and model lighting.<br />

TRUFORM White Paper - Page 4


Generating Control Points<br />

The control points along each side of a triangular N-Patch are generated from its vertices and<br />

two additional points evenly spaced along each triangle edge. Each point adjacent to a vertex<br />

is projected into the plane defined by the normal at that vertex, creating a new control point.<br />

The direction of a normal at a vertex is a measure of the curvature of the surface at the vertex.<br />

Figure 6 demonstrates the creation of one these control points.<br />

Figure 6: Construction of an edge control point: a point is<br />

projected into the plane defined by the vertex normal N1<br />

giving us a control point b210<br />

This is then repeated around the original triangle, giving a total of six new control points. So far<br />

we have 9 control points along the edges of the triangular patch. The last control point is placed<br />

in the center of the surface, and is determined through averaging the other nine edge control<br />

points. See Figure 7.<br />

Figure 7: The 10 control points of the N-Patch define the<br />

curvature of the surface.<br />

TRUFORM White Paper - Page 5


Once the 10 control points of the N-Patch are generated, the curved surface is tessellated into a<br />

large number of smaller triangles. Although the curvature of every N-Patch is defined with 10<br />

control points, the developer can easily specify the level of tessellation, which determines the<br />

number of smaller triangles generated. See Figure 8.<br />

Figure 8: Different levels of tessellation as specified by the developer<br />

(top) and the visual effect of tessellation (with two light sources) on an<br />

octahedron (bottom). The number of control points describing the<br />

actual curvature of the surface is always 10, regardless of the level of<br />

tessellation. Also note that the tessellated triangles at the top<br />

represent just one of the eight faces of the octahedron.<br />

TRUFORM White Paper - Page 6


Lighting N-Patches<br />

TRUFORM not only greatly enhances the smoothness of 3D models, but also provides models<br />

with highly detailed lighting effects. This greatly enhances the visual quality of scenes by<br />

providing realistic highlights on the surface of curved objects.<br />

The surface normals of 3D objects are used to mathematically compute the lighting of all surfaces.<br />

A surface normal is a unit vector that points perpendicular to (i.e. directly outward from) a surface.<br />

The two general types of lighting or shading methods used in 3D graphics are Gouraud shading,<br />

and Phong shading. Gouraud shading uses a normal at each vertex to light a model, while Phong<br />

shading uses a normal for every single pixel to light the model. The increase in the number of<br />

normals in Phong shading gives the lighting equation many more samples to work with, resulting<br />

in much better lighting effects.<br />

The N-Patch lighting technique uses two different algorithms to generate normals. The algorithm<br />

used depends upon the complexity of the curved surface. When the curvature of a patch is<br />

relatively simple, the vertex normals can be linearly interpolated (i.e. blended) across the entire<br />

curved surface. This algorithm is called linear normal generation. When the curvature of a<br />

triangular patch is more complex, a quadratic Bezier surface can be used to describe the variation<br />

of normals across the surface of the patch. A quadratic triangular surface is described with six<br />

control points: three for the vertices, and one for each edge mid-point. Each mid-edge control<br />

point is generated by averaging the vertex normals at either end of the edge, and reflecting the<br />

averaged normal across the plane perpendicular to the edge, as shown in Figure 9. This is<br />

repeated on the other two triangle edges to give three new mid-edge control points, for a total<br />

of 6. These control points (see Figure 10) are then used to determine the normals of any new<br />

vertices created when the N-patch is tessellated.<br />

Figure 9: Generation of mid-edge control points for<br />

quadratically varying normals: the average of N1 and<br />

N2 is reflected across the plane perpendicular to the<br />

edge to obtain n110.<br />

TRUFORM White Paper - Page 7


Figure 10: Control points generated for the<br />

normal component of N-Patches.<br />

As a result of using N-Patch generated normals, the quality of lighting is improved from the<br />

Gouraud shading level (before implementing N-Patches) to a near-Phong shading quality level.<br />

The quadratic normal generation process requires slightly more computation time than the linear<br />

case, but offers even greater improvements in lighting effects. The normal generation method<br />

used by developers will depend on the required performance specifications.<br />

CONCLUSION<br />

Although there are a variety of Higher Order Surface methods available, the N-Patch surfacing<br />

technique provides a great looking solution that for the first time is actually practical for game<br />

developers to use. N-Patches provide developers with the capability to generate smooth and<br />

realistically lit surfaces with a minimal cost in model preparation, code modification and rendering<br />

performance.<br />

With just a triangle’s vertices and vertex normals, the N-Patch surfacing method is able to<br />

generate three-sided cubic Bezier patches, accompanied by a set of varying (linear or quadratic)<br />

normals, giving computer game players smooth, realistically lit models. See Figure 11 for more<br />

examples of image improvements using N-Patches.<br />

The advantages of the N-Patch technique are:<br />

• Improved memory and bandwidth efficiency<br />

• Greatly improved character silhouettes by smoothing out surfaces.<br />

• Highly realistic lighting of model surfaces.<br />

• Complete backward compatibility, even with hardware that does not support N-Patches.<br />

• Easy to implement in both future and current games.<br />

• N-Patches do not require custom model design, unlike polynomial surfaces.<br />

TRUFORM White Paper - Page 8


Figure 11: Models from Quake as provided by id software (left) and their<br />

TRUFORM enhanced counterparts (right). None of these characters were<br />

authored with TRUFORM in mind.<br />

References<br />

1. Alex Vlachos, Jörg Peters, Chas Boyd and Jason L. Mitchell. Curved PN Triangles.<br />

ACM Symposium on Interactive 3D graphics, 2001, pp. 159-166.<br />

2. Brian Sharp. Implementing Curved Surface Geometry. www.gamasutra.com, May 30, 2000.<br />

3. Brian Sharp. Subdivision Surface Theory. www.gamasutra.com, April 11, 2000.<br />

4. Dean Macri. Using NURBS Surfaces in Real-time Applications. www.gamasutra.com, November 17, 1999.<br />

5. Gabe Kruger. Curved Surfaces using Bezier Patches. www.gamasutra.com, June 11, 1999.<br />

6. David Nalasco. DirectX 8.0 and Radeon Graphics Processors White Paper. ATI Technologies, 2001.<br />

TRUFORM White Paper - Page 9


ATI TECHNOLOGIES INC.<br />

33 Commerce Valley Drive East<br />

Markham, Ontario, Canada L3T 7N6<br />

Telephone: (905) 882-2600 (press #4)<br />

Facsimile: (905) 882-2620<br />

www.ati.com<br />

ATI TECHNOLOGIES<br />

SYSTEMS CORP.<br />

2805 Bowers Avenue<br />

Santa Clara, CA 95051-0917<br />

Telephone: (408) 845-6500<br />

Facsimile: (408) 845-6301<br />

ATI TECHNOLOGIES<br />

(EUROPE) GMBH<br />

Keltenring 13<br />

D-82041 Oberhaching, Germany<br />

Telephone: +49 89 665 15 -0<br />

Facsimile: +49 89 665 15 -300<br />

ATI TECHNOLOGIES<br />

(JAPAN) INC.<br />

Kojimachi Nakata Bldg 4F<br />

5-3 Kojimachi, Chiyoda-Ku<br />

Tokyo 102-0083, Japan<br />

Telephone: +81 35275-2241<br />

Facsimile: +81 35275-2242<br />

OFFICIAL ATI REP.<br />

AMI TECHNOLOGIES CORP.<br />

8F, 148, Sec. 1, Hsin Sheng S. Rd.<br />

Taipei, Taiwan, R.O.C.<br />

Telephone: 886-2-2396-7711<br />

Facsimile: 886-2-2351-3030<br />

Copyright 2001, ATI Technologies Inc. All rights reserved. Features, performance and specifications may vary by operating environment and are subject to change without notice. Products may not be exactly<br />

as shown. Features will vary depending on configuration used. Printed in Canada. May 2001.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!