temp

TAPESTRY: The Art of Representation and Abstraction

Data - Surface Normals


What's it all about?

Polygons are flat pieces cut out of planes, so they have two sides. Let's call them "up" and "down". In itself that's not all that useful, but the closed boundary of a box has an "inside" and an "outside" too. Now, check the image below and notice (with our x-ray vision) that the polygons we see are the polygons whose "outsides" face us. So if the program can figure out which polygons face towards the camera, and which face away, it can decide which ones to include in a rendering and which ones to exclude.

The idea is easy. A "surface normal" is just a unit vector that is perpendicular to a surface at a specific spot. All surface normals of a planar polygon are parallel, while the surfaces normals of a sphere are pointing off in all directions. The amount of curvature of a surface can be expressed in terms of the rate of change in the surface normal. And, of course, the orientation of the surface (which direction it 'faces') can be taken from the surface normal.

Find more on this subject under "Rendering > Hidden Lines > Culling".

Computing the surface normal

The surface normal is a vector, so it is composed of three numbers, describing the (dx,dy,dz) of the vector. The surface normal of the XY-plane (the ground) is just (0,0,1). The three numbers are called the "components" of the vector (sometimes called the "i,j,k componenents"). Some programs actually let you directly control the components of the data's surface normals. Most do a calculation to compute it from the coordinates of the polygon's corners.

The Right Hand Rule

The corners of a given polygon are provided (or can be extracted) as a list. If we go around the polygon in the sequence of the corners, using our right hand, our thumb will be pointing "up" in the direction of the surface normal.

The Cross-product

For a more mathematically rigorous view, we can think of the edges of the polygon as vectors (V1 from vertex 1 to 2, V2 from 2 to 3, etc.) as illustrated here. There will be at least three points, since a triangle is the smalled polygon, so we can always compose two vectors (from 1-2 and from 2-3). If we compute the cross-product of the first into the second (V1 x V2) the resulting vector is in the direction of the surface normal. (Note, see "Data > Problems > Concavities" for discussion of one way this can go horribly wrong.)


CAUTION!

The "culling" process enabled by the use of surface normals ASSUMES that all shapes are solids, that there is both a front and a back to every piece of paper, etc. This is NOT always the case. Many programs that work with meshes and related geometry (NURBS, etc.) create only "single-sided" data--a mesh of polygons in space, all facing one direction (see figure right). In fact, part of the surface shown at right is not visible, but should be. The figure below has been shaded to highlight the portion missing in the first image.

The portion of the surface that we see highlighted at left is actually the "back side" of the surface! Such effects may not always be a problem because (a) some programs ALWAYS render ALL surfaces as two-sided (at a performance cost in complex models), or (b) they can be optionally toggled to do so (in form-Z, look at the bottom of the "Display" menu), or (c) they can be told to make two-sided geometry instead of one-sided surfaces (what form-Z calls "surface solids" because they have two sides, like a solid, but no volume or thickness, like a surface).



Last updated: April, 2014

Valid HTML 4.01 Transitional Valid CSS! [report bug]