generating a smooth voxel-based model from an irregular ... · original polygon mesh. in a process...

11
Original articles Generating a smooth voxel-based model from an irregular polygon mesh Daniel Cohen, Arie Kaufman, and Yingxing Wang Department of Computer Science, State University of New York at Stony Brook, Stony Brook, NY 11794-4400, USA A method for generating a smooth voxel- based model from an arbitrary polygon mesh is presented. It is based on a poly- gonal subdivision process which takes an irregular polygon mesh as input and cre- ates a finer and smoother mesh. The mesh is recursively refined down to or close to the voxel level, and then voxelized (digitized) into a voxel-based representa- tion. A local subdivision approach has been developed in order to ease the com- putationally expensive subdivision process. The voxelization of the mesh maintains topological and fidelity requirements which are pre-defined and application de- pendent. Key words: Voxelization - Polyhedral subdivision - Smoothing Interpolation Volume graphics - Volume visualiza- tion - 3D scan conversion - Volume syn- thesis - Voxelization Correspondence to: A. Kaufman 1 Introduction Modeling 3D objects by meshes of connected polygonal facets is a way of successfully represent- ing objects consisting of large flat parts, such as a building wall or a table top, but only an approx- imation for curved objects. The quality of the model of a curved object is increased by using a large number of small polygons. A polygonal subdivision process can smooth the geometry by fairing the rough edges and sharp corners between adjacent polygons. This process introduces a new, larger mesh of smaller polygons which better ap- proximates the real smooth object. However, us- ing a very fine mesh in conventional polygon- based graphics is expensive with respect to the display time. Instead, applying interpolation of the colors (Gouraud shading) or the normals (Phong shading) creates the appearance of a smooth surface. However, this approach greatly increases the rendering cost and fails to convey the illusion of smoothness at the edges and the silhouettes. A different modeling method uses a voxel-based approach, where the 3D objects are represented by a 3D raster of voxels. Each such voxel has a numeric value associated with it which repres- ents some measurable properties of a small cube of the real object. The voxels are either derived from discrete samples of the physical object, gen- erated by a simulation model, or synthesized from a geometric model in a process called voxelization or 31) scan conversion [-3, 6-8, 11]. The conversion of an object from its analytical geometric repres- entation into a discrete form (i.e., the voxelization) is decoupled from the rendering and can be per- formed in a preprocessing stage. This suggests that view-independent attributes (e.g., texture) can be precomputed during voxelization, stored with- in the voxel, and be readily accessible for speeding up the rendering [15]. Unlike the polygon-based approaches, in the voxel-based approach the space size is constant and the rendering is insensi- tive to the model complexity [9]. These and other advantages of the voxel-based representation have been attracting traditional surface-based ap- plications, including CAD models and terrain models for flight simulators [9]. Our goal has been to develop a voxelization method for models given as irregular polygon meshes for voxel-based applications, such as the Hughes Aircraft voxel-based flight simulator RealScene [14]. By first smoothing the polygon The Visual Computer (1994) 10:295-305 Springer-Verlag 1994 295

Upload: others

Post on 16-Jul-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

Original articles

Generating a smooth voxel-based model from an irregular polygon mesh

Daniel Cohen, Arie Kaufman, and Yingxing Wang

Department of Computer Science, State University of New York at Stony Brook, Stony Brook, NY 11794-4400, USA

A method for generating a smooth voxel- based model from an arbitrary polygon mesh is presented. It is based on a poly- gonal subdivision process which takes an irregular polygon mesh as input and cre- ates a finer and smoother mesh. The mesh is recursively refined down to or close to the voxel level, and then voxelized (digitized) into a voxel-based representa- tion. A local subdivision approach has been developed in order to ease the com- putationally expensive subdivision process. The voxelization of the mesh maintains topological and fidelity requirements which are pre-defined and application de- pendent.

Key words: Voxelization - Polyhedral subdivision - Smoothing Interpolation

Volume graphics - Volume visualiza- tion - 3D scan conversion - Volume syn- thesis - Voxelization

Correspondence to: A. Kaufman

1 Introduction

Modeling 3D objects by meshes of connected polygonal facets is a way of successfully represent- ing objects consisting of large flat parts, such as a building wall or a table top, but only an approx- imation for curved objects. The quality of the model of a curved object is increased by using a large number of small polygons. A polygonal subdivision process can smooth the geometry by fairing the rough edges and sharp corners between adjacent polygons. This process introduces a new, larger mesh of smaller polygons which better ap- proximates the real smooth object. However, us- ing a very fine mesh in conventional polygon- based graphics is expensive with respect to the display time. Instead, applying interpolation of the colors (Gouraud shading) or the normals (Phong shading) creates the appearance of a smooth surface. However, this approach greatly increases the rendering cost and fails to convey the illusion of smoothness at the edges and the silhouettes. A different modeling method uses a voxel-based approach, where the 3D objects are represented by a 3D raster of voxels. Each such voxel has a numeric value associated with it which repres- ents some measurable properties of a small cube of the real object. The voxels are either derived from discrete samples of the physical object, gen- erated by a simulation model, or synthesized from a geometric model in a process called voxel izat ion or 31) scan conversion [-3, 6-8, 11]. The conversion of an object from its analytical geometric repres- entation into a discrete form (i.e., the voxelization) is decoupled from the rendering and can be per- formed in a preprocessing stage. This suggests that view-independent attributes (e.g., texture) can be precomputed during voxelization, stored with- in the voxel, and be readily accessible for speeding up the rendering [15]. Unlike the polygon-based approaches, in the voxel-based approach the space size is constant and the rendering is insensi- tive to the model complexity [9]. These and other advantages of the voxel-based representation have been attracting traditional surface-based ap- plications, including CAD models and terrain models for flight simulators [9]. Our goal has been to develop a voxelization method for models given as irregular polygon meshes for voxel-based applications, such as the Hughes Aircraft voxel-based flight simulator RealScene [14]. By first smoothing the polygon

The Visual Computer (1994) 10 : 295-305 �9 Springer-Verlag 1994 295

Page 2: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

mesh, and then voxelizing it during a preprocess- ing stage, we take full advantage of the insensitiv- ity of voxel-based rendering to the object's shape complexity. In this paper we present a preprocess- ing technique that smoothes an irregular polygon mesh by a subdivision process and then converts the refined mesh into voxels, without any user intervention. The polygons need not be planar, and their vertices do not have to form a topologi- cal rectangular mesh. The refinement process can be applied all the way down to the voxel level or close to that level, hence creating a fine mesh with voxel granularity. The refined and smoothed mesh is then converted into its voxel-based form and stored as a 3D raster for later use by a voxel- based rendering mechanism. A subdivision process can generate a surface that interpolates the original mesh vertices or approximates them by fitting a smooth surface. The early work by Catmull and Clark [2J, which recursively generates B-spline surfaces on arbit- rary topological meshes, has the limitation of be- ing unable to interpolate the data points. Under the constraint of mesh rectangularity (i.e., every interior vertex has four adjacent polygon faces and every polygon face is four-sided), Barsky and Greenberg [1] reduce the problem to determining an appropriate set of B-spline control vertices by solving simultaneous linear equations. If a voxel-based surface is desired or required, one can then employ an incremental voxelization al- gorithm of Bezier or B-spline patches [7], which guarantees proper control over voxel con- nectivity. However, the constraint of rectangular- ity of the data points and the limitation on the interpolation are undesirable. Here we have adapted and extended a polygonal subdivision method [5, 12, 13], which can be applied to an irregular (non-rectangular) mesh. The next section introduces the subdivision mech- anism, describes how to deal with the mesh boundary problems, and suggests how to achieve interior interpolation and interpolation of the whole set of data points. A subdivision method exhibits an inherent prob- lem of exponential time and space complexities. The problem becomes even more severe in our case since many iterations have to be carried out before the mesh reaches the voxel resolution. We have thus developed a local subdivision mechan- ism that eases the working space problem by

operating locally on submeshes (see Sect. 4). Our technique also accelerates the process when the polygon mesh includes a large variance of poly- gon sizes. The voxelization of a surface is a digitization process in which the discrete voxel-based surface has to preserve the topological properties of the original continuous mesh [3]. In Sect. 5 the condi- tions to guarantee a correct generation of a dis- crete surface are developed. In Sects. 6-8 we dis- cuss the voxelization of polygons, and we end with implementation details in Sect. 9.

2 The subdivision method

2. 1 Mesh smoothing

In Doo-Sabin's polygonal subdivision method, the polygon mesh is recursively subdivided by con- structing on each face a new vertex (termed image- vertex) for every existing old vertex. The i-th im- age-vertex U~ of polygon k is a weighted sum of the vertices I'1/~ k (j = 1, ... , n) of the polygon k:

u , = (1) j = l

where

n + 5 if i= j 4n

% = 3 + 2cos(2rc( i - j ) /n ) if i r 4n

The new polygon mesh is then obtained by con- structing three types of new faces: F-faces, E-faces, and V-faces, corresponding to the old polygon faces, edges, and vertices, respectively (see Fig. 1). The F-face is created by linking the image-vertices U~ (i = 1, ... , n) of polygon k. The E-face is cre- ated by linking the image-vertices of the vertices of the edge on the two incident faces. The V-face is created by linking all image-vertices of a certain vertex. By recursively repeating the subdivision process, the mesh is refined and becomes smoother. Unlike Catmull-Clark's method, Doo-Sabin's subdivi- sion method guarantees that the centroid of each original face lies inside its F-face and thus on the final surface (i.e., the centroid interpolation prop- erty), where the centroid of a face is defined as the

296

Page 3: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

Fig. 1. A refinement step in the subdivision process. The oroginal vertices are black squares and the image-vertices are white circles. The arrows refer to the vertices order with- in the polygon (see Sect. 8)

Fig. 2. A lifted neighborhood of polygons. The original mesh vertices are marked as white circles and lifted vertices are marked as black squares. The U~ are the image-vertices of W~, and Vi is their centroid

average of the vertices of that face. Consequently, this process generates a smoothed surface that is tangent to the original mesh at the centroids of its polygons. This process, which we call smoothing, creates a physically smaller object than the orig- inal one (except for concavities).

2.2 Mesh interpolation

The centroid interpolation property can also be used to construct another analogous set of points, which generates a new surface which when smoothed by subdivision, interpolates (passes through) any prescribed interior vertices of the original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that the centroids of the V-faces of the lifted mesh coincide with the coordinates of the prescribed (old) interior vertices. The lifted mesh is an analogous polygon mesh of the original mesh. Referring to Fig. 2, let the vertices of the old mesh be V/(i = 1, ... ,s) and the vertices of the new lifted mesh be W~ (i = 1, ... , s). The U[ are the image-vertices of the W~ vertices. The centroid of the V-face of W~, after the first subdivision, is forced to be at the same location as vertex Vii. Since the relationship between the centroid of a polygon face and its vertices is linear, and since this is also true for the image-vertex and the vertices of the polygon, the relationship between V/(i = 1, ... ,s) and W/(i = 1, ... ,s) is linear:

V~= ~ 5uW j. (2) j = l

Two sets of vertices have to be considered: one is the set of vertices that are not to be interpolated, and the other is the prescribed set of vertices to be interpolated. It is clear that for the first set, where Vii = Wi, 5u = 1 and air = 0 for i # j. For the sec- ond set, as V~ is the centroid:

mk=l

where m is the number of faces meeting W~. Substi- tute Eq. (1) into Eq. (3) and compare it with Eq. (2.) The coefficient air of each vertex W~ is the sum of all the subdivision coefficients associated with Wj divided by m.

297

Page 4: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

2.3 Boundary control

Polygon meshes can be classified into two groups: closed meshes and open meshes. A closed mesh represents a closed object (a polyhedron) where the surface has no boundary curves. An open mesh has boundary curves, that is, edges with only one adjacent polygon. The boundary curves need special treatment which is called boundary control. Due to the fact that each face of the polygon mesh converges toward its centroid, the subdivision procedure has no control over the boundaries. Nasri [12] suggests a method of ex- tending any n-sided boundary face such that when the modified mesh is subsequently divided, the boundary polygons converge toward the corres- ponding B-spline curves of the boundary vertices. Thus, to achieve boundary interpolation, we com- pute the new boundary control vertices that force the boundary curves of the surface (i.e., the B- spline curves of the new control vertices) to inter- polate the required points. To achieve boundary and interior interpolation at the same time, we first find the control vertices of the B-spline interpolation of the original bound- ary vertices, then replace the boundary vertices by these control vertices, and finally construct the linear equations to achieve interior interpolation (Eq. (2)). Because the equations for lifting that correspond to the boundary vertices are V~ = W~, the new set of vertices does not change the bound- ary vertices. As the subdivided surface boundary is the B-spline curve of the control vertices, the final boundary curve interpolates the original boundary vertices.

3 The algorithm

Figure 3 is a flow diagram of the algorithm. The algorithm generates a smooth voxel-based surface from an arbitrary polygon mesh in three stages: preparation, subdivision, and voxelization. During the preparation stage the original polygon mesh may be modified. By lifting or extending the original polygon mesh, different kinds of inter- polation surfaces can be achieved. If the original mesh is not modified and only the subdivision and voxelization stages are applied, one can construct a higher-order smooth surface over any polyhed-

Potygen mesh contains boundaries

I boundary extension [ ~-

ease computation load �9 ~r2

spliting [ [(localization)

reaching voxel level

I vertex conversion I

t

r

Modified Mesh

[ subdivision]

Re f.med Mesh

I

Smooth Voxel-based Surface

interpolation is required

l further

refinement

I triangulation[ I alignment I

[

] polygon voxelization ]

Fig. 3. The algorithm

ral mesh that passes through the centroids of all polygon faces [13], a process called smoothing. The entire vertex mesh or parts thereof can be lifted during the preparation stage to yield a lifted mesh that, when subdivided generates a surface which interpolates the original vertex mesh or prescribed parts thereof. This process is referred to as interpolation or puffing, as it usually causes the mesh to expand. If the mesh is closed (i.e., a polyhedron), no addi- tional preparation steps are necessary. However, in the case of an open mesh the boundary can be extended, as described before, in a separate and independent preparation step. Boundary control can be employed with or without interior interpo- lation/smoothing, to have the effect of interpola- tion of boundary vertices only, interior vertices only, or both. In the second stage of the algorithm the modified mesh is recursively subdivided to yield a refined mesh. In order to make the subdivision procedure practical, the original mesh is split into local sub- meshes. This step is described in Sect. 4. The refined mesh is finally digitized into a voxel-based form during the voxelization stage. If the mesh is refined down to the voxel level,

298

Page 5: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

a simple vertex voxelization step is applied (see Sect. 5). Alternatively, if the mesh is refined down until the polygon sizes are within an aesthetic tolerance, a polygon voxelization step is applied (see Sect. 6). The actual digitization of the polygon proceeds by two steps: a t r iangulat ion process that guarantees polygon planarity (Sect. 7), and a polygon al ignment process for aligning the nor- mals for the shading (Sect. 8).

4 Local subdivision

Exponential t ime complexity and high memory requirements are the pr imary drawbacks of the Doo-Sabin subdivision method. In this section we introduce a local subdivision mechanism which has been developed in order to cope with the time and space complexities and to make the sub- division down to the voxel level practical. First, we analyze the growth of the number of polygons in the mesh as a function of the number of iterations. Let vi, ez and f~ be the number of vertices, edges, and faces, respectively, at the i-th iteration. An impor tan t proper ty of the subdivi- sion is that the degree of the new vertices is always four. After the first iteration, the only polygons which are not four-sided (4-gons) are the F-faces of a non-four-sided predecessor polygon and the V-faces of original vertices of degree other than four. Thus, excluding the first iteration, all poly- gons are four-sided except those which are dir- ectly derived from non 4-gons. Clearly, after a few iterations the majori ty of the polygons are four- sided. For the sake of simplicity we assume t h a t the original mesh is closed and consists of 4-gons only. Thus, at any time all polygons are 4-gons with vertices of degree four (see Fig. 4). The recursive equations for the number of vertices and edges are:

vi = 4 v i - 1 (4)

ei = 4 e l - 1. (5)

Employing Euler invariant for the number of fa- ces, edges, and vertices in a closed polyhedron:

f i =- ei - vi Jr- 2 (6)

and substituting Eqs. (4) and (5) into Eq. (6) yields:

f = 4 ( e i - t - v i - 1 ) + 2. (7)

Fig. 4a, b. A polygon mesh of four-sided polygons and vertices of degree four: a a local mesh is shown in gray; b after one iteration the new edges are shown as bold lines

F r o m Eq. (6):

e i - 1 - V i - l = f - l - 2. (8)

Substi tuting Eq. (8) into Eq. (7) we get:

f~ = 4f_1 - 6. (9)

Solving the recursive equat ion for f~:

f = 4'(do -- 2) + 2 (10)

which is the number of polygons at the i-th iter- ation. For an arbitrary polygon face F in the original (global) mesh, the loca l m e s h of F is the mesh consisting of F and its adjacent polygon faces (Fig. 4(a)). The local subdivision employs a procedure called l o c a l i z a t i o n , which splits the mesh into a list of local meshes. An unacceptable procedure would create a local mesh for each

299

Page 6: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

original polygon face, causing each polygon to be overlapped by the local meshes of all its adjacent polygons. Although overlapping is unavoidable, it can be reduced by the following heuristics: 1. If any interior polygon face exists that is not covered by any local mesh, create its proper local mesh, and add it to the local mesh list. 2. Repeat step 1 until each interior polygon face is covered by some local mesh. 3. Repeat 1 and 2 for the boundary polygon faces. Creating local meshes first for the interior poly- gons reduces the number of local meshes because interior meshes have more adjacent polygons than the boundary ones. The local subdivision mechanism interleaves localization with subdivi- sion where at any stage of the subdivision local- ization can be applied. The smallest local mesh, provided that all its vertices are adjacent to four faces and the faces are four-sided, has 32 polygons. In the i-th step the number of polygons Pi in the local mesh is s 2, where si = 2si-1 + 1 (see Fig. 4b). Solving the recursive equation for s~, we get:

s,-- 2~(So + 1 ) - 1. (11)

But since So = 3 we get:

Pi = ( 2~4 - 1) 2 < 4i 16. (12)

Fol lowing the assumption of four-sided polygons and vertices of degree four, each interior local mesh covers nine polygons. Thus, a polygon mesh is approximately split into m = Po/9 disjoint local meshes. Let ko < "" _< k,,_l be the number of iterations of subdivision needed for the m local meshes, respectively. When employing local sub- division, from Eq. (12), the total number of poly- gons generated in a voxelization process is less than:

16(4ko + ... + 4kin 1). (13)

According to Eq. (10), without localization it would have been much higher:

4k~-l(P o - 2) + 2. (14)

For each local mesh the number of subdivision steps needed varies adaptively according to the size of the polygons in the local mesh. If the polygon mesh has a large variance of polygon sizes, and no localization is used, all polygons are subdivided kin-1 times; for most of them, many redundant iterations are performed, because most

of the polygons satisfy the conditions for termina- tion in an earlier iteration. Localization, on the other hand, promises a more effective number of iterations to be used for each local mesh. How- ever, from Eq. (13) we learn that localization has a price of a factor of 16. When Po is larger than 18, it is very likely that localization will speed up the process. Furthermore, in case of a small Po, the localization is better applied only after several subdivision iterations. Note that adjacent submeshes subdivided at dif- ferent numbers of iterations will result in cracks in the continuous space, but not in voxel space. The refinement of the two submeshes stops at the granularity of the voxel, and thus the small sub- voxel gap between adjacent polygons is meaning- less. Although time complexity remains exponential in the number of levels and linear in the surface area measured in voxel units, the local subdivision accelerates the process when the polygon mesh includes a variety of polygon sizes. The technique also eases the space problem by operating locally on submeshes. Moreover, the local subdivision lends itself to parallelism and the local meshes can be processed simultaneously and independently on a multiprocessor machine.

5 Vertex voxelization

In order to describe the voxelization stage the following discrete topology terms are defined. Let Z 3 be the subset of the 3D Euclidean space R 3, which consists of all the points whose coordinates are integer. This subset is called the grid for short. A voxel is a closed unit cube whose center is at a grid point. With each grid point we associate a voxel, and a subjective function that maps Z 3, and hence the voxels, to {0, 1}: the non-empty voxels are assigned the value "1" and are called "black" voxels; the others are assigned the value "0" and are called "white" voxels. A white voxel at (x, y, z) has six face-adjacent voxels, while a black voxel has 26 adjacent voxels; 8 share a corner (vertex) with the center voxel, 12 share an edge, and 6 share a face. The black and white sets have different adjacency relations to avoid paradoxes. Other types of adjacency relations for the black and white sets are also possible El01 but are not used in this paper. A path is a sequence of voxels

3 0 0

Page 7: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

i omp r

of the same color (black/white) such that con- secutive pairs are adjacent. A set of voxels A is connected if there is a path between every pair of points in A. A voxelized discrete surface approximating a con- nected continuous surface has to be connected. However, connectivity alone does not fully char- acterize the surface because the voxelized surface may contain discrete holes, termed tunnels, which are not present in the continuous surface. A tunnel is a passage of a white path through a voxel-based black surface. The path (e.g., viewing ray) pen- etrates from one side of the surface to the other where it should not. According to our definition of the white set, a tunnel through a surface introduc- es a real hole (e.g., an empty pixel) in one of the orthographic projections of the voxelized surface. In particular, there exists a polygon whose con- tinuous face area covers that pixel coordinate, but the voxelization process does not set to black the voxel at the coordinate whose projection covers the hole. Let p and q be points in Ra; if the distances along the three coordinates between p and q are all less than or equal to 0.5, then p is said to be close to q. Let t be a point at some integer coordinates. If p is close to t, then round (p) = t. A vertex conversion process converts each vertex in the continuous space to the voxel whose integral coordinates are the closest to that vertex (by a rounding operation of its coordinates) and sets the voxel to black. Let P be a triangle in R 3 whose projection on the x - y plane covers the pixel at (i,j). If the length of every one of the edges of P is less than one, then at least one of the vertices is close to the voxel at (i,j, k) for some k. This implies that the conversion of the vertex to a voxel at (i,j, k) guarantees that the orthographic projection of the voxel covers (i,j). To generalize these conditions to an n-gon, we define the diameter of the polygon to be the maxi- mal length between any two of the polygon vertices. Let P be an n-gon which covers (i,j). If P has a diameter less than one, then the vertex conversion guarantees the coverage of (i,j), be- cause at least one of its vertices must be close to (i,j, k). A one unit diameter is optimal since an n-gon can cover (i, j) while none of its vertices are close to (i,j). The conditions on the triangle are a special case since a triangle has a diameter less than one if and only if every edge is shorter than one.

As described before, each F-face is a reduced size polygon of its predecessor, and the number of edges of any F-face polygon is preserved. The E- faces and the V-faces are always 4-gons (to be more precise, only the V-faces about the original vertex remain non 4-gons if the original vertex has a degree different from four). Thus, as we showed earlier, if the original mesh consists of polygons with no more than four edges, so does the refined mesh. The diameter of an n-gon is easily found by checking the length of the polygon edges and all its diagonals. Specifically for 4-gons, only the length of its two diagonals have to be calculated. The diameters of the polygons in the refined mesh specify whether the refinement process is exhaus- ted and the mesh is ready for a vertex conversion into black voxels. The diameter condition has to be tested on the polygon with the largest area only. This takes advantage of the property that the subdivision process preserves the maximum polygon area. Consequently, at the beginning of the subdivision process, the polygon with the lar- gest area has to be determined and only its dia- meter has to be calculated after every subdivision cycle.

6 Voxelization of polygons

The number of iterations needed to subdivide the mesh all the way down to voxel granularity, in order to meet the diameter condition for the ver- tex conversion, might be too costly. Instead, the process can stop at an earlier stage, depending on the aesthetic or required tolerance of the final image. In this case, each polygon face of the re- fined mesh is scan-converted into its voxel repres- entation using a 3D scan-conversion (voxeliz- ation) algorithm for polygons [3, 8]. Obviously, it is hard to define aesthetic tolerance because it depends on many parameters, such as the shading technique, color, object size, and human factors. In addition, the voxelization of a polygon, even a very small one, is much more complicated than the above vertex conversion process. However, the complexity of the polygon voxelization is con- trasted with the exponential complexity of the subdivision process. As mentioned before, the number of vertices, edges, and polygons are exponential functions of the number of subdivision iterations. Applying

301

Page 8: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

many iterations on an initially large mesh requires a very large memory. The problem is even more severe in our case since most of the memory is occupied by the voxel-based dataset. Using poly- gon voxelization before the polygons have reach- ed the voxel granularity can solve the memory burden and also achieve a substantial speedup. An early stop becomes more effective when the polygon mesh is not uniformly "squarish." For example, if there is a very long rectangular poly- gon, then the F-face polygon corresponding to this polygon degenerates to a line at a certain stage of the subdivision. Obviously, in this case, further subdivision of this polygon down to the voxel level results in many redundant subdivi- sion iterations, which are very space and time consuming. Unfortunately, one cannot avoid polygon meshes with a variety of polygon sizes, such as in many computer-aided geometric design applications. If the original polygon mesh is an approximation of a free-form surface, a unification of the initial polygons by splitting "long" polygons is not ac- ceptable because it distorts the shape of the orig- inal approximated surface. The distortion is obvi- ous. For example, suppose L is split into L1, L2, ... ,Lk. Originally, only the centroid of L is on the surface. After splitting, all the centroids of L1, L2, ... , Lk are on the surface. This usually has the effect of slightly lifting the original surface.

7 Triangulation

The original polygons comprising the mesh need not be planar. Furthermore, the subdivision algo- rithm does not guarantee planarity of the poly- gons generated. For example, if there exists a ver- tex which is incident to several polygons, and the polygons are not coplanar, then the V-face corres- ponding to this vertex does not lie on a plane. To employ the polygon voxelization algorithm, planarity or near planarity of the polygons is required. To solve this problem, every polygon is triangulated before the voxelization, that is, de- composed into triangles. The following practical algorithm for tri- angulating a 3D concave non-planar polygon has been developed. Assume a polygon P with n vertices Vo, V1, ... , V~_I is a simple polygon

(i.e., does not intersect itself), is either convex or concave (i.e., one of its main projection is concave) and is not too distorted (i.e., has a meaningful normal average). The triangulation algorithm chops off one triangle at a time from P and leaves the remainder polygon with one less edge. The algorithm keeps applying this function repeatedly on the remainder polygon until it is reduced into a single triangle. The conditions for chopping a triangle V/_ 1 V/V/+ 1 are: - The corner at V~ is not concave; - No vertices of P other than V~_ 1, V~ and V~+ 1 are contained in the triangular prism c. The tri- angular prism c passes through the three vertices V/_ 1, V~ and V/+ 1 and is parallel to the normal of the triangle V/_ 1 V/V/+ 1. The first condition is checked by comparing the normal direction (i.e., the vertex traversal order) of the triangle with the direction of the average nor- mal of the entire polygon. This condition is intuit- ively equivalent to whether the new edge is inside the polygon or outside. The second condition is checked by determining if any vertex, excluding the triangle vertices, is within the triangular prism.

8 Polygons alignment

The polygon voxelization algorithm supports normal interpolation for Phong shading. Thus, the normal of every polygon has to point towards the "outside" of the object. The correct normal directions can be maintained during the subdivi- sion procedure provided that the original polygon normals are correct in the initial polygon mesh. However, this introduces a lot of bookkeeping in every iteration of the subdivision. Consequently, another approach has been devised, which aligns the normals after the subdivision procedure. Two neighboring polygons have normals point- ing toward the same side of the object if and only if the two lists of vertices are both in the same clockwise or counterclockwise order. Thus, if the common edge of two polygons is traversed in reverse directions, the two polygons are coor- dinated in their normal direction (see Fig. 1). Otherwise, one of the polygon normals has to be reversed, that is, the order of the vertices of one of the polygons has to be reversed. The normal alignment process first aligns the normal of the

302

Page 9: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

first polygon to the proper direction and then corrects the rest of the polygons accordingly by traversing the edges of the already aligned poly- gon and aligning neighbor after neighbor.

9 Implementation

The algorithm for generating a smooth voxel- based surface from an irregular polygon mesh has

been implemented in C on a Sun workstation, in the framework of the HighRes (high resolution) Cube software. This work is part of a long-term research project at Stony Brook whose goals in- clude the generation of smooth synthetic objects for out-of-the-window views in a flight simulator such as the Hughes Aircraft ReatScene voxeI- based flight simulator (see figures in [9, 14]). At present, the input specification is given through a display file that consists of the polygon

5 6 7

8 9 lo

11

Fig. 5. The original polygon mesh of a toy jack

Fig. 6. Voxelized toy jack after one iteration

Fig. 7. Voxelized toy jack after three iterations

Fig. 8. Smoothed voxelized toy jack

Fig. 9. Puffing (top left) vs smoothing (top right) Fig. 10. Voxelized polyhedron with solid texture mapping

Fig. 11. Voxelized smoothed polyhedron with solid texture mapping

303

Page 10: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

mesh specification, parameters, and commands for smoothing the polygon mesh. The program supports the interpolation of either the interior vertices only, the boundary vertices only, or both. The user can choose to subdivide the polygon mesh down to the voxel level or to stop at a cer- tain fidelity of the polygon mesh, by specifying either the number of iterations, the size of the maximum polygon diameter, or the surface curva- ture tolerance measured by the difference of nor- mals at vertices or adjacent polygons. Local sub- division is optional, and the user can specify whether to split the polygon mesh before or dur- ing the subdivision. For voxelized surfaces which do not contain any normal values, such as those generated by vertex voxelization, congradient shading [-4] has been employed. It estimates the normal vector from the voxel neighborhood structure using a modified central differences depth gradient. In addition, a normal interpolation process for Phong shading has been embedded within the polygon voxeliz- ation algorithm. However, the images shown here have been shaded with diffuse reflection only. Fig- ures 5-8 show a voxelization of a toy jack. Figure 5 is the original polygon mesh of the jack, and Figs. 6 and 7 are the jack after one and three subdivisions, respectively. In Fig. 8 normal inter- polation is applied to the normals. The jack at the upper right corner of Fig. 9 has been puffed (i.e., the interpolation passes through the original vertices). It is compared with the smooth jack (at the upper left corner of Fig. 9) where the interpo- lation passes through the original face centroids. The original jack (at the bottom) is given for size reference. Figure 10 shows a solid textured polyhedron before smoothing. Figure 11 shows the voxelized polyhedron with the solid texture after smoothing. All the images look smooth with no staircase effect due to the fact that the voxel-based resolution is equal to the image resolution.

Acknowledgements. This work was partially supported by the National Science Foundation under grants IRI-9008109 and CCR-9205047 and grants from Hughes Aircraft Company and Hewlett Packard. We are grateful to Rick Avila for implemen- ting the preprocessing part of the algorithm, for his idea of trianguiating concave polygons, and for his devoted work on the HighRes system of the Cube project. We would also like to thank Chichuang Dzeng for writing the routine that coordinates the normals of polygon meshes.

References

1. Barsky BA, Greenberg DG (1990) Determining a set of B-spline control vertices to generate an interpolating sur- face. Comput Graphics Image Process 227-248

2. Catmull E, Clark J (1978) Recursively generated B-spline surfaces on arbitrary topological meshes. Comput Aided Design 10:350-355

3. Cohen D, Kaufman A (1990) Scan conversion algorithms for linear and quadratic objects. In: Volume Visualization, Kaufman A (ed.) IEEE Computer Society, Los Alamitos, CA, pp 280-301

4. Cohen D, Kaufman A, Bakatash R, Bergman S (1990) Real- time discrete shading. Vis Comput 6:16-27

5. Doo DWH, Sabin MA (1978) Behaviour of recursive subdi- vision surfaces near extraordinary points. Comput Aided Design 10:356-360

6. Kaufman A, Shimony E (1986) 3D scan-conversion algo- rithms for voxel-based graphics, Proc. ACM Workshop on Interactive 3D Graphics, Chapel Hill, NC, pp 45-76

7. Kaufman A (1987) Efficient algorithms for 3D scan- conversion of parametric curves, surfaces, and volumes. Comput Graphics 21:171-179

8. Kaufman A (1988) Efficient algorithms for 3D scan-convert- ing polygons. Computers & Graphics 12:213~19

9. Kaufman A, Cohen D, Yagel R (1993) Volume graphics. Computer 26: 7, pp 51-64

10. Kong TY, Rosenfeld A (1989) Digital topology: introduction and survey. Comput Vis Graphics Image Process 48:357-393

11. Mokrzycki W (1988) Algorithms of discretization of alge- braic spatial curves on homogeneous cubical grids. Com- puters & Graphics 12:477487

12. Nasri AH, (1987) Polyhedron subdivision methods for free- form surfaces ACM Trans Graphics 6:29-73

13. Tan ST, Chan KC (1986) Generation of high order surface over arbitrary polyhedral meshes. Comput Aided Design 18: 411-423

14. Wright J, Hsieh (1992) A voxel-based forward projection algorithm for rendering surface and volumetric data. Proceedings Visualization '92, Boston, MA, pp 340-348

15. Yagel R, Cohen D, Kaufman (1992) Discrete ray tracing IEEE Comput Graphics Applic, pp 19-28

DANIEL COHEN is lecturer at the Department of Computer Science at Ben-Gurion Univer- sity, Beer-Sheva, and at the school of Mathematics at Tel- Aviv University, Israel. Current- ly, he also developing a real-time ray tracer of terrain systems at Milikon, Ltd. In 1987 he was a software engineer at ANon, Ltd. working on bitmap graphics. His research interests include rendering techniques, volume visualization, architectu- res and algorithms for voxel- based graphics. He received a BSc Cure Laude in both Math-

ematics and Computer Science (i985), an MSc Cum Laude in Computer Science both from Ben-Gurion University (1986), and a Phd from the Department of Computer Science at State Unive- rsity of New York Stony Brook (1991).

304

Page 11: Generating a smooth voxel-based model from an irregular ... · original polygon mesh. In a process called lifting, the mesh vertices are shifted to a new location in such a way that

ARIE KAUFMAN is a Profes- sor of Computer Science at the State University of New York at Stony Brook, where he is also the director of the Cube project for volume visualization sup- ported by the National Science Foundation, Department of En- ergy, Hughes Aircraft Company, Hewlett-Packard Company, Silicon Graphics Company, and the State of New York. He has conducted research in computer graphics for 20 years specializing in volume visualization, com- puter graphics architectures and algorithms, user interfaces, and

aultimedia. Kaufman has held positions as a Senior Lecturer nd the Director of the Center of Computer Graphics of the len-Gurion University in Beer-Sheva, Israel, and as an Associ- ~e and Assistant Professor of Computer Science at FlU in /Iiami, Florida. He is currently the chairman of the IEEE ;omputer Society Technical Committee on Computer Grphics, Las been the Paper or Program co-Chair for Visualization' ,0-93 Conferences, and co-Chair for several EUROGRAPHICS 3raphics Hardware Workshops. He received a BS in Mathemat- zs and Physics from the Hebrew University of Jerusalem in 969, an MS in Computer Science from the Weizmann Institute ~f Science (Rehovot) in 1973, and a PhD in Computer Science tom the Ben-Gurion University in 1977.

YINGXING WANG is current- ly working for Protein Data- base, Inc. and was working be- fore for Lundy Computer Graphics, a subdivision of Trans-Technology. She received an M.Sc. in Computer Science from State University of New York at Stony Brook in 1989, an M.Sc. in Applied Mathematics from Academia Sinica in China, and a B.Sc in Mathematics from the University of Science and Technology of China.

305