Abstract:
In order to efficiently backface cull rendering primitives during computer graphics rendering, it is important to be sure that the rendering primitives to be culled are guaranteed to be backfacing even if the primitives are moving or are undergoing defocus blur. Therefore, we derive conservative tests that determine if a moving and defocused triangle is backfacing over an entire time interval and over the area of a lens. In addition, we present tests for the special cases of only motion blur and only depth of field.

Description:
BACKGROUND 
     This relates to graphics processing and, particularly, to motion blur and depth of field rendering. 
     Motion blur is the effect where moving objects appear blurred when captured with long camera exposure times. Depth of field is the effect that a larger aperture has a shorter focus range, and objects out of focus appear blurred. 
     One of the most important culling tests is backface culling. Backface culling eliminates rasterization processing of objects that face away from the camera. A rendering primitive can be backface culled if its face normal makes an angle of more than 90 degrees with the camera view vector. By culling these rendering primitives, unnecessary processing may be reduced. 
     When rendering motion blur and depth of field, an excessive amount of inside or intersection tests can be generated, and therefore, accurate backface culling tests are needed also for these contexts. For moving triangles, where each vertex moves along a line in three dimensions, a moving triangle is commonly assumed to be backfacing over the entire time interval if the triangle is backfacing at the start of the motion and at the end. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  is a flow chart for one embodiment; 
         FIG. 2  is a flow chart for another embodiment; 
         FIG. 3  is a flow chart for yet another embodiment; and 
         FIG. 4  is a schematic depiction for one embodiment. 
     
    
    
     DETAILED DESCRIPTION 
     A triangle where each vertex moves linearly in 3D can be backfacing (i.e. facing away from the camera) at the start of the motion (at t=0), then turn frontfacing, and then (again) backfacing at the end of the motion (at t=1). As a result, the assumption that a triangle whose vertices move linearly in time, is backfacing if the backfacing status is true at the start and end of the interval, is not always correct. 
     Assume that we have a moving triangle, where the vertices move linearly within a frame, from time t=0 to t=1. At t=0, we denote the vertices q i  and at t=1 we call them r i . We work in clip space, using 2D homogeneous coordinates (2DH), so a vertex is defined as p=(p x ,p y ,p w ). A linearly interpolated vertex is then expressed as:
 
 p   i ( t )=(1− t ) q   i   +tr   i .  (1)
 
Given a moving triangle with vertices (p 0 (t),p 1 (t),p 2 (t)), we form the matrix:
 
                       M   ⁡     (   t   )       =     [           p   ⁢           ⁢     0   x             p   ⁢           ⁢     1   x             p   ⁢           ⁢     2   x                 p   ⁢           ⁢     0   y             p   ⁢           ⁢     1   y             p   ⁢           ⁢     2   y                 p   ⁢           ⁢     0   w             p   ⁢           ⁢     1   w             p   ⁢           ⁢     2   w             ]       ,           (   2   )               
where we have omitted the temporal dependence for readability. The triangle can be backface culled if det(M)&lt;0, where the determinant is expressed as:
 
 det ( M )= p   0 ·( p   1   ×p   2 ).  (3)
 
     Geometrically, this can be interpreted as a (scaled) signed volume computation of the tetrahedron spanned by the origin and the triangle. Thus, we want to determine if p 0 (t)·(p 1 (t)×p 2 (t))&lt;0 for tε[0,1]. The cross product of two linearly moving vertices can be expanded as:
 
 p   1   ×p   2 =((1− t ) q   1   +tr   1 )×((1− t ) q   2   +tr   2 )= t   2   f+tg+h,   (4)
 
where:
 
 f =( r   1   −q   1 )×( r   2   −q   2 ),
 
 g =( r   1   −q   1 )× q   2 −( r   2   −q   2 )× q   1 ,
 
 h=q   1   ×q   2 .  (5)
 
Using this expression, we can derive the time-dependent determinant:
 
                           det   ⁡     (   M   )       =       ⁢         p   0     ⁡     (   t   )       ·     (         p   1     ⁡     (   t   )       ×       p   2     ⁡     (   t   )         )                   =       ⁢       (         (     1   -   t     )     ⁢     q   0       +     tr   0       )     ·     (         t   2     ⁢   f     +   tg   +   h     )                     =       ⁢       at   3     +     bt   2     +   ct   +   d       ,                 (   6   )               
where:
 
 a =( r   0   −q   0 )· f,  
 
 b =( r   0   −q   0 ) g+q   0   ·f,  
 
 c =( r   0   −q   0 ) h+q   0   ·g,  
 
 d=q   0   ·h.   (7)
 
Note that the coefficient d=q 0 ·h=q 0 ·(q 1 ×q 2 ) is the backface test for the triangle at t=0. Also, the value of the polynomial at t=1 is a+b+c+d=r 0 ·(r 1 ×r 2 ), which, analogously, is the backface test at t=1. Finally, note that the expression for the coefficient:
 
 a =( r   0   −q   0 )[( r   1   −q   1 )×( r   2   −q   2 )],  (8)
 
is the determinant test for the motion vectors of the three vertices, and if they all lie in the same plane, the cubic term is zero, i.e., a=0. Thus, it is only when the motion vectors span a volume in 2DH that the determinant will be a cubic function.
 
     We note that if the polynomial does not have any roots in tε[0,1] and d&lt;0, then the triangle can be safely backface culled. Given that the backface function is below zero at t=0 and t=1, we can compute the local minimum and maximums of the cubic polynomial, and if we find a local maximum within the interval tε[0,1], we check the value of the cubic polynomial at this point. If it is below zero, we can safely backface cull the triangle. If the motion direction of the three vertices are parallel, the backfacing function is linear. 
     The coefficient a is the determinant of the triangle&#39;s three motion vectors, which are often small or near parallel. Therefore, directly computing the backfacing function on power form (Equation 6) can be numerically unstable. To alleviate this problem, we express the backfacing function on cubic Bernstein form: 
                       b   ⁡     (   t   )       =       ∑     i   =   0     3     ⁢         b   i     ⁡     (         3           i         )       ⁢       (     1   -   t     )       3   -   i       ⁢     t   i           ,           (   9   )               
with coefficients, b i , given by:
 
 b   0   =q   0 ·( q   1   ×q   2 )
 
 b   1 =⅓ [q   0 ·( q   1   ×r   2   +r   1   ×q   2 )+ r   0 ·( q   1   ×q   2 )],
 
 b   2 =⅓[ r   0 ·( q   1   ×r   2   +r   1   ×q   2 )+ q   0 ·( r   1   ×r   2 )],
 
 b   3   =r   0 ·( r   1   ×r   2 ).  (10)
 
     Next, we exploit the convex hull property of the Bernstein basis, and simply check if any of the coefficients, b i , iε{0, 1, 2, 3}, are positive. This is a coarser test than testing against the true maximum of the cubic polynomial, but reduces the risk of numerical precision issues. Note that the test can be refined by applying de Casteljau steps to the coefficients and testing the generated coefficients. 
     A backface test for motion blur on Bernstein form, shown in  FIG. 1 , begins by testing a triangle at t=0 by computing b 0  (block  12 ). A check at diamond  14  determines whether b 0  is positive. If so, the triangle is front facing (block  16 ). Otherwise, the triangle is tested at t=1 by computing b n  (block  18 ). If b n  is positive, then the triangle is front facing (block  22 ). Otherwise, begin a loop by putting the value 1 into i (block  24 ), and computing b i  (block  26 ). A check at diamond  28  determines if b i  is positive. If so, it is front facing (block  30 ). If not, iterate until i equals n (block  32  and diamond  34 ) and then report the triangle as backfacing (block  36 ). 
     We sketch a practical implementation of the backface culling test for triangles where each vertex moves linearly in time in the pseudo code: 
     
       
         
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
               
               
               
             
           
               
                   
                   
               
             
             
               
                   
                  1 
                 movingTriIsBackfacing(const TimeContTri&amp; tri) { 
               
             
          
           
               
                   
                  2 
                 b0 = det(M(t=0)) 
               
               
                   
                  3 
                 if b0 &gt; 0 
               
             
          
           
               
                   
                  4 
                 return false 
               
             
          
           
               
                   
                  5 
                 b3 = det(M(t=1)) 
               
               
                   
                  6 
                 if b3 &gt; 0 
               
             
          
           
               
                   
                  7 
                 return false 
               
             
          
           
               
                   
                  8 
                 compute b1 
               
               
                   
                  9 
                 if b1 &gt; 0 
               
             
          
           
               
                   
                 10 
                 return false 
               
             
          
           
               
                   
                 11 
                 compute b2 
               
               
                   
                 12 
                 if b2 &gt; 0 
               
             
          
           
               
                   
                 13 
                 return false 
               
             
          
           
               
                   
                 14 
                 return true 
               
             
          
           
               
                   
                 15 
                 } 
               
               
                   
                   
               
             
          
         
       
     
     If the triangle vertex motion can be expressed as a polynomial, we can generalize the previous test. We express the motion of each triangle vertex as a Bézier curve of degree n in 2DH: 
                       p   i     ⁡     (   t   )       =       ∑     j   =   0     n     ⁢       b   j   i     ⁢       B   j   n     ⁡     (   t   )                   (   11   )               
The backface test then becomes:
 
                           det   ⁡     (     M   ⁡     (   t   )       )       =       ⁢         p   0     ⁡     (   t   )       ·     (         p   1     ⁡     (   t   )       ×       p   2     ⁡     (   t   )         )                   =       ⁢       ∑     i   =   0     n     ⁢       b   i   0     ⁢         B   i   n     ⁡     (   t   )       ·     (       ∑     j   =   0     n     ⁢       b   j   1     ⁢       B   j   n     ⁡     (   t   )       ×       ∑     k   =   0     n     ⁢       b   k   2     ⁢       B   k   n     ⁡     (   t   )               )                       =       ⁢       ∑     i   ,   j   ,     k   =   0       n     ⁢         B   i   n     ⁡     (   t   )       ⁢       B   j   n     ⁡     (   t   )       ⁢       B   k   n     ⁡     (   t   )       ⁢       b   i   0     ·     (       b   j   1     ×     b   k   2       )                       =       ⁢       ∑     i   ,   j   ,     k   =   0       n     ⁢       B     i   +   j   +   k       3   ⁢   n       ⁢         (         n           i         )     ⁢     (         n           j         )     ⁢     (         n           k         )         (           3   ⁢   n               i   +   j   +   k           )       ⁢       b   i   0     ·       (       b   j   1     ×     b   k   2       )     .                         (   12   )               
Note that this is a Bézier curve of degree 3n, where the control points are sums of scaled determinants of three control points, one from each of the three curves describing the vertex motion. A conservative backface test can again be derived by using the convex hull property. As expected, we obtain Equation 10 for the linear motion case, i.e., when n=1. A similar derivation can be performed for rational splines.
 
     The test has potential to speed up motion blur rasterization of macro-sized triangles, or small triangles with large motion, where one expensive backface culling test can be amortized over a lot of saved inside tests. If the number of inside tests is small in relation to the overhead of the conservative backface culling test, it may be better to skip the conservative test entirely, as backfacing triangles will be correctly culled in the per-sample inside test. Depending on the workload, the test could be enabled when the triangle sizes or the motion surpasses a threshold value. 
     Depth of field is a shear in clip space. This shear can be represented by applying the matrix: 
                       S   ⁡     (     u   ,   v     )       =     (         1       0           -   Hu     /   J         Hu           0       1           -   Iv     /   J         Iv           0       0       1       0           0       0       0       1         )       ,           (   13   )               
to the clip space coordinates of the triangle. H, I and J are constants given by the location of the focal plane, the camera aperture size and the near and far plane. The location on the lens is given by (u,v). Applying this matrix to a the three-dimensional homogeneous vertex (3DH), {circumflex over (p)} i =(p ix ,p iy p iz ,p iw ), in clip space results in a sheared position, ŝ i (u,v):
 
 s   ix   =p   ix   −H/Jup   iz   +Hup   iw   =p   ix +α i   u,  
 
 s   iy   =p   iy   −I/Jvp   iz   +Ivp   iw   =p   iy +β i   v,  
 
 s   iz   =p   iz   ,  
 
 s   iw   =p   iw   (14)
 
where α i =H/Jp iz +Hp iw  and β i =I/Jp iz +Ip iw  are per-vertex values dependent on the p iz  and p iw  terms. To simplify notation below, we let s i (u,v) and p i (u,v) denote the two-dimensional homogeneous vertices, consisting of the xyw components of ŝ i (u,v) and {circumflex over (p)} i  respectively, that is:
 
 s   i ( u,v )= p   i +(α i   u,β   i   v, 0)= p   i   +l   i ( u,v )  (15)
 
Note that:
 
 l   i   ×l   j   =uv (0,0,α i β j −α j β i )=0  (16)
 
since
 
               α   i     =       H   I     ⁢       β   i     .             
The backfacing criterion then becomes:
 
                             det   ⁡     (     M   ⁡     (     u   ,   v     )       )       =       ⁢       s   0     ·     (       s   1     ×     s   2       )         ,                 =       ⁢         p   0     ·     (       p   1     ×     p   2       )       +       1   0     ·     (       p   1     ×     p   2       )           ,         +     1   1       ·     (       p   2     ×     p   0       )       +                     ⁢         1   2     ·     (       p   0     ×     p   1       )       ,                 =       ⁢     au   +   bv   +     c   .                     (   17   )               
The coefficients are given by:
 
 a=α   0 ( p   1   ×p   2 ) x +α 1 ( p   2   ×p   0 ) x +α 2 ( p   0   ×p   1 ) x   ,  
 
 b=β   0 ( p   1   ×p   2 ) y +β 1 ( p   2   ×p   0 ) y +β 2 ( p   0   ×p   1 ) y   ,  
 
 c=p   0 ·( p   1   ×p   2 ).  (18)
 
We note that some expressions for a and b can be reused for the edge equation setup. As can be seen, the backfacing function for depth of field is a linear function in u and v (Equation 17). The triangle changes its facing when au+bv+c=0. Hence, the triangle will change its facing somewhere on the lens only if there is a solution to the following system of equations:
 
 au+bv+c= 0,
 
 u   2   +v   2   &lt;R   2 ,  (19)
 
where the last equation checks whether the lens position, (u,v), is inside a circular lens with radius, R. Geometrically, this is an intersection between a circle and a line, which has a solution only if:
 
     
       
         
           
             
               
                 
                   
                     
                       c 
                       2 
                     
                     
                       
                         a 
                         2 
                       
                       + 
                       
                         b 
                         2 
                       
                     
                   
                   &lt; 
                   
                     
                       R 
                       2 
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   20 
                   ) 
                 
               
             
           
         
       
     
     Consequently, if we can prove that the above does not hold, there are no face changes when moving over the lens. Intuitively, the triangle will not change facing over the lens if the triangle&#39;s plane equation (in three dimensions) does not intersect with the shape of the lens. 
     Finally, note that if the triangle&#39;s face normal is aligned with the view vector, we have p iz =p jz  and p iw =p jw , and therefore α i =α j  and β i =β j , which leads to a=b=0. This means that facing will not change over the lens, as expected. 
     To determine if a static triangle can be backface culled, we start with computing the backface status at the at the middle of the lens (u=v=0),  FIG. 2 , block  42 . If c&gt;0 ( FIG. 2 , diamond  44 ), the triangle may be frontfacing for some time at the center of the lens, and therefore our test is terminated since the triangle is not (conservatively) backfacing for all lens positions ( FIG. 2 , block  46 ). Otherwise, compute a 2 +b 2  ( FIG. 2 , block  48 ) and test whether c 2 &lt;R 2 (a 2 +b 2 ) (block  50  and diamond  52 ). That is, the triangle can be conservatively backface culled ( FIG. 2 , block  56 ) when:
 
 c&lt; 0,
 
and
 
 c   2   ≧&gt;R   2 ( a   2   +b   2 )  (21)
 
Otherwise, the triangle is front facing (block  54 ).
 
     By multiplying the moving vertex in Equation 1 with the shear matrix, S, in Equation 13, the resulting vertex displacement from motion and depth of field, o(u,v,t), is obtained: 
                             o   i     ⁡     (     u   ,   v   ,   t     )       =       ⁢       S   ⁡     (     u   ,   v     )       ⁢       p   i     ⁡     (   t   )                       =       ⁢       S   ⁡     (     u   ,   v     )       ⁢     (         (     1   -   t     )     ⁢     q   i       +     tr   i       )         ,                 =       ⁢     (           p   ix     ⁡     (   t   )       +         α   i     ⁡     (   t   )       ⁢   u       ,         p   iy     ⁡     (   t   )       +         β   i     ⁡     (   t   )       ⁢   v       ,       p   iw     ⁡     (   t   )         )       ,                 (   22   )               
where α i (t)=H/Jp iz (t)+Hp iw (t) and β i (t)=I/Jp iz (t)+Ip iw (t) are linear functions in t.
 
     The corresponding backface test from Equation 21 is now expressed as: 
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           det 
                           ⁡ 
                           
                             ( 
                             
                               M 
                               ⁡ 
                               
                                 ( 
                                 
                                   u 
                                   , 
                                   v 
                                   , 
                                   t 
                                 
                                 ) 
                               
                             
                             ) 
                           
                         
                         = 
                           
                         ⁢ 
                         
                           
                             o 
                             0 
                           
                           · 
                           
                             ( 
                             
                               
                                 o 
                                 1 
                               
                               × 
                               
                                 o 
                                 2 
                               
                             
                             ) 
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                           
                             
                               a 
                               ⁡ 
                               
                                 ( 
                                 t 
                                 ) 
                               
                             
                             ⁢ 
                             u 
                           
                           + 
                           
                             
                               b 
                               ⁡ 
                               
                                 ( 
                                 t 
                                 ) 
                               
                             
                             ⁢ 
                             v 
                           
                           + 
                           
                             
                               c 
                               ⁡ 
                               
                                 ( 
                                 t 
                                 ) 
                               
                             
                             . 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   23 
                   ) 
                 
               
             
           
         
       
     
     The coefficients a(t), b(t), and c(t) are cubic functions in t. 
     The triangle can be conservatively backface culled when:
 
 c ( t )&lt;0, tε[ 0,1]
 
and
 
 c   2 ( t )&gt; R   2 ( a   2 ( t )+ b   2 ( t )), tε[ 0,1].  (24)
 
Otherwise, the triangle is front facing (block  54 ).
 
     A conservative test can be obtained by using interval arithmetic. We denote an interval as {circumflex over (x)}=[ x ,  x ], where  x  is its lower bound and  x  is the upper boundary. The idea is then to minimize the expression to the left of the greater than sign in Equation 24, and to maximize the expression to the right. This results in:
 
   c     2   R   2 (max(   a     2   ,ā   2 )+max( b b     2   ,  b     2 )),  (25)
 
where we used  c &lt;0           min( c   2 ,  c   2 )=  c   2 ). So, if  c &lt;0 and Equation 25 hold, the triangle, moving in time and over the lens, can be conservatively backface culled. The cubic polynomials a(t), b(t) and c(t) can be converted from power form to Bernstein form, and then we use the convex hull property of the Bernstein control points for conservative culling, similar to what we did previously for motion blurred primitives.

     If we approximate the lens with a square with side length R, we get a coarser test given by the equations:
 
 au+bv+c= 0,
 
| u|&lt;R,|v|&lt;R,   (26)
 
which is a line against box test. Again, we start by testing whether ĉ&lt;0, i.e., whether the triangle is backfacing on the center of the lens. Then, if the four corners of the (square) lens all are on the same side of the swept line, we can conservatively cull the triangle. These four conditions are given by:
 
max(± R ( a±b )± c )&lt;0.  (27)
 
Note that the expressions a, b and c are cubic polynomials in t. Unlike the interval analysis test given for the circular lens, we can, for each of the four equations, compute the coefficients for a single cubic equation and bound it, therefore retaining the correlation between the power coefficients for tighter bounds. This may be more efficient for motion with large non-linear coefficients.
 
     Next, we sketch a practical implementation of the backface culling test for motion blurred and defocused triangles. We first note that a coarse, but fast approximation of a 2 (t)+b 2 (t) is given by:
 
max( a   2   +b   2 )≦max(   a     2   ,ā   2 )+max(   b     2   ,  b     2 ),  (28)
 
which essentially is a Manhattan distance approximation.
 
     However, we will instead bound the cubic functions using first-order Taylor models, since the correlation in the linear terms can be preserved, which in turn can give tighter bounds. We also note that the t 3  and t 2  terms of the polynomial a(t) and b(t) are very close to zero for most triangles. This implies that the a(t), b(t) and c(t) terms in Equation 23 are approximately linear, but it also means that care must be taken to avoid precision issues. By using first-order Taylor models, we ensure stability when the t 3  and t 2  terms are small. For an arbitrary cubic polynomial, this is done as shown below:
 
 k   3   t   3   +k   2   t   2   +k   1   t+k   0   ≈k   1   t+k   0   +{circumflex over (r)}   k ,  (29)
 
where {circumflex over (r)} is a remainder interval, which bounds the quadratic and cubic terms:
 
 {circumflex over (r)}   k   =[−|k   3   |−|k   2   |,|k   3   |+|k   2 |].  (30)
 
     We use this to conservatively express a 2 (t)+b 2 (t) as:
 
 a   2 ( t )+ b   2 ( t )≈( a   1   t+a   0   +{circumflex over (r)}   a ) 2 +( b   1   t+b   0   +{circumflex over (r)}   b ) 2 .  (31)
 
The upper bound is given by:
 
 a   1   2   +b   1   2 max(0, a   0   a   1   +b   0   b   1 )+ a   0   2   +b   0   2   +  r     a     2     +b     2   ,  (32)
 
where  r   a     2     +b     2    is a linear function in the remainder intervals {circumflex over (r)} a  and {circumflex over (r)} b . Note that if a(t) and b(t) are linear in t,{circumflex over (r)} a ={circumflex over (r)} b =0, which gives  r   a     2     +b     2   =0, so Equation 32 is exact in that case. We use the backface test for motion blur (on Bernstein basis) to determine the backface status at the center of the lens as described above.
 
     The final test is given by the conditions in Equation 34, where a 2 (t)+b 2 (t) is bounded using Equation 32. 
     Referring to  FIG. 3 , a sequence for implementing a backface test for both depth of field and motion blur begins by testing a triangle at the center of the lens, as indicated in block  62  of  FIG. 3 . This is done by computing and bounding the maximum of c(t). Next, a check at diamond  64  determines whether max[c(t)] is greater than zero. If it is, then the triangles are reported as front facing, as indicated in block  66 . 
     Otherwise, at block  68 , the max[a(t) 2 +b(t) 2 ] is computed and bounded, as indicated in block  68 . Next, a test is done to determine if the minimum of c 2  is greater than R 2 max[a(t) 2 +b(t) 2 ], as indicated in block  70 . If so, at diamond  72 , the triangle is reported as front facing, as indicated in block  74  and, otherwise, it is reported as backfacing in block  76 . 
     We will derive a backface culling test for motion blur where rasterization is done in screen space. For screen-space rasterization, a common backface test is given by the sign of the screen-space area of the triangle. A projective transform maps lines to lines, so the motion vectors are still lines after projection. However, the acceleration along the line is different due to perspective foreshortening. Let us define two edges of the projected triangle as: 
                       e   1     =           p   1     ⁡     (   t   )           p     1   ⁢   w       ⁡     (   t   )         -         p   0     ⁡     (   t   )           p     0   ⁢   w       ⁡     (   t   )             ,     
     ⁢         e   2     ⁡     (   t   )       =           p   2     ⁡     (   t   )           p     2   ⁢   w       ⁡     (   t   )         -           p   0     ⁡     (   t   )           p     0   ⁢   w       ⁡     (   t   )         .                 (   34   )               
Twice the signed area can now be expressed as:
 
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           
                             A 
                             ⁡ 
                             
                               ( 
                               t 
                               ) 
                             
                           
                           = 
                             
                           ⁢ 
                           
                             
                               
                                 e 
                                 1 
                               
                               ⁡ 
                               
                                 ( 
                                 t 
                                 ) 
                               
                             
                             × 
                             
                               
                                 e 
                                 2 
                               
                               ⁡ 
                               
                                 ( 
                                 t 
                                 ) 
                               
                             
                           
                         
                         , 
                       
                     
                   
                   
                     
                       
                         
                           = 
                             
                           ⁢ 
                           
                             
                               
                                 
                                   p 
                                   0 
                                 
                                 
                                   p 
                                   
                                     0 
                                     ⁢ 
                                     w 
                                   
                                 
                               
                               × 
                               
                                 
                                   p 
                                   1 
                                 
                                 
                                   p 
                                   
                                     1 
                                     ⁢ 
                                     w 
                                   
                                 
                               
                             
                             + 
                             
                               
                                 
                                   p 
                                   1 
                                 
                                 
                                   p 
                                   
                                     1 
                                     ⁢ 
                                     w 
                                   
                                 
                               
                               × 
                               
                                 
                                   p 
                                   2 
                                 
                                 
                                   p 
                                   
                                     2 
                                     ⁢ 
                                     w 
                                   
                                 
                               
                             
                             + 
                             
                               
                                 
                                   p 
                                   2 
                                 
                                 
                                   p 
                                   
                                     2 
                                     ⁢ 
                                     w 
                                   
                                 
                               
                               × 
                               
                                 
                                   p 
                                   0 
                                 
                                 
                                   p 
                                   
                                     0 
                                     ⁢ 
                                     w 
                                   
                                 
                               
                             
                           
                         
                         , 
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                           
                             
                               
                                 p 
                                 
                                   2 
                                   ⁢ 
                                   w 
                                 
                               
                               ⁢ 
                               
                                 p 
                                 0 
                               
                               × 
                               
                                 p 
                                 1 
                               
                             
                             + 
                             
                               
                                 p 
                                 
                                   0 
                                   ⁢ 
                                   w 
                                 
                               
                               ⁢ 
                               
                                 p 
                                 1 
                               
                               × 
                               
                                 p 
                                 2 
                               
                             
                             + 
                             
                               
                                 p 
                                 
                                   1 
                                   ⁢ 
                                   w 
                                 
                               
                               ⁢ 
                               
                                 p 
                                 2 
                               
                               × 
                               
                                 p 
                                 0 
                               
                             
                           
                           
                             
                               p 
                               
                                 0 
                                 ⁢ 
                                 w 
                               
                             
                             ⁢ 
                             
                               p 
                               
                                 1 
                                 ⁢ 
                                 w 
                               
                             
                             ⁢ 
                             
                               p 
                               
                                 2 
                                 ⁢ 
                                 w 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   35 
                   ) 
                 
               
             
           
         
       
     
     Recall that each vertex is a function of t (Equation 1), which results in that the backface test in screen space is a cubic rational function in t. The triangle moves in a plane, but the vertex positions are no longer linearly interpolated in t and the triangle can change facing at most three times. 
     Furthermore, the magnitude of the denominator p 0     w   p 1     w   p 2     w    is irrelevant for the area test, so if we know the signs of the w components after clipping, the denominator can be skipped, resulting in a cubic polynomial, similar to the homogeneous case, as expected. 
     On the other hand, if we assume linear motion in screen space, the area function becomes a quadratic polynomial, so even in this case, the moving triangle can be backfacing at t=0 and t=1, and still be frontfacing somewhere in between. 
     Our techniques apply to real-time and offline rendering, and to both stochastic point sampling and analytical visibility methods. The rendering errors introduced by the previous technique can easily be detected in extreme cases, but in the majority of cases, these generate reasonable images, where the error is hard to detect. 
     The computer system  130 , shown in  FIG. 4 , may include a hard drive  134  and a removable medium  136 , coupled by a bus  104  to a chipset core logic  110 . A keyboard and mouse  120 , or other conventional components, may be coupled to the chipset core logic via bus  108 . The core logic may couple to the graphics processor  112 , via a bus  105 , and the main or host processor  100  in one embodiment. The graphics processor  112  may also be coupled by a bus  106  to a frame buffer  114 . The frame buffer  114  may be coupled by a bus  107  to a display screen  118 . In one embodiment, a graphics processor  112  may be a multi-threaded, multi-core parallel processor using single instruction multiple data (SIMD) architecture. 
     In the case of a software implementation, the pertinent code may be stored in any suitable semiconductor, magnetic, or optical memory, including the main memory  132  or any available memory within the graphics processor. Thus, in one embodiment, the code to perform the sequences of  FIGS. 1-3  may be stored in a machine or computer readable medium, such as the memory  132  or the graphics processor  112 , and may be executed by the processor  100  or the graphics processor  112  in one embodiment. 
       FIGS. 1-3  are flow charts. In some embodiments, the sequences depicted in these flow charts may be implemented in hardware, software, or firmware. In a software embodiment, a non-transitory computer readable medium, such as a semiconductor memory, a magnetic memory, or an optical memory may be used to store instructions and may be executed by a processor to implement the sequences shown in  FIGS. 1-3 . 
     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. 
     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. 
     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.