Claims
- 1. A method for obtaining an attribute within a triangle in homogenous space, comprising:
obtaining the vertices of a triangle, each vertex being represented by a set of coordinates in a world coordinate space and having an attribute; for each vertex, transforming the world space coordinates and the attribute of the vertex to coordinates and an attribute in viewer space, computing a set of homogenous coefficients of the vertex based on the viewer space coordinates, and projecting the viewer space coordinates of the vertex to coordinates in screen space; determining, in the screen space, pixels that are affected by the triangle based on the screen space coordinates; and for each pixel affected by the triangle, computing, based on the homogenous coefficients, a set of barycentric coefficients in homogenous space, and performing a linear interpolation based on the set of homogenous barycentric coefficients and the attributes of the vertices in the viewer space to obtain the attribute in the homogenous space of the pixel affected by the triangle.
- 2. A method as in claim 1 wherein for each vertex the coordinates and attribute in viewer space are represented respectively by [Xih,Yih,Zih,Wi] and [piah], where ‘i’ is an index associated with the vertex and i=1, 2, 3, and where Wi is a perspective correction parameter.
- 3. A method as in claim 2, wherein the homogenous coefficients of the vertex are ãi,{tilde over (b)}i,{tilde over (c)}i, and based on the viewer space coordinates they are calculated in ãi={tilde over (Y)}jh·Wk−{tilde over (Y)}kh·Wj; {tilde over (b)}i={tilde over (X)}jh·Wk−{tilde over (X)}kh·Wj; and {tilde over (c)}i={tilde over (X)}jh·{tilde over (Y)}kh−{tilde over (X)}kh·{tilde over (Y)}jh, where j=i mod3+1, and k=j mode3+1, and wherein Wj and Wk are perspective correction parameters
- 4. A method as in claim 1, wherein determining the pixels affected by the triangle includes rasterizing the triangle.
- 5. A method as in claim 1, wherein determining the pixels affected by the triangle includes providing blank pixel data associated with the affected pixels.
- 6. A method as in claim 5, wherein for N pixels affected by the triangle the blank pixel data includes N screen space coordinates {[X1s,Y1s], [X2s,Y2s], . . . [XNs,YNs]}.
- 7. A method as in claim 4, wherein the rasterization provides blank pixel data associated with the pixels affected by the triangle.
- 8. A method as in claim 3 wherein α, β, γ, represent the set of barycentric coefficients, wherein d1, d2, d3, represent intermediate values, and wherein the computations, for each pixel, of the set of barycentric coefficients, include
calculating d1, d2 and d3, using the homogenous coefficients, ãi,{tilde over (b)}i,{tilde over (c)}i, in di=(ãi·X+{tilde over (b)}i·Y+{tilde over (c)}i), and calculating the homogenous space barycentric coefficients, α, β, γ, using the intermediate values d1, d2, d3, in 1α=d1d1+d2+d3,β=d2d1+d2+d3,and γ=d3d1+d2+d3.
- 9. A method as in claim 8, wherein the linear interpolation, for each pixel, includes calculation of Z_pix, a Z-coordinate in homogenous space, W_pix, a perspective correction parameter, and Phi_pix, an attributes of the pixel in the homogenous space, with the respective calculations being:
- 10. A method as in claim 1, wherein the location and depth of each of the pixels affected by the triangle is represented by coordinates in the homogenous space.
- 11. A method as in claim 1, wherein the attribute obtained in the homogenous space is depth.
- 12. A method as in claim 1, wherein the attribute obtained in the homogenous space is color.
- 13. A method as in claim 1, wherein the attribute obtained in the homogenous space is texture.
- 14. A method as in claim 1, wherein the attribute obtained in the homogenous space is shading.
- 15. A system for obtaining an attribute within a triangle in homogenous space, comprising:
means for obtaining the vertices of a triangle, each vertex being represented by a set of coordinates in a world coordinate space and having an attribute; for each vertex, means for transforming the world space coordinates and the attribute of the vertex to coordinates and an attribute in viewer space, means for computing a set of homogenous coefficients of the vertex based on the viewer space coordinates, and means for projecting the viewer space coordinates of the vertex to coordinates in screen space; means for determining, in the screen space, pixels that are affected by the triangle based on the screen space coordinates; and for each pixel affected by the triangle, means for computing, based on the homogenous coefficients, a set of barycentric coefficients in homogenous space, and means for performing a linear interpolation based on the set of homogenous barycentric coefficients and the attributes of the vertices in the viewer space to obtain the attribute in the homogenous space of the pixel affected by the triangle.
- 16. A system as in claim 15, wherein for each vertex the coordinates and attribute in viewer space are represented respectively by [XihYih,Zih,W] and [piah], where ‘i’ is an index associated with the vertex and i=1, 2, 3, and where Wi is a perspective correction parameter.
- 17. A system as in claim 16, wherein the homogenous coefficients of the vertex are ãi,{tilde over (b)}i,{tilde over (c)}i, and wherein said means for computing the homogeneous coefficients includes means for calculating ãi,{tilde over (b)}i,{tilde over (c)}i, based on the viewer space coordinates, in
- 18. A system as in claim 15, wherein means for determining the pixels affected by the triangle includes means for rasterizing the triangle.
- 19. A system as in claim 15, wherein the means for determining the pixels affected by the triangle includes means for providing blank pixel data associated to these pixels.
- 20. A system as in claim 19, wherein for N pixels affected by the triangle the blank pixel data includes N screen space coordinates {[X1s,Y1s], [X2s,Y2s], . . . [XNs,YNs]}.
- 21. A system as in claim 18, wherein the rasterization means provides blank pixel data associated with the pixels affected by the triangle.
- 22. A system as in claim 17 wherein α, β, γ, represent the set of barycentric coefficients, wherein d1, d2, d3, represent intermediate values, and wherein the means for computing, for each pixel, the set of barycentric coefficients, includes:
means for calculating d1, d2 and d3, using the homogenous coefficients, ãi,{tilde over (b)}i,{tilde over (c)}i, in di=(ãi·X+{tilde over (b)}i+Y+{tilde over (c)}i); and means for calculating the homogenous space barycentric coefficients, α, β, γ, using the intermediate values d1, d2, d3, in 2α=d1d1+d2+d3,β=d2d1+d2+d3,andγ=d3d1+d2+d3.
- 23. A system as in claim 22, wherein the linear interpolation means includes means for calculating, for each pixel, Z_pix, a Z-coordinate in homogenous space, W_pix, a perspective correction parameter, and Phi_pix, an attributes of the pixel in the homogenous space, with the respective calculations being:
- 24. A system as in claim 15, wherein the location and depth of each of the pixels affected by the triangle is represented by coordinates in the homogenous space.
- 25. A system as in claim 15, wherein the attribute obtained in the homogenous space is depth.
- 26. A system as in claim 15, wherein the attribute obtained in the homogenous space is color.
- 27. A system as in claim 15, wherein the attribute obtained in the homogenous space is texture.
- 28. A system as in claim 15, wherein the attribute obtained in the homogenous space is shading.
- 29. A programmable device for obtaining an attribute in homogenous space, comprising:
a computing unit; a processor; and a memory with program instructions, the processor being operatively connected with the memory, and the computing unit, for causing the programmable device to perform the steps of:
obtaining the vertices of a triangle, each vertex being represented by a set of coordinates in a world coordinate space and having an attribute; for each vertex, transforming the world space coordinates and the attribute of the vertex to coordinates and an attribute in viewer space, computing a set of homogenous coefficients of the vertex based on the viewer space coordinates, and projecting the viewer space coordinates of the vertex to coordinates in screen space; determining, in the screen space, pixels that are affected by the triangle based on the screen space coordinates; and for each pixel affected by the triangle, computing, based on the homogenous coefficients, a set of barycentric coefficients in homogenous space, and performing a linear interpolation based on the set of homogenous barycentric coefficients and the attributes of the vertices in the viewer space to obtain the attribute in the homogenous space of the pixel affected by the triangle.
- 30. A programmable device as in claim 29, wherein the computing unit includes:
a unit having two ALUs (arithmetic logic units); and a reciprocal unit.
- 31. A programmable device as in claim 29, wherein the processor includes at least one programmable single instruction multiple data (SIMD) scalar unit.
- 32. A programmable device as in claim 29, further comprising:
a bypass register, wherein the computing unit includes two-ALUs that are operative with shifted processing cycles using the bypass registers.
- 33. A programmable device as in claim 29, further comprising a triangle rasterizer operative to produce blank pixel screen coordinates for the pixels affected by the triangle.
- 34. A programmable device as in claim 29, further comprising a vertex geometry processing unit operative to provide the viewer space coordinates.
- 35. A programmable device as in claim 29 operative to perform operations in long floating point (FP) mode, short FP mode, and mixed long-short FP mode.
- 36. A programmable device as in claim 29 operative to perform depth, color, shading and texture interpolations.
REFERENCE TO EARLIER APPLICATIONS
[0001] This application claims the benefit of U.S. Provisional Application Serial No. 60/419,881, filed Oct. 19, 2002, and entitled “METHOD AND PROGRAMMABLE DEVICE FOR TRIANGLE INTERPOLATION IN HOMOGENEOUS SPACE,” which application is incorporated herein by reference.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60419881 |
Oct 2002 |
US |