Abstract:
Trimmed NURBs may be rendered on a graphics processor rather than on a central processing unit. This may greatly reduce the amount of information that needs to be sent to the graphics processor from the central processing unit, in some embodiments.

Description:
BACKGROUND 
       [0001]    This relates generally to rendering images in processor-based systems. 
         [0002]    In order to depict complex geometric shapes, those shapes must be represented in mathematical form. In graphics, splines have a parameter value t that varies from zero to one across a surface. The spline may be represented by an equation that weights neighboring points and describes how to combine them to create a curve segment. 
         [0003]    Typically, an entire surface is determined by a combination of splines in three-dimensional space. Thus, a change in one point results in modification of a part of the surface whose size grows proportionally to the degree of the polynomial. 
         [0004]    A B-spline is a curved surface representation. A B-spline provides local control and influence for its various control points. B-splines have the same continuity as natural splines, but they do not interpolate their control points. A control point is a vertex in a polygon that is used to represent shapes of geometric images. The B in B-splines stands for “basis” since the B-splines can be represented as weighted sums of polynomial basis functions. 
         [0005]    A rational B-spline is a ratio of polynomials. A non-uniform rational B-spline or NURB is characterized by the non-uniform location of so-called knots. The knots are the starting values for the spline parameters along a curved segment. By having successive knot values have the same starting value, the curvature of the surface may be affected at that particular point in space. 
         [0006]    If knots are evenly spaced, the surface would be referred to as uniform. Non-uniform in NURB means that the knot positions may not be evenly spaced. 
         [0007]    A trimmed non-uniform rational B-spline or trimmed NURB is arrived at by defining curves on the surface of the NURB and cutting holes in the NURB surface. NURBs allow the representation of high fidelity curved geometries used in games, computer aided design, scientific visualization, and movies. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0008]      FIG. 1  is a system depiction for one embodiment; and 
           [0009]      FIG. 2  shows the operations on the central processing unit side and graphics processing unit side in the system of  FIG. 1  in accordance with one embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0010]    In accordance with some embodiments, trimmed NURBs may be generated by a graphics processor. This avoids the need to send complex graphics information back and forth between the central processing unit and the graphics processor. Such transfers use up available bandwidth and make rendering of complex shapes impractical. 
         [0011]    Referring to  FIG. 1 , a typical graphics pipeline provides rendered graphics from a graphics processor  112  over a link  106  to a frame buffer  114  for display via link  107  on a display screen  118 . The graphics processor  112  may be coupled by a bus  105 , such as a Peripheral Component Interconnect (PCI) bus, to a chipset core logic  110 . The graphics processor  112  may be a multicore processor. The core logic  110  is coupled to a main processor or central processing unit (CPU)  100 . The central processing unit may be one or more processors that handle a variety of processing functions of a computer system, while the graphics processor is dedicated to graphics functions. The core logic may also be coupled to removable medium  136 , hard drives  134 , and main memory  132 , which may store a program  139 . The core logic  110  may be coupled by a link  108  to a keyboard or mouse  120  for control of the display. The program  139  may be made up of instructions that are executed by the processor  100  or the processor  112 . Thus, the main memory  132  constitutes one example of a computer readable medium that may store executable instructions in accordance with some embodiments of the present invention. 
         [0012]    Referring to  FIG. 2 , the operations on the CPU  100  and graphics processor unit  112 , via the intervening bus  105 , are depicted. Initially, the central processing unit  100  loads in the control points. The control points are the vertices of the polygons that make up the digital image. Then, the processor  100  loads in the trimming curves. The trimming curves are the curves that can be used to trim patches to create curve shapes. 
         [0013]    An analogy to a patch is a square piece of paper. The piece of paper can be folded or crumpled, but it is still always a square piece of paper. Folding or crumpling the square piece of paper does not make it round. Instead, if a circle is cut out of the paper square, the piece of paper can be made round. 
         [0014]    A NURB is a parametric surface in three-dimensional space. Complex surfaces are made up of patches and each patch is a set of points corresponding to a certain pair of parameters u and v, where both u and v are greater than or equal to zero and less that or equal to one. 
         [0015]    So, in parametric space, a patch is equivalent to the square piece of paper. By transferring the parameters u and v into three-dimensional space, the patches are reshaped, but the patches cannot be made round, any more than you can make the piece of paper round by folding it or crumpling it. A patch is made round by trimming. 
         [0016]    A cut is made in parametric space and this cut is called a trimming curve (or a trimming circle if the cut is round or a trimming line if the cut is straight). A circular cut generates two surfaces. The first surface is the outside part of the cut (which corresponds to the square piece of paper with a circular hole in it). The second surface is the inside part, which is the disk that is cut out. 
         [0017]    Thus, the trimming curves are loaded by the processor  100 . The pre-calculations for trimming are also done in the processor  100 , as indicated in block  66 . In the vertex and index buffer, the vertex and index data is calculated on the fly in the processor  100 , as indicated at block  64 . The control points and resulting trimming curves are transferred over the bus  105  to the graphics processor  112  and, particularly, to its vertex shader  68 . 
         [0018]    The graphics processor&#39;s vertex shader then does the tessellation of the NURBs using the transferred control points. The vertex shader in block  68  also transforms the vertices. The vertex shader  68  works as follows. The vertex shader does a calculation of a variable, float 2  col which is equal to float 2  ((float(vertld%g_size))/g_size, (float (vertld/g_size))/g_size). Vertld is the number of the input vertices within the range [0,g_size*g_size]. There are g_size*g_size vertices in total. This number of vertices (vertld) corresponds to the uniform division of [u,v] which is less than or equal to one and greater than or equal to zero in a NURBs parameter space. This step sets up the correspondence between the vertex number and position inside a square. 
         [0019]    The next step is float 4  res 4  equals EvalSurface (col. x, col. y). For a given position inside the square (col) the transformation (u,v)→(x,y,z) is done by evaluation of a point on a NURB surface. The contents of the EvalSurface ( ) function is a well known method of evaluating a point on a surface. The rest of the vertex shader passes input parameters to further stages of the graphics pipeline. 
         [0020]    The geometry shader, at block  70 , then trims the NURBs using the trimming curves transferred from the central processing unit  100 , as also indicated in block  70 . To the extent the trimming curves intersect, they are culled along the trim to simplify pieces of the trimming curve obtained by the intersection of two or more trimming segments inside a triangle. 
         [0021]    The geometry shader works as follows. First, a vertex normal is computed as follows: 
         [0000]      float3 normal=normalize(cross(edge1, edge2)); 
         [0000]    If the triangle has to be trimmed as a whole, no output is produced. 
         [0022]    If the red (r), green (g), and blue (b) components of the vectors m_trim 1  and m_trim 2  may contain information about intersections between a trimming curve and adjacent edges to vertices of the processed triangle is determined in the following pseudo code: 
         [0000]    
       
         
               
             
           
               
                   
               
             
             
               
                 if( ( input[0].m_trim1.r || input[0].m_trim1.g || input[0].m_trim1.b || 
               
               
                   input[0].m_trim2.r || input[0].m_trim2.g || input[0].m_trim2.b ) &amp;&amp; 
               
               
                   ( input[1].m_trim1.r || input[1].m_trim1.g || input[1].m_trim1.b || 
               
               
                   input[1].m_trim2.r || input[1].m_trim2.g || input[1].m_trim2.b ) &amp;&amp; 
               
               
                   ( input[2].m_trim1.r || input[2].m_trim1.g || input[2].m_trim1.b || 
               
               
                   input[2].m_trim2.r || input[2].m_trim2.g || input[2].m_trim2.b ) ) 
               
               
                   
               
             
          
         
       
     
         [0023]    Then, all the pairs of vertices are processed to find intersected edges using information about the intersections in the form of the vectors m_trim 1  and m_trim 2 . As a result, an output triangle or quadrangle is produced, depending on how the processed triangle was intersected: 
         [0000]    
       
         
               
             
           
               
                   
               
             
             
               
                 output.m_posPS = input[tri_compl].m_posPS; 
               
               
                 output.m_posOS = input[tri_compl].m_posOS; 
               
               
                 TriStream.Append( output ); 
               
               
                 output.m_posPS = 
               
               
                 input[tri_compl].m_posPS*coefs[0]+input[nbors[0]].m_posPS*coefs[1]; 
               
               
                 output.m_posOS = 
               
               
                 input[tri_compl].m_posOS*coefs[0]+input[nbors[0]].m_posOS*coefs[1]; 
               
               
                 TriStream.Append( output ); 
               
               
                 output.m_posPS = 
               
               
                 input[tri_compl].m_posPS*coefs[2]+input[nbors[1]].m_posPS*coefs[3]; 
               
               
                 output.m_posOS = 
               
               
                 input[tri_compl].m_posOS*coefs[2]+input[nbors[1]].m_posOS*coefs[3]; 
               
               
                 TriStream.Append( output ); 
               
               
                   
               
             
          
         
       
     
         [0024]    The result of the above code is an output triangle. One of the vertices of the output triangle is a vertex of the processed triangle (input [tri_comp 1 ]). Two other vertices are the points of intersection between the edges of the processed triangles and the trimming curve. In some cases, the processed triangle does not have to be trimmed out as a whole and it does not contain intersection points as processed above. This means that all the vertices are outside the trimmed parts and they just pass through: 
         [0000]    
       
         
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 { 
               
               
                   
                   output.m_posPS = input[0].m_posPS; 
               
               
                   
                   output.m_posOS = input[0].m_posOS; 
               
               
                   
                   TriStream.Append( output ); 
               
               
                   
                   output.m_posPS = input[1].m_posPS; 
               
               
                   
                   output.m_posOS = input[1].m_posOS; 
               
               
                   
                   TriStream.Append( output ); 
               
               
                   
                   output.m_posPS = input[2].m_posPS; 
               
               
                   
                   output.m_posOS = input[2].m_posOS; 
               
               
                   
                   TriStream.Append( output ); 
               
               
                   
                 } 
               
               
                   
                   
               
             
          
         
       
     
         [0025]    Then, the graphics processor sends these new polygons to the pixel shader  72 . The pixel shader rasterizes them and renders them to the display  188 . 
         [0026]    In some embodiments, geometrical, as opposed to visual, trimming is used. In some embodiments, trimming may be accomplished in a single pass. In one embodiment, control points of a mesh to be tessellated are transferred to the graphics pipeline, as opposed to transferring an entire set of polygons. In some embodiments, the geometry shader performs the trimming or tessellated NURB patch, as opposed to using a neutral processing unit. 
         [0027]    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. 
         [0028]    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. 
         [0029]    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.