Abstract:
A lighting equation for showing the lighting effects on a graphics logic may be solved more efficiently by grouping a plurality of vertices that represent the object to form groups of vertices. Spherical harmonic coefficients can be only calculated for the center of the group. The other coefficients within the group may be determined by interpolating the spherical harmonic coefficients across the group.

Description:
BACKGROUND  
       [0001]    This relates generally to graphics processing and to the representation of images on graphics displays. 
         [0002]    In rendering images for display on a computer display, the effect of light on the object may be considered. The effect of light on the object may be a function of a number of different things, including the intensity of the light, its position, and whether the lighting is direct lighting or reflected lighting. 
         [0003]    The so-called illumination geometry of the object affects how it will be perceived as a result of the light incident upon the object. In addition, the view point of the display or the so-called viewing geometry is also important in determining how the object would look given various illumination sources. 
         [0004]    These and other lighting effects may be determined by a lighting equation in a graphics pipeline of a processor-based system. Generally, the calculations involved in solving the lighting equation are extremely complex. As a result, computing resources may be consumed in solving the lighting equation and, in some cases, the time needed to accomplish the calculations may slow down the display. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS  
         [0005]      FIG. 1  is a flow chart for one embodiment of the present invention; 
           [0006]      FIG. 2  is an apparatus according to one embodiment; and 
           [0007]      FIG. 3  is a system depiction for another embodiment. 
       
    
    
     DETAILED DESCRIPTION  
       [0008]    Solving the lighting equation may be accelerated by grouping a plurality of vertices of polygons that represent the graphical image, determining the lighting equation for a representative sample of the group of vertices and then interpolating to get a more accurate determination of the lighting equation solution for each of the grouped vertices. 
         [0009]    In some embodiments, the calculation may be expedited, reducing the burden on the processing equipment and resulting in a faster solution. 
         [0010]    The generalized lighting equation involves integrating an incoming radiance product and the bidirectional reflectance distribution function (BRDF) over a sphere. The BRDF gives the reflectance of a target as a function of illumination geometry and viewing geometry. The spherical harmonics lighting technique uses projections of these two functions into a spherical harmonics basis. The spherical harmonics basis is a set of orthogonal functions defined on a sphere. Decomposing a function into the spherical harmonics basis involves taking only the first several coefficients in a kind of lossy data compression. These coefficients physically correspond to the amount of the light coming from fixed directions. 
         [0011]    The integration process then becomes a dot product of the two spherical harmonic coefficient vectors. However, generating the transfer functions for each vertex for the polygons representing the depicted objects and projecting them into the spherical harmonics basis may typically be a time consuming process. 
         [0012]    In one embodiment, a number of vertices of polygons that represent the depicted object being processed may be grouped into a cluster structure based on location-proximate vertices may be clustered. Instead of calculating the spherical harmonic coefficients in each vector, the exact spherical harmonic coefficients are only calculated for the vertex at the center of each cluster. Then these exact values may be interpolated across the whole volume of the grouped cluster to get approximated spherical harmonics coefficients for all the remaining vertices within the cluster. 
         [0013]    Thus, referring to  FIG. 1 , a sequence  34  may be implemented in firmware, software, or hardware. Software embodiments may be stored on a computer-readable medium such as an optical disk, a magnetic disk, or a semiconductor memory. Initially the vertices are grouped into a plurality of clusters, as indicated in block  10 . The spherical harmonic coefficients are calculated only for the vertex at each cluster center, as indicated in block  12 . Then the spherical harmonic coefficients are interpolated across the body of the cluster to get the approximated spherical harmonic coefficients for each vertex in that cluster, as indicated in block  14 . Finally, the dot product of the spherical harmonic coefficient vectors is taken within a three dimensional rendering pipeline, each time the depicted object is being drawn, as indicated in block  16 . 
         [0014]    The interpolation to obtain the spherical harmonic coefficients for the actual vertices may be done using any form of interpolation, but, generally, may involve multivariate interpolation or spatial interpolation, which amounts to interpolation on functions of more than one variable. Examples of non-uniform grid multivariate interpolation techniques that may be utilized include nearest-neighbor, natural neighbor, inverse distance waiting, and Kriging. Neural networks can also be used in some embodiments. 
         [0015]    Kriging is a group of techniques to interpolate the value of a random field at an unobserved location from observations of its value at nearby locations. With Kriging, a function may be written as a decomposition in certain basis. As one example, the basis may be a Gaussian distribution. However, other non-Gaussian distributions may be utilized as well. 
         [0016]    Referring to  FIG. 2 , in accordance with one embodiment, an apparatus  40 , such as a graphics chip set, a graphics engine, or a graphics processor, may include an interpolator  42  coupled to a processor  44 . In one embodiment, the processor  44  calculates the spherical harmonic coefficient of a representative vertex of a group of vertexes such as vertices grouped in a cluster. Then the interpolator  42  interpolates the spherical harmonic coefficients across the cluster to get the approximated spherical coefficients for the other vertices in the cluster. 
         [0017]    Let ƒ({right arrow over (x)} i ) be known spherical harmonic (SH) coefficient values at cluster center positions, represented by a column vector in three dimensional space {right arrow over (x)} i . The parameter ƒ is a hypothetical true SH coefficient value at some point. The parameter ƒ* is an estimation of that unknown value ƒ. The estimated value ƒ* at any point {right arrow over (x)} may be written as: 
         [0000]    
       
         
           
             
               
                 f 
                 * 
               
                
               
                 ( 
                 
                   x 
                   → 
                 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 i 
               
                
               
                 
                   C 
                   i 
                 
                  
                 
                   
                     
                       F 
                       i 
                     
                      
                     
                       ( 
                       
                         x 
                         → 
                       
                       ) 
                     
                   
                   . 
                 
               
             
           
         
       
     
         [0000]    The functions 
         [0000]    
       
         
           
             
               
                 F 
                 i 
               
                
               
                 ( 
                 
                   x 
                   → 
                 
                 ) 
               
             
             = 
             
               exp 
               ( 
               
                 - 
                 
                   
                     
                       ( 
                       
                         
                           x 
                           → 
                         
                         - 
                         
                           
                             x 
                             → 
                           
                           i 
                         
                       
                       ) 
                     
                     2 
                   
                   
                     r 
                     i 
                     2 
                   
                 
               
               ) 
             
           
         
       
     
         [0000]    are basis functions, which are Gaussian distribution curves around {right arrow over (x)} i . The value r i  is a cluster radius. Coefficients of decomposition C i  may be found as a solution of the linear system, supposing that evaluated function values at given points equal to exactly known values: 
         [0000]    
       
         
           
             
               
                 C 
                 i 
               
               = 
               
                 
                   ∑ 
                   j 
                 
                  
                 
                   
                     A 
                     ij 
                     + 
                   
                    
                   
                     f 
                      
                     
                       ( 
                       
                         
                           x 
                           → 
                         
                         j 
                       
                       ) 
                     
                   
                 
               
             
             , 
             
               
 
             
              
             
               
                 A 
                 ij 
               
               = 
               
                 
                   
                     F 
                     i 
                   
                    
                   
                     ( 
                     
                       
                         x 
                         → 
                       
                       j 
                     
                     ) 
                   
                 
                 . 
               
             
           
         
       
     
         [0018]    In Kriging, the value of an unknown real valued function ƒ, at a point, x*, given the values of the function at some other points, X 1 , . . . , X n , may be accomplished using a Kriging estimator that is linear because the predicted value ƒ*(x*) is a linear value, as indicated above. 
         [0019]    The pseudoinverse matrix A ij   +  may be used to compute a best fit or least square solution to a system of linear equations such as the Kriging equations. The pseudoinverse is a generalization of an inverse matrix. The pseudoinverse is defined and unique for all matrices whose entries are real or complex numbers. The pseudoinverse can be computed using singular value decomposition. 
         [0020]    Let A be a square N×N matrix of real numbers. Then the following factorization of the form exists: 
         [0000]    
       
      
       A=U·Σ·V*,  
      
     
         [0000]    where U is the square N×N unitary matrix, the matrix Σ is the square N×N diagonal matrix, and V* denotes the conjugate transpose of V. The pseudo inverse of the matrix A is computed in the following way 
         [0000]    
       
      
       A 
       + 
       =U·Σ 
       + 
       ·V*,  
      
     
         [0000]    where Σ +  is Σ with every nonzero entry replaced by its reciprocal. 
         [0021]    In some embodiments, because the spherical harmonic coefficient computation can be performed independently for different points, a conventional algorithm scales well with the use of multiple central processing unit cores. 
         [0022]    The graphics processing techniques described herein may be implemented in various hardware architectures. For example, graphics functionality may be integrated within a chipset. Alternatively, a discrete graphics processor may be used. As still another embodiment, the graphics functions may be implemented by a general purpose processor, including a multicore processor. 
         [0023]    Referring to  FIG. 3 , a processor-based system  20  may include a general-purpose processor  52  coupled to a graphic chip set  28  in one embodiment. The graphic chip set may be coupled to a system memory  30  and a graphics processor  22 . In one embodiment, the graphics processor  22  may be a multi-core processor. The graphics processor  22  is coupled to a frame buffer  24 , in turn coupled to a display  26 . In one embodiment, the lighting sequence  34  shown in  FIG. 1  may be implemented as software stored in a computer-readable medium, such as the system memory  30 . However, embodiments of the present invention may be also implemented in hardware or firmware. 
         [0024]    References throughout this specification to “one embodiment” or “an embodiment” mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one implementation encompassed within the present invention. Thus, appearances of the phrase “one embodiment” or “in an embodiment” are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be instituted in other suitable forms other than the particular embodiment illustrated and all such forms may be encompassed within the claims of the present application. 
         [0025]    While the present invention has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present invention.