Abstract:
A method regularizes a distance field of a graphics model or object. The distance field includes variable scalar values and a set of fixed zero values. The zero values define a boundary or surface of the object. The distance field is evaluated by a cost function, optimized according predetermined parameters, to determine a cost of the distance field. The variable scalar values are then randomly perturbed while holding the zero values fixed. The evaluating, determining, perturbing steps are repeated until the cost is less than a predetermined threshold. The distance field can be in the form of a non-differentiable implicial field. A surface of the graphics model can be textured or stenciled by following streamlines along the gradients of the regularized distance field.

Description:
FIELD OF THE INVENTION  
         [0001]    The present invention relates generally to the art of representing shapes of objects and models, and more particularly to computer implemented methods for operating on the represented shapes.  
         BACKGROUND OF THE INVENTION  
         [0002]    Rivaling polygons, distance fields are well known as fundamental primitive for representing objects and models in computer graphics, see for example, U.S. Pat. No. 6,040,835 issued to Gibson on Mar. 21, 2000, and U.S. Pat. No. 6,084,593 issued to Gibson on Jul. 4, 2000.  
           [0003]    In the prior art, a distance field is usually described with the notion that every point in space is associated with a “minimum” distance to a surface on the object or model. This notion derives both from natural experience and the classic definition in mathematics in which a distance from a point y in a metric space to a set A is given by the infimum  
             D ( y,A )= inf   xεA   D ( x,y ),  
           [0004]    where D(x,y) is a standard metric such as the Manhattan distance, i.e. the sum of absolute differences of components, the Euclidean distance, i.e., the square root of the sum of the squares of the components, or the infinity norm, i.e. the maximum of the absolute differences of the components; known respectively as the l 1 , — 2  and l ∞  norms.  
           [0005]    Whatever the metric, a traditional distance field requires searching for a point on a surface of the object or model that is closest to a point in space, i.e., a point in the distance field. For example, the distance field can be determined by an intensive method that finds a nearest point on the surface to any given point in space by casting sample rays from the point in space, and then using Newton&#39;s approximation method to converge on the point on the surface. This search can be time-consuming and complicated. Furthermore, the search can be subject to many optimization pitfalls.  
           [0006]    Unfortunately, the traditional notion of the minimum distance also excludes many useful shapes. Implicitly defined shapes, for example, do not reference a minimum distance, nor do they necessarily designate a closest point on a surface of the object to allow one to completely define the distance field.  
           [0007]    For example, with an implicit function f(x)=20x 2 +y 2 +z 2 −1, any point x in three-dimensional space f(x) represents a very usable distance to the flattened ellipsoid defined by f(x)=0, an algebraic, i.e., non-Euclidean, distance that has no minimum or closest point in the calculation. Level sets, interpolation schemes, measured equipotential fields and procedural methods are other examples for which distance fields either fail to represent, or impose unnecessary computational burdens on the representation. In addition, repeated operations on distance field can degrade quality of the field, making further operations inaccurate, unpredictable, or worse, impossible to perform.  
           [0008]    For example, FIG. 1 a  shows contracting streamlines  101  of a cubic implicial test function on a test surface  102 , and FIG. 1 b  expansion and twist of streamlines  103  on the test surface  104 . There are eight streamlines emanating from the four corners and four midpoints of the depicted square  105 . In FIG. 1 a , the streamlines  101  contract as they flow to the surface in a region of concavity. In FIG. 1 b , the streamlines  102  expand to meet a region of convexity  102 . The streamlines in FIG. 1 a  also exhibit some twist to the flux, especially where the horizontal beginning points on the square project  105 , with a turn, onto the convex surface. It would be desirable to minimize the contraction, expansion and rotation of the streamlines.  
           [0009]    [0009]FIG. 2 a  shows a more tortuous path of streamlines  201  when the object or model has a small amount of texture. FIG. 2 b  shows a complete failure in the streamlines due to a lager amount of texture. This is due to the fact that the distance field has a large number of local minima that trap the streamlines.  
           [0010]    It is desired to regularize a field surrounding shapes of objects and models so that repeated operation such Booleans, blending and texturing can be applied without deleterious effects on the field.  
         SUMMARY OF THE INVENTION  
         [0011]    The invention provides a method for regularizing a distance field of a graphics model or object. The distance field includes variable scalar values and a set of fixed zero values. The zero values define a boundary or surface of the object.  
           [0012]    The distance field is evaluated by a cost function, optimized according predetermined parameters, to determine a cost of the distance field. The variable scalar values are then randomly perturbed while holding the zero values fixed. The evaluating, determining, perturbing steps are repeated until the cost is less than a predetermined threshold.  
           [0013]    The distance field can be in the form of a non-differentiable implicial field. A surface of the graphics model can be textured or stenciled by following streamlines along the gradients of the regularized distance field. 
       
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0014]    [0014]FIGS. 1 a - b  shows a model with streamlining;  
         [0015]    [0015]FIG. 2 a  shows a model with small texturing and streamlining;  
         [0016]    [0016]FIG. 2 b  shows the model of FIG. 2 a  with large texturing and no streamlining;  
         [0017]    [0017]FIG. 3 a  shows a model of a water molecule generated by a Boolean union operation on an implicial field according to the invention;  
         [0018]    [0018]FIG. 3 b  shows the model of FIG. 3 a  with blending;  
         [0019]    [0019]FIG. 4 shows the model of FIG. 3 a  with texturing;  
         [0020]    [0020]FIG. 5 a  shows a random distance field;  
         [0021]    [0021]FIG. 5 b  shows the random field regularized according to the invention;  
         [0022]    [0022]FIG. 6 is a block diagram of the regularization method according to the invention;  
         [0023]    [0023]FIG. 7 a - b  shows the model of FIGS. 1 a - b  after regularization according to the invention;  
         [0024]    [0024]FIGS. 8 a - b  show the projection of a viewing plane onto the surface of a model using the regularization according to the invention; and  
         [0025]    [0025]FIG. 9 shows is a block diagram of a method for positioning a bit map according to a regularized field. 
     
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT  
       [0026]    Implicial Fields  
         [0027]    The present invention defines an implicial field for an object or model as a scalar field d: R n →R in which the zero set d −1 (0) is not empty. This definition requires that the implicial field fulfills syntactical constraints, i.e., a scalar, and a non-empty zero set.  
         [0028]    It should be understood that implicial fields, in contrast to prior art distance fields, can be generated by other than implicit functions. As defined above, distance fields, level sets, interpolation schemes, measured equipotential fields, and computer implemented procedures can also generate implicial fields from objects or models. Therefore, it is correct to state that the implicial field according to the invention is the result of a process that implicitizes the object or the model. In the case of implicit functions, the implicial field may re-implicitize the object or model.  
         [0029]    As a simple example, consider an implicitly defined function such as  
           d ( x )=20 x   2   +y   2   +z   2 −1.  (1)  
         [0030]    For any point x in three-dimensional space where d(x) is a scalar field, there exists a flattened ellipsoid zero set defined by d(x)=0. Although functions like equation (1) represent a large class of implicial fields, it is a mistake to assume that implicial fields are limited only to “implicitly” defined functions.  
         [0031]    Some other implicial fields include fields where a value of d(x) is determined by finding a point on the object or model that is closest to x in some norm. Implicial fields can also be generated for fractals, equipotential fields, such as gravity, electromagnetic fields, and acoustic fields.  
         [0032]    As defined above, the zero set of the implicial field essentially defines the outline, shape, or surfaces of the object or model. The surfaces can be external or internal, or some other iso-surface. Therefore, the zero set of an implicial field is extremely useful for defining objects and models in CAD/CAM, scientific visualization, and computer graphics applications. In addition, the above definition enables operations such as Booleans, offsetting, collision detection, morphing, filleting, or rendering methods, obviously of great importance to any of the above mentioned rendering techniques.  
       EXAMPLES OF IMPLICIAL FIELDS AND OPERATIONS ON IMPLICIAL FIELDS  
       [0033]    Booleans and Fillets  
         [0034]    If f and g are two implicial fields with zero sets A and B, then the Boolean union, intersection and difference of the zero sets are given respectively by  
           A∪B≡{x |min( f ( x ),  g ( x ))=0},  (2)  
           A∩B≡{x |max( f ( x ),  g ( x ))=0},  (3)  
           A\B≡{x |max( f ( x ), − g ( x ))=0}.  (4)  
         [0035]    Multiple Booleans are obtained by combinations of the Boolean functions in equations (2-4).  
         [0036]    Discontinuities  
         [0037]    The min/max functions may generate discontinuities of derivatives when f(x)=g(x), i.e., f(x) and g(x) are non-differentiable implicial fields.  
         [0038]    [0038]FIG. 3 a  shows the union of three zero sets  311 - 312  of implicial fields generated from spheres configured to model a water molecule (H 2 O)  300 . The spheres are defined with the square root of the components squared. The Boolean operators create ridges  301  along cones of non-differentiability. With implicial fields f(x), g(x) and h(x), the new implicial field of the union is  
         min(min(f(x),g(x)), h(x)).  (5)  
         [0039]    In this case, the non-differentiability exhibits itself as creases in the zero set.  
         [0040]    As shown in FIG. 3 b , one can apply a blending operation to turn the creases into smooth fillets  302 . The blending operation yields an implicial field  
           b ( x )=1−max(1−( x )/ R, 0) 2 −1−max(1 −g ( x )/ R, 0) 2 −1−max(1 −g ( x )/ R, 0) 2 ,  (6)  
         [0041]    where R is the blending range chosen to determine the size of the fillet.  
         [0042]    However, blending still leaves other discontinuities in the derivatives because of the max functions in equation (6). However, a rendering of the implicial field no longer exhibits creases in the zero set, and can be shown to have continuous normals given by ∇b(x) wherever b(x)=0.  
         [0043]    [0043]FIG. 4 shows a rendering of the water molecule  400  of FIGS. 3 b  where a relief texturing operation is applied to the zero set, The relief texturing adds the additional implicial field  
           T ( x )= A  sin( ax )sin( ay )sin( az ),  (7)  
         [0044]    for constants A and a. In other words we define a new implicial field g(x)=d(x)+T(x). This additive split is useful to separate primary shape given by d(x)=0 from fine detail added by the additive implicial field T(x).  
         [0045]    Discrete Structures  
         [0046]    A discrete implicial structure (DIS) is defined as a finite set of discrete points or parameters from which an approximation to an implicial field can be constructed. A simple DIS is, for example, an equally sampled volume of points surrounding the zero set and the associated implicial field values of the points; thus, S={x i , d(x i )}.  
         [0047]    Any number of interpolation techniques can then be used to approximate the implicial field from S. Examples of interpolation techniques include octtree or binary space partitioning (BSP) tree representations, wavelets and many others. Examples of spatial data structures are presented by Samet, in “ The Design an Analysis of Data Structures ,” and “ Applications of Data Structures ,” Addison-Wesley, 1989.  
         [0048]    Regularizing a Distance Field  
         [0049]    As stated above, repeated operation can degrade a distance field. In addition, some distance fields can be irregular to start with. Therefore, my invention provides a method for regularizing, i.e., smoothing, an implicial field while maintaining the invariance of the zero set of the implicial field. My method reforms the non-zero portion of a discretely stored implicial field as a constrained minimization.  
         [0050]    As shown in FIGS. 5 a  and  5   b , it is easiest to describe the advantage of the present invention in two dimensions. A worst possible scenario is contrived in FIG. 5( a ), where the two peaks  501  represent the zero set and the rest of the implicial field are generated randomly.  
         [0051]    In order to “smooth” or regularize the implicial field so that repeated rendering operations can be enabled, the zero set and the boundary of the implicial field are constrained, while the other values of the field are allowed to vary. Using a simulated annealing process, the values of the implicial field values are perturbed and input to a cost function, which corresponds, e.g. to the area of the surface. If the area decreases, a new state may be accepted.  
         [0052]    As the cost function converges, the amount of perturbation is decreased and the likelihood of acceptance increased, until very little change in the area is noted. The minimization of area yields a minimal energy surface, or “a soap film”  502 , as shown in FIG. 5 b . In this form, the regularized implicial field according to the invention become much more useable than prior art unregularized distance fields without changing the zero set itself.  
         [0053]    [0053]FIG. 6 shows a method  600  that regularizes the implicial field of the invention. The method  600  has two inputs  601 - 602 . The first input is a data structure or procedure  601  representing the object or model, e.g. a distance field or an implicial field. The data structure  601  can be in the form of sampled data, e.g., an octtree, a kd-tree or some other form. Fixed, i.e., invariant, data are those that represent the boundary of the implicial field, and the zero set; All invariant data is fixed in step  610 .  
         [0054]    The second input includes parameters  602  for optimizing a cost function  620 , e.g., minimum energy, minimum curl, minimum divergence, minimum Jacobian, minimum Laplacian, near conformal, or near volume preserving. These constraints can minimize surface area, unwanted rotations, contractions or expansions, and can provide nearly equal area maps and decrease angle distortions, i.e., any distortions are near conformal. Possible cost functions include simulated annealing, downhill simplex method, or conjugate gradient methods based on differing predicates.  
         [0055]    Terminating conditions  630  for the cost function  620  include a predetermined minimum cost or a rate of change in the cost. When the terminating condition  630  is met, the method  600  is done in step  639 .  
         [0056]    In step  640 , the variables, e.g., the sample points of the implicial field, are perturbed. The perturbation can be random. The perturbed variables are reevaluated by the cost function  620 , steps  630  and  640  are repeated until the termination condition  630  is satisfied.  
         [0057]    [0057]FIGS. 7 a - b  show the positive effects of regularizing the implicial field. FIG. 7 a  shows the smooth streamlines  701  after the implicial field has been regularized by the method  600 . Furthermore, the smoothing is accomplished without changing the zero set. The streamlines are smoother, and more rapidly computed by an order of magnitude. Furthermore, the contraction of the streamlines seen in FIG. 1 a  is lessened in the presence of a positive change in the divergence of the implicial field in that region. FIG. 7 b  shows streamlines  702  after implicial field regularization of the highly textured field of FIG. 1 b . With prior art distance fields, it is not possible to compute smooth streamlines art all.  
         [0058]    When one considers that the streamlines follow the normals of the offset surfaces, i.e., the streamlines are perpendicular to the offsets, then FIG. 7 b  gains greater significance. After smoothing the implicial field, the streamlines flow reasonably straight until they are near the zero set where they exactly match the strong undulations close to the surface defined by the zero set.  
         [0059]    [0059]FIG. 8 a  shows a parameterization between an arbitrarily position image and a cubic zero set via streamlines of the gradient field of the regularized distance field. The parametrically defined petal  801  is mapped to the surface  802  by taking each (x, y) location of the petal in the image and following its regularized streamlines to the zero set, i.e., the surface. FIG. 8 b  shows how regularization can be used to stencil the same petal onto a very difficult implicial field due to the highly textured surface  803 , which would otherwise not be possible.  
         [0060]    [0060]FIG. 9 shows a texturing procedure  900  which uses the regularized implicial field according to the invention. Input to the procedure is regularized implicial field  901  representing an object, and a bit map  902  representing a texture. In step  910 , the bit map is positioned with respect to the zero-set of the implicial field. Step  920  determines, for each pixel in the bit map, a streamline to a correspond value in the zero set, and textures, e.g., colors, the zero set point according to the color of the corresponding pixel in the bit map.  
         [0061]    My invention provides a method for regularizing distance fields. When an object or model is represented by a distance field, Booleans operations with min/max functions can be applied to the implicial field, any number of times without degrading the quality of the distance field. In addition, relief texturing can applied to the field, without having the implicial field loose its differentiability. Offsets also become possible, and the streamlines can be used as projectors for the purpose of bit mapping.  
         [0062]    The invention is described in terms that enable any person skilled in the art to make and use the invention, and is provided in the context of particular example applications and their requirements. Various modifications to the preferred embodiments will be readily apparent to those skilled in the art, and the principles described herein may be applied to other embodiments and applications without departing from the spirit and scope of the invention. Thus, the present invention is not intended to be limited to the embodiments described herein, but is to be accorded with the broadest scope of the claims below, consistent with the principles and features disclosed herein.