Abstract:
A method of mapping two-dimensional textures onto a three-dimensional object yields the correct result in terms of pattern placement, scale, repeat and flow of various textures. This is accomplished by providing a unique user interface to control the texture mapping process. The user controls how the texture should flow and where the texture should be &#34;cut and seamed&#34; to fit the geometry of the three-dimensional object by clicking and dragging directly on the rendered surface of the object. The user is presented with two simultaneous windows: one providing a view of the three-dimensional object being wrapped with texture and the other providing a view of the two-dimensional texture with object surface polygons projected thereon. The texture mapping process is controlled from both windows. The three-dimensional object window gives the user control of the texture flow on the surface of the object. The two-dimensional texture window gives the user control of the orientation of the texture and permits the introduction of mapping distortion to simulate stretching of the texture, if desired.

Description:
RELATED APPLICATION 
     This application claims priority of co-pending provisional application Serial No. 60/018,214 filed May 23, 1996. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates generally to the field of computer-aided design (CAD) systems, and particularly to a system for rendering three dimensional objects with surface textures applied thereto. 
     2. Prior Art 
     The runaway increase in computer performance/price ratio in recent years has made sophisticated CAD systems available to nearly anyone. Such systems have evolved beyond those intended for use by professional designers and engineers to include a wide variety of consumer applications. For example, CAD systems have been developed for providing point-of-sale demonstrations of product features and options. One application for such a system allows prospective purchasers of furniture to view an item in any of the available finishes or fabrics prior to making a purchase decision. 
     Texture mapping is a well-known feature of computer graphics systems. In a typical system, a three-dimensional object to be rendered is modeled with a wire frame defining a large number of polygonal surface areas. A mapping function is then determined between a two-dimensional (u,v) texture space and the three-dimensional (x,y,z) object space. Conventional texture mapping processes utilize various projection methods, such as cubic, cylindrical or spherical. One of the primary objectives of these methods is to cover the object surface or parts thereof with seamless texture. Each of these conventional methods introduces some degree of texture distortion as a necessary cost of seamless texture mapping. This is acceptable in most applications where relatively uniform surface textures are desired. 
     In many other applications, the distortions inherent in prior art projection methods are not acceptable due to the appearance of elasticity in the surface. If the texture mapping is intended to depict a relatively inelastic surface covering on an object, such as fabric on upholstered furniture, seamless mapping is not required. Indeed, seams are a desirable artifact contributing to a more realistic appearance. 
     SUMMARY OF THE INVENTION 
     The present invention provides a method for mapping two-dimensional textures onto a three-dimensional object surface which is accurate in terms of pattern placement, scale, repeat and flow of various textures. This is accomplished by providing a unique user interface to control the texture mapping process. 
     Unlike conventional projection methods, the present invention utilizes a projection method where a faceted three-dimensional object is, in a sense, &#34;flattened&#34; by breaking the object along polygon edges. This creates an undistorted projection of the texture onto the surface of the object, albeit at a cost of seamless mapping. This cost is entirely acceptable and even desirable in many applications, such as correctly rendering upholstered furniture. 
     The method of the present invention can be alternatively viewed as &#34;wrapping&#34; a two-dimensional texture onto the three-dimensional surface. Instead of breaking the three-dimensional surface along polygon edges to permit a direct mapping from a two-dimensional space to three-dimensional space, thereby losing the three-dimensional character of the object, the object is wrapped in texture while remaining in three-dimensional space. The user controls how the texture should flow and where the texture should be cut and seamed to fit the geometry of the object. These operations are performed in a three-dimensional viewing window which allows the operator to manipulate a cursor directly on the three-dimensional surface. 
     The foregoing objectives are accomplished with a method comprising the steps of displaying a graphic representation of the three-dimensional object in a first display window; displaying a surface detail pattern or other surface texture in a second display window; designating a first polygonal surface on the three-dimensional object; applying the surface detail pattern to the first polygonal surface; designating a second polygonal surface having a common boundary with the first polygonal surface; and applying the surface detail pattern to the second polygonal surface such that there is pattern continuity across the common boundary. 
     The invention also comprises a method for adding fine-scale surface detail to a three-dimensional object. This is achieved by directly &#34;painting&#34; details onto the three-dimensional surface to approximate local surface lighting effects that would naturally be caused by bumps, fold, waves and other disturbances on the textured surface. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 illustrates the graphic user interface employed with the present invention. 
     FIG. 2 illustrates a first alternative texture mapping of a simple three-dimensional object. 
     FIG. 3 illustrates a second alternative texture mapping of a simple three-dimensional object. 
     FIG. 4 is a functional flow diagram of the process steps of the present invention. 
     FIG. 5 illustrates calculation of default u,v values for an object polygon. 
     FIGS. 6-8 illustrate u,v mapping to achieve texture flow across a border between adjacent object polygons. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     In the following description, for purposes of explanation and not limitation, specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods and devices are omitted so as to not obscure the description of the present invention with unnecessary detail. 
     FIG. 1 illustrates the operating environment of the present invention. The operator&#39;s computer display screen 10 is partitioned into a plurality of windows. An object window 12 displays a three-dimensional object 20 to which a surface texture is to be applied. A cursor 13 is provided under control of a mouse or other pointing device 18. A control window 14 provides the operator with &#34;point and click&#34; controls for display of the three-dimensional object. These controls allow the operator to rotate the object in any direction and to zoom in or out. A texture window 16 displays the two-dimensional surface texture that is to be applied to the object in window 12. 
     The basic operation of the invention can be understood with reference to FIG. 2. A three-dimensional object 20, shown here as a simple cube, is displayed in object window 12. The surface texture to be applied to object 20, in this case a simple stripe pattern, is displayed in texture window 16. The operator begins by designating one of the surface polygons of object 20, for example polygon A, by positioning the cursor on the polygon. The operator must then decide how to proceed with wrapping the object with the surface texture. Since the texture is treated as a relatively inelastic material, such as a fabric, this entails a decision as to where seams will be placed on the object. As illustrated in FIG. 2, the operator first clicks the cursor on polygon A and then drags the cursor to polygon B. This automatically applies the texture to polygons A and B so that the pattern appears on each surface with proper perspective and so that there is pattern continuity across the boundary between polygons A and B. The operator then continues to drag the texture onto polygon C such that there is pattern continuity across the border between polygons B and C. Again, the pattern perspective is automatically adjusted to appear correctly on the surface of polygon C. As a result of the sequence of the operator&#39;s actions, there is a seam (i.e., a pattern discontinuity) at the border between polygons A and C. 
     Referring now to the texture window 16 in FIG. 2, as each of the polygons is designated by the operator, it is projected onto the two-dimensional texture image. Thus, when the operator designates polygon A in object window 12, projection A&#39; is displayed in texture window 16. Likewise, projections B&#39; and C&#39; are displayed in texture window 16 as the operator designates polygons B and C, respectively. The end result is a &#34;flattening&#34; of object 20 over the texture image. As will be explained below, the operator may adjust the texture mapping by manipulating the polygon projections within the texture window. 
     Referring now to FIG. 3, an alternative wrapping of texture onto object 20 is illustrated. In this example, the operator again initially designates polygon A and then drags the texture onto polygon B. However, instead of continuing to polygon C, the operator clicks on polygon a again and drags the texture onto polygon C so that there is pattern continuity across the border between polygons A and C. This results in a seam along the border between polygons B and C. The different result is also portrayed in texture window 16 where polygon C&#39; is now shown adjacent to polygon A&#39; rather than B&#39;. 
     The process of texture mapping in accordance with the present invention is more fully explained with reference to FIG. 4. Beginning at step 30, a three-dimensional object is modeled using any of a number of conventional modeling applications. The object is defined as a set of polygons and polygon groups in a three-dimensional (x,y,z) coordinate system. The object data is stored as an image file such as a .OBJ file. Creation of the three-dimensional object model will normally be done &#34;off line&#34; from the texture mapping process of the present invention. 
     Once the desired object model is created or is imported, it is displayed as a wire frame in the operator&#39;s object window. Using the operator controls, the object can be viewed from any location in three-dimensional space. 
     Proceeding to step 34, the desired texture image, which will typically be imported as a .TIF, .BMP or .WTX file, is displayed in the operator&#39;s texture window. The texture image has a defined &#34;center point&#34;, which can be assigned and moved by the operator. The center point is a reference for texture pattern placement on the object. The operator can also establish texture flow settings. These operator defined settings, along with the texture image, repeat characteristics and physical dimensions of the texture are all saved as a .WTX formatted file. The information contained in such a file permits a single set of u,v mapping values in real world dimensions to be used with any texture image saved as a .WTX file. Thus, once the operator has completed a texture mapping onto an object, any other texture can be automatically applied to that object. 
     At step 38, the operator designates an initial polygon on the surface of the three-dimensional object. The polygon is automatically filled with a default mapping of the texture based on the defined center point of the texture. At the same time, the designated polygon is &#34;flattened&#34; and is displayed as a two-dimensional projection on the texture image and the texture window. The polygon projection can be translated and/or rotated in the texture window to modify the default u,v mapping. Changes to the u,v mapping values are reflected in the three-dimensional rendering of the object in the object window. Individual vertices of the projected polygon in the texture window can be translated by the operator to introduce distortion in order to simulate the effect of fabric stretch. Again, changes made in this manner in the texture window are reflected in the three-dimensional rendering of the object. 
     If additional polygons are to be filled with texture, the operator selects the next polygon by dragging from a previously textured adjacent polygon or by simply selecting a new polygon. In the former case, clicking and dragging from a filled polygon to an adjacent empty polygon flows the texture in a continuous fashion across the border between the two polygons. In the latter case of simply selecting a new polygon, the default u,v mapping is applied to the new polygon. Steps 40, 42 and 44 are repeated for each newly selected polygon until surface texture has been applied to the entire object or to the desired portions of the object. If less than the entire object is covered with a particular texture, the set of polygons thus covered can be associated to form a &#34;part&#34;. Parts of an object thus defined have the characteristic of sharing the same texture in any future renderings of the object. 
     As described above, when the operator first designates a polygon on the surface of the three-dimensional object, default u,v values are calculated. The following describes the manner in which such values are calculated. A polygon on the surface of the three-dimensional object is defined by the coordinates of its vertices in x,y,z space. It is presumed that all polygons defining an object are either triangles or quadrilaterals. The polygon is &#34;flattened&#34; to u,v space by projecting it onto a two-dimensional plane which intersects all of the vertices of the polygon. The flattening process involves three steps: First, one of the vertices is presumed to lie at the origin of two-dimensional x,y space and an adjacent vertex is presumed to be located on the x-axis; Second, the remaining vertex or vertices are transformed about the origin to be coincident with the two-dimensional x,y plane; Third, all vertices are translated using the u,v location of the defined texture center point as a delta value. 
     Referring to FIG. 5, vertex A is presumed to have x,y coordinates O,O. Vector a is defined as the polygon side between vertex A and vertex C. Vector B is defined as the polygon side between vertex A and vertex B. Length a is the length of vector A. Lengths b and c correspond to the x and y coordinates of vertex B, respectively. From FIG. 5, it can be seen that: 
     
         cos θ=A·B/|A||B|(1) 
    
     Therefore: 
     
         cos θ*|A|=A·B/|B|(2) 
    
     since cosθ=b/a, and since a=|A|, it follows that: 
     
         cos θ*=b/|A|                       (3) 
    
     and 
     
         cos θ*|A|=b                        (4) 
    
     substituting the right-hand side of equation (2) for cosθ*|A|, we have the solution for b: 
     
         b=A·B/|B|                       (5) 
    
     Thus, length b, the x coordinate of vertex C, is equal to the dot product of vectors A and B divided by the vector length of B. Now, transforming equation 1, we have: 
     
         θ=acos (A·B/|A||B|)(6) 
    
     since sinθ=c/a, it follows that: 
     
         c=sin θ*a                                            (7) 
    
     The location of vertex C in the two-dimensional x,y plane is therefore defined by the values of b and c. In the case of a quadrilateral, the same process is used to calculate the coordinates of the fourth vertex D. 
     Having thus computed the default u,v values of the polygon vertices, these may be translated and/or rotated in the u,v plane as previously described. When the operator then designates an adjacent polygon to which texture is flowed from the first, the u,v values for the second polygon are calculated as follows. 
     As illustrated in FIG. 6, polygon A has been rotated and translated in the u,v plane and default u,v values for the second polygon B have been calculated in the same manner as previously described. The vertices representing the common edge between the first and second polygons are then determined based on the known x,y,z coordinates of the vertices. Here, vector A of polygon A and vector B of polygon B are determined to define the common edge between the polygons. 
     As illustrated in FIG. 7, polygon B is translated so that the origin of vector B coincides with the origin of vector A. Rotational values are calculated based on the definition of θ in equation (6) above. Polygon B is rotated as shown in FIG. 8 so that vectors A and B are coincident. 
     Having calculated a u,v mapping for each vertex of a polygon, interior pixel u,v values are mapped to two-dimensional screen space using any conventional interpolation scheme. One particularly suitable scheme is rational linear interpolation as described in Interpolation for Polygon Texture Mapping and Shading by Paul S. Heckbert and Henry P. Moreton. As observed by the authors, the homogenous texture coordinates suitable for linear interpolation in screen space can be computed simply by dividing the texture coordinates by the pixel spacing w, linearly interpolating the normalized coordinates (u/w,v/w), and multiplying the interpolated normalized coordinates by w at each pixel to recover the texture coordinates. This process maps texture to the polygon interior with correct perspective. 
     A problem in achieving photorealism in computer graphics is the computational overhead of replicating realistic lighting and shading models, especially at very fine levels of detail. The system of the present invention extends conventional texture mapping techniques to achieve high quality detail in the rendered image without significantly increasing the computational time required for rendering. This is accomplished by painting certain surface details directly onto the three-dimensional object. Such surface detail approximates local surface lighting effects which would result from bumps, folds, waves and other disturbances in the flow of the surface texture. Such effects are independent of the mapped texture and are difficult to represent directly in the three-dimensional model of the object using conventional modeling techniques. 
     Conventional &#34;bump mapping&#34; techniques adjust the gray scale surface values of a rendered object to create an illusion of distortion normal to the rendered surface. The present invention employs a technique that modulates the lighting values of each rendered pixel. 
     In the present invention, an object texture mode of operation provides the operator with a palette of tools, including variously shaped brushes, pencils, stamps and others. The operator manipulates these tools on the surface of the three-dimensional object in the object window to paint, shift, scale and shear surface textures directly on the rendered three-dimensional object. Use of the tools assigns a pixel-by-pixel multiplier that modulates the lighting intensity at the surface of the object, thereby simulating highlights and shadowing of surface detail features. The multiplier is normalized so that the unmodulated lighting intensity can be either dampened or intensified. The painted-on features become a part of the object model and are included in the .OBJ file. Such features will therefore be represented on the rendered object regardless of the texture that is applied. The features applied with the surface detail tools are mapped to the texture window where they can be further edited in the two-dimensional space of the surface polygon projections. 
     It will be recognized that the above described invention may be embodied in other specific forms without departing from the spirit or essential characteristics of the disclosure. Thus, it is understood that the invention is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims.