This invention relates to shading polygons from a three-dimensional (3D) model to render a non-photorealistic two-dimensional (2D) image.
Non-photorealistic images are rendered from 3D models by projecting polygons that make up the 3D model onto a 2D surface and shading the polygons. The polygons are shaded to achieve a cartoon-like effect that does not too closely approximate real life. Existing shading techniques include determining shading values for vertices of the polygons and shading the polygons based on those shading values.
Referring to
A unit normal vector (“normal”) 20a, 20b and 20c at each respective vertex 15a, 15b and 15c affects how the vertex is perceived relative to a predefined reference point (the “eyepoint” 23 in
Process 27 uses bitmap images to shade polygons of 3D image 10. In this embodiment, the bitmap images are pencil-sketch texture maps; however, as noted above, the bitmap images may be solid but differently shaded texture maps (for, e.g., cartoon shading). The bitmap images may be stored in memory, from which they are retrieved by process 27. Examples of pencil-sketch bitmap images that may be used by process 27 are shown in FIG. 6. Other bitmap images may also be used.
Referring to
By way of example, for vertex 15b of polygon 13 (FIG. 4), process 27 calculates the vector dot product of unit normal vector 20b (N) and unit light vector 25 (L). Since N and L are both unit vectors, the product of N·L is the cosine of the angle 18 formed between the two vectors. If the angle between N and L is small, then the diffuse component of smooth shading is high and N·L will have a value close to one. If the angle is large, then the amount of diffuse component in smooth shading is low and N·L has a value close to zero.
Process 27 takes the maximum of the resulting dot product (N·L)and zero, i.e., Max(N·L, 0) and obtains (36) a shading value for the vertex that is proportional to the maximum of the dot product. The maximum is taken to discount polygons that are in the back of the 3D model relative to the light source and, thus, which produce a negative N·L value.
For each vertex 15a, 15b and 15c of polygon 13, process 27 obtains (36) a shading value. Process 27 classifies (38) each vertex based on the obtained shading values. That is, process 27 uses the shading values to assign each vertex of polygon 13 to one of M (M≧1) bins in memory. Each of the bins holds a predetermined range of shading values. For example, process 27 might use three bins having intervals of [0,a], (a,b] and (b,1], where “a” and “b” are adjustable shading values with a<b, 0≦a and b≦1, and where square brackets indicate exclusion and parenthetic brackets indicate exclusion. For example, “a” is included in the range [0,a] but excluded from the range (a,b]. So, in this example, if a shading value of vertex 15b is “a”, vertex 15b will be associated with bin [0,a]. Different numbers and/or ranges of bins may be used in process 27. A bitmap image is assigned to each bin. Each vertex in that bin is shaded using the assigned bitmap image, as described below.
Once process 27 determines the shading for each vertex, process 27 projects (40) polygon 13 onto a 2D surface. This is done by determining the Cartesian XY coordinates of polygon 13 on a 2D surface. Process then forms a 2D representation of the original 3D polygon onto the 2D surface.
Process 27 determines (42) if all vertices of polygon 13 are assigned to the same bin, in which case all of the vertices would be shaded using the same bitmap image. If this is the case (42), process 27 shades (44) the entire polygon 13 using the bitmap image that corresponds to the bin to which the vertices are assigned. Process 27 does this by mapping the appropriate bitmap image to the polygon using a conventional texture mapping technique. Thereafter, process 27 determines (46) if polygons remain in the 3D data. If so, process 27 returns to 32. If not, process 27 proceeds to 48.
Returning to 42, if process 27 determines (42) that at least two of the vertices of polygon 13 are in different bins, process 27 proceeds to 50. Two vertices in different bins means that polygon 13 is part of a boundary between two differently-shaded regions. In this case, process 27 subdivides polygon 13 and shades the resulting sub-polygons to achieve a more granular boundary between the differently-shaded regions. This is described in more detail below.
The remainder of process 27 will be described with respect to polygon 13 as it is shown in
Referring back to
The locations of the points on edges 17a, 17b and 17c are determined by performing a linear interpolation to find cut-off points between the shading levels that are assigned to two adjacent vertices. By way of example, assume that vertex 15a has a shading value of 0.1 and that BIN1 corresponds to a bitmap image having a shading level of
Assume further that vertex 15c corresponds to a bitmap image having a shading value of 0.7 (BIN3). Thus, vertices 15a and 15c are assigned to bins that are two shading levels apart, i.e., BIN1 corresponds to a bitmap image having a shading level of
For vertices 15a and 15c, process 27 determines the location of the cut-off point between the shading levels of
Once process 27 identifies points 52, 53, 54 and 55, process 27 connects (56) each pair of analogous bin boundary points from different edges. This means, e.g., that process 27 connects points 52 and 54, which are both are at a shading value of 0.4, and points 53 and 55, which are both are at a shading value of 0.6. Connecting the points in this manner splits polygon 13 into three separate areas 58, 59 and 60.
Areas 58, 59 and 60 define different shading regions. That is, area 58 is shaded with the bitmap image assigned to BIN1 (vertex 15a), area 59 is shaded with the bitmap image assigned to BIN2 (vertex 15b), and area 60 is shaded with the bitmap image assigned to BIN3 (vertex 15c). In order to shade the areas, however, a graphics processor requires that the areas be broken-up into polygons that have the same basic shape as polygon 13. For example, if polygon 13 is a triangle, as it is in this embodiment, areas 58, 59 and 60 need to be broken-down into triangles in order to shade them using the graphics processor. Therefore, process 27 tessellates (61) the areas, as necessary, to form sub-polygons having substantially the same shape as original polygon 13. In this case, original polygon 13 is a triangle; therefore, the sub-polygons should be triangles as well.
Tessellation may be performed by using a conventional subdivision process. In the example of
Process 27 assigns (62) triangles 63, 64 and 65 to BIN2. Process 27 assigns (62) area 58 to BIN1 and area 60 to BIN3. Process 27 shades (68) each polygon (in this case, each triangle) with the bitmap image for its corresponding bin. Thus, polygon 58 is shaded using the bitmap image associated with BIN1. Polygon 60 is shaded using the bitmap image associated with BIN3. Polygons (triangles) 63, 64 and 65 are shaded with the bitmap image associated with BIN2.
If any polygons remain in the 3D data (46) for model 10, process 27 returns to 32, where a new polygon is selected and process 27 is repeated for that polygon. Once all polygons have been processed, process 27 renders (48) the resulting non-photorealistic 2D image from the shaded polygons.
Since areas 58, 59 and 60 are shaded using different bitmap images, the effect of the shading is to produce a non-photorealistic 2D image with relatively precise shading boundaries. For example,
Moreover, because process 27 only subdivides areas that do not already have the same shape as the original polygon (e.g., area 59 but not area 58), an excessive amount of processing need not be performed by the graphics processor.
Process 27 may be used to create animation cels for cartooning. For example, a 3D model, such as model 10, may be generated, and then positioned in a desired manner. Process 27 may be executed on the model to produce a shaded 2D image for that position. Then, the 3D model 10 can be re-positioned (e.g., rotated), and process 27 executed on the re-positioned model to produce a shaded 2D image for a different perspective of the model. This process may be repeated to produce shaded 2D images for any number of model positions. Thus, process 27 can generate animation cels automatically, meaning without the use of hand-drawn sketches.
Process 27 runs in real-time, which facilitates the animation process. That is, in conventional hand-drawn animation, artists cannot interactively change the appearance/view of a character without re-drawing the character manually. Process 27 permits this because it renders frames of animation (i.e., 2D images) dynamically and automatically for a given viewpoint in real-time.
Process 27 is not limited to use with the hardware and software of
Each such program may be implemented in a high level procedural or object-oriented programming language to communicate with a computer system. However, the programs can be implemented in assembly or machine language. The language may be a compiled or an interpreted language.
Each computer program may be stored on a storage medium or device (e.g., CD-ROM, hard disk, or magnetic diskette) that is readable by a general or special purpose programmable computer or other machine for configuring and operating the computer when the storage medium or device is read by the computer to perform process 27. Process 27 may also be implemented as a computer-readable storage medium, configured with a computer program, where, upon execution, instructions in the computer program cause the computer to operate in accordance with process 27.
Process 27 is not limited to the embodiments described above. For example, an edge 17a may have more than two points 52 and 53 if vertices do not belong to two adjacent bins. For example, if vertex 15a belongs to a bin having a shading level of
Process 27 may also be performed in multiple passes. That is, process 27 may render a 2D image from 3D data and then progressively increase the granularity of polygons that make up the shading regions until the shading boundaries reach a desired precision. In this case, for example, process 27 may be performed on the areas 58 and 60 and the sub-polygons 63, 64 and 65 (see FIG. 7).
Process 27 is also not limited to use with cartoon and pencil-sketch shading techniques. Any type of non-photorealistic, or other, shading technique may be employed with process 27.
Other embodiments not described herein are also within the scope of the following claims.
| Number | Name | Date | Kind |
|---|---|---|---|
| 4600919 | Stern | Jul 1986 | A |
| 4747052 | Hishinuma et al. | May 1988 | A |
| 4835712 | Drebin et al. | May 1989 | A |
| 4855934 | Robinson | Aug 1989 | A |
| 4901064 | Deering | Feb 1990 | A |
| 5124914 | Grangeat | Jun 1992 | A |
| 5163126 | Einkauf et al. | Nov 1992 | A |
| 5371778 | Yanof et al. | Dec 1994 | A |
| 5517263 | Minich et al. | May 1996 | A |
| 5611030 | Stokes | Mar 1997 | A |
| 5731819 | Gagne et al. | Mar 1998 | A |
| 5757321 | Billyard | May 1998 | A |
| 5786822 | Sakaibara et al. | Jul 1998 | A |
| 5805782 | Foran | Sep 1998 | A |
| 5809219 | Pearce et al. | Sep 1998 | A |
| 5812141 | Kamen et al. | Sep 1998 | A |
| 5847712 | Salesin et al. | Dec 1998 | A |
| 5894308 | Isaacs | Apr 1999 | A |
| 5929860 | Hoppe | Jul 1999 | A |
| 5933148 | Oka et al. | Aug 1999 | A |
| 5949969 | Suzuoki et al. | Sep 1999 | A |
| 5966133 | Hoppe | Oct 1999 | A |
| 5966134 | Arias | Oct 1999 | A |
| 5974423 | Margolin | Oct 1999 | A |
| 6054999 | Strandberg | Apr 2000 | A |
| 6057859 | Handelman et al. | May 2000 | A |
| 6078331 | Pulli et al. | Jun 2000 | A |
| 6115050 | Landau et al. | Sep 2000 | A |
| 6175655 | George, III et al. | Jan 2001 | B1 |
| 6191655 | Moughabghab | Feb 2001 | B1 |
| 6191787 | Lu et al. | Feb 2001 | B1 |
| 6191796 | Tarr | Feb 2001 | B1 |
| 6198486 | Junkins et al. | Mar 2001 | B1 |
| 6201549 | Bronskill | Mar 2001 | B1 |
| 6208347 | Migdal et al. | Mar 2001 | B1 |
| 6219070 | Baker et al. | Apr 2001 | B1 |
| 6239808 | Kirk et al. | May 2001 | B1 |
| 6252608 | Snyder et al. | Jun 2001 | B1 |
| 6262737 | Li et al. | Jul 2001 | B1 |
| 6262739 | Migdal et al. | Jul 2001 | B1 |
| 6292192 | Moreton | Sep 2001 | B1 |
| 6317125 | Persson | Nov 2001 | B1 |
| 6337880 | Cornog et al. | Jan 2002 | B1 |
| 6356263 | Migdal et al. | Mar 2002 | B2 |
| 6388670 | Naka et al. | May 2002 | B2 |
| 6405071 | Analoui | Jun 2002 | B1 |
| 6437782 | Pieragostini et al. | Aug 2002 | B1 |
| 6478680 | Yoshioka et al. | Nov 2002 | B1 |
| 6559848 | O'Rourke | May 2003 | B2 |
| 6593924 | Lake et al. | Jul 2003 | B1 |
| 6593927 | Horowitz et al. | Jul 2003 | B2 |
| 6608627 | Marshall et al. | Aug 2003 | B1 |
| 6608628 | Ross et al. | Aug 2003 | B1 |
| 20010026278 | Arai et al. | Oct 2001 | A1 |
| 20020101421 | Pallister | Aug 2002 | A1 |
| Number | Date | Country | |
|---|---|---|---|
| 20020118212 A1 | Aug 2002 | US |