CN102004832B - Realization of triangle rasterization based on horizontal line scanning - Google Patents
Realization of triangle rasterization based on horizontal line scanning Download PDFInfo
- Publication number
- CN102004832B CN102004832B CN 201010555857 CN201010555857A CN102004832B CN 102004832 B CN102004832 B CN 102004832B CN 201010555857 CN201010555857 CN 201010555857 CN 201010555857 A CN201010555857 A CN 201010555857A CN 102004832 B CN102004832 B CN 102004832B
- Authority
- CN
- China
- Prior art keywords
- attribute
- point
- triangle
- coordinate
- scan line
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Abstract
The invention discloses a realization mode of the triangle rasterization based on horizontal line scanning, which comprises the realization steps: the sequence adjustment of the three top points of a triangle, the intersection point calculation of the three sides and the lowest horizontal line, the increment calculation of triangle properties, the intersection point calculation of the horizontal line and the three sides (or an extension line), the determination of the scanning boundary of the horizontal line, the tailoring of the horizontal line, the calculation of the starting point properties of a scanning line, the filling of the horizontal line and the like; and the coordinates of the three top points of the triangle and the properties RGBASTZ are input to obtain the rasterized output after the course treatment. The rapid filing of continuous triangles can be realized through the realization method of the triangle rasterization so as to output the screen coordinates of each point in the triangle and the corresponding properties RGBASTZ.
Description
Technical field
The present invention is mainly concerned with the triangular grating field of 3 D graphics chip design, refers in particular to the implementation method based on the triangular grating of horizon scan line.
Background technology
The figure that shows on the raster display is referred to as raster graphic.Raster display can be regarded as a picture element matrix, at any one figure that raster display shows, in fact all is some set with one or more colors and gray-scale pixels.Because concerning a concrete raster display, number of pixels is limited, the color of pixel and gray shade scale also are limited, and pixel has size, so the actual graphical that raster graphic just is similar to.Definite the best is approached the pixel set of figure, and is called scanning conversion or the rasterisation of figure with the process that color and the gray scale of appointment arranges pixel.Leg-of-mutton rasterisation occupies critical positions in the design of 3 D graphics chip.In the OpenGL standard, primitive types only has 3 kinds: point, line segment, triangle, can utilize a large amount of triangles to be spliced into needed two dimension or three-dimensional picture.Therefore the speed of triangular grating directly has influence on the performance of 3 D graphics chip, need to accelerate as far as possible the speed of triangular grating, shows that simultaneously piece image need to draw a large amount of triangles, therefore needs to accelerate the rasterisation speed of continuous triangle shape.The method that adopts at present is: calculate first the absorbing boundary equation on three limits, then utilize absorbing boundary equation to judge some pixels and leg-of-mutton position relationship, determine whether current pixel point is inner at triangle.This kind implementation method need to be used a large amount of point multiplication operations, needs simultaneously to spend the plenty of time to get rid of not at triangle interior pixels point.
Summary of the invention
The problem to be solved in the present invention just is: for the technological difficulties that prior art exists, the invention provides a kind of structure relatively simple, can realize fast triangular gratingization and can realize fast the implementation of continuous triangle shape rasterisation.
Compared with prior art, advantage of the present invention just is: 1, logic is simple: the implementation structure of the triangular grating that the present invention proposes does not adopt very complicated algorithm, all is relatively to be beneficial to hard-wired algorithm, and the benefit of bringing is exactly that logic is simple; 2, function admirable: the triangular grating implementation that the present invention proposes can be finished leg-of-mutton rasterisation fast, owing to having adopted FIFO, has accelerated the rasterisation speed of continuous triangle shape simultaneously; 3, easy to use: the triangular grating implementation reusability that the present invention proposes is relatively good, can transplant very easily in the embedded graphic chip design.
Description of drawings
Fig. 1 is the left and right sides end points schematic diagram of determining horizontal scanning line;
Fig. 2 is the result that the present invention realizes filling 4 continuous triangle shapes;
Fig. 3 is the triangle filling algorithm implementation structure schematic diagram that the present invention proposes.
Embodiment
Below with reference to the drawings and specific embodiments the present invention is described in further details.
As shown in Figure 1, the realization of the triangular grating based on horizon scan line of the present invention need to calculate the intersection point on this sweep trace and triangle border for each bar horizontal scanning line.Disposal route is: to the present level sweep trace, calculate respectively the intersection point with Atria bar limit (or extended line), then determine the left and right sides intersection point of horizontal scanning line according to the position relationship on three limits.
As shown in Figure 2, triangular grating actual motion effect of the present invention, the leg-of-mutton rasterisation of realization that can be quick and level and smooth.
As shown in Figure 3, the realization of the triangular grating based on horizon scan line of the present invention, it comprises the implementation procedures such as the determining of intersection point calculation, horizon scan line border, horizontal line cutting, sweep trace starting point property calculation, horizontal line filling on intersection point calculation, the calculating of triangle Attribute Incremental, horizontal line and three limits (or extended line) of order adjustment, three limits and the level of subsistence on an Atria summit.The input data are floating-point coordinate and the attribute corresponding to each coordinate on an Atria summit.At first, adjust the summit order as shown in Figure 1, with the large minispread of an Atria summit according to the Y coordinate, determine simultaneously the direction on the main limit of triangle; And then calculate respectively the intersection point of Atria bar limit or its extended line and floor level sweep trace, and calculate the triangle attribute with the increment of X and Y according to plane equation simultaneously, to the Z attribute, the equation on this plane is:
Calculate respectively A, B, C can obtain attribute Z along the increment of X and Y-axis, the processing of all the other attribute R, G, B, A, S, T increment only need to be with the Z in the above-mentioned equation, Z
0, Z
1, Z
2Replace calculating with corresponding attribute component; With the intersecting point coordinate on minimum sweep trace and three limits, the increment of triangle attribute, the coordinate of an Atria point and the attribute of minimum point and the direction on main limit write FIFO; From the FIFO sense data, calculate the attribute of scanning initial point, calculate the intersection point X coordinate of current Atria limit and sweep trace according to method of addition, if the intersection point X coordinate on current scan line and TB, TM, MB limit is respectively X
TB, X
TM, X
MB, the intersection point on next bar sweep trace and three limits is X so
TB+ 1/K
TB, X
TM+ 1/K
TM, X
MB+ 1/K
MB, K wherein
TB, K
TM, K
MBBe respectively the slope of Atria bar limit TB, TM, MB; Determine the border, the left and right sides of current scan line and next bar sweep trace; Carry out the horizontal line cutting, the data after next bar sweep trace cutting are sent into the starting point attribute that the property calculation module is calculated next sweep trace, the data after the current scan line cutting are sent into floating-point turn integer unit; Current scan line is changed into the screen rounded coordinate when the front left and right border; Carry out horizon scan line, utilize method of addition to generate coordinate and the attribute of each pixel on the horizontal scanning line, in carrying out the horizon scan line process, suspend the streamline that calculates scanning boundary, border, the left and right sides and the starting point attribute of next bar sweep trace are finished as calculated simultaneously, the current scan line end of scan, next bar sweep trace enters the horizon scan line process at once, when all equal end of scan of horizontal scanning line of triangle, current leg-of-mutton rasterisation finishes, and continues to read FIFO and obtains next leg-of-mutton data and carry out rasterisation.Compare with traditional triangular grating way, the hardware resource that implementation method of the present invention and traditional implementation method expend is suitable, judges the time loss that the pixel that need not to draw is brought but the present invention has reduced, particularly to long and narrow triangle.The tradition implementation need to spend a large amount of cycles and judge the pixel that need not draw, and the present invention does not need to judge, the pixel on the horizontal scanning line that obtains is needs the pixel of drawing.
Claims (1)
1. based on the implementation method of the triangular grating of horizon scan line, it is characterized by: input comprises the coordinate (X of leg-of-mutton three summit single-precision floating point forms
0, Y
0), (X
1, Y
1), (X
2, Y
2), the attribute { R of the single-precision floating point form that three summits are corresponding
0, G
0, B
0, A
0, S
0, T
0, Z
0, { R
1, G
1, B
1, A
1, S
1, T
1, Z
1, { R
2, G
2, B
2, A
2, S
2, T
2, Z
2; At first carry out the summit and sequentially adjust, determine minimum point V
B(X
B, Y
B), intermediate point V
M(X
M, Y
M), peak V
T(X
T, Y
T), the attribute of corresponding point also will exchange in the sequential process of exchange summit, obtains three sides of a triangle TB, TM, MB, and wherein main limit is TB, utilizes cross product (X
T-X
B) (Y
M-Y
B)-(X
M-X
B) (Y
T-Y
B) symbol determine main limit on the left side or the right: symbol is for negative, main limit on the right, otherwise main limit on the left side; Calculate three horizontal intersection points in limit and minimum point place, calculate respectively three groups of intersecting point coordinate (X
TB, Y
Min), (X
MB, Y
Min), (X
TM, Y
Min), Y wherein
MinBe Y
BThe integer upper bound change into single precision floating datum, the slope inverse on described three groups of intersecting point coordinates and three limits is write FIFO; Calculate leg-of-mutton Attribute Incremental, adopt plane equation to calculate, for the Z attribute, the X on an Atria summit, Y coordinate and Z coordinate consist of a space plane, and the equation on this plane is:
Calculate respectively A, B, C can obtain the Z attribute respectively along the Attribute Incremental of directions X and Y-direction, the processing of all the other attribute R, G, B, A, S, T increment only need to be with the Z in the above-mentioned equation, Z
0, Z
1, Z
2Replace calculating with corresponding attribute component, the Attribute Incremental and the triangle minimum point attribute that calculate are also write FIFO, after a upper triangular grating end, read FIFO, take out current pending triangle number certificate, calculate the attribute of triangle scan line starting point, calculate the intersection point X coordinate of current Atria limit and sweep trace according to method of addition, if the intersection point X coordinate on current scan line and TB, TM, MB limit is respectively X
TB, X
TM, X
MB, the intersection point on next bar sweep trace and three limits is X so
TB+ 1/K
TB, X
TM+ 1/K
TM, X
MB+ 1/K
MB, K wherein
TB, K
TM, K
MBBe respectively the slope of Atria bar limit TB, TM, MB; According to the border, the left and right sides of the location positioning horizon scan line line on main limit, if main limit is on the right the time, if current scan line Y
Cur<=Y
MThe time, left margin is X
MB, right margin is X
TB, otherwise left margin is X
TM, right margin is X
TBIf during the on the left side of main limit, if current scan line Y
Cur<=Y
MThe time, left margin is X
TB, right margin is X
MB, otherwise left margin is X
TB, right margin is X
TMSituation according to border, the left and right sides is carried out the horizontal line cutting, floating-point coordinate conversion after the cutting is become the screen rounded coordinate, carry out horizon scan line, generate coordinate and the attribute of pixel, a sweep trace end of scan allows next bar sweep trace to enter horizon scan line, all sweep trace ends of scan of triangle read that next leg-of-mutton data enters the rasterisation flow process among the FIFO.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010555857 CN102004832B (en) | 2010-11-22 | 2010-11-22 | Realization of triangle rasterization based on horizontal line scanning |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010555857 CN102004832B (en) | 2010-11-22 | 2010-11-22 | Realization of triangle rasterization based on horizontal line scanning |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102004832A CN102004832A (en) | 2011-04-06 |
CN102004832B true CN102004832B (en) | 2013-01-23 |
Family
ID=43812192
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201010555857 Active CN102004832B (en) | 2010-11-22 | 2010-11-22 | Realization of triangle rasterization based on horizontal line scanning |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102004832B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104361619A (en) * | 2014-10-28 | 2015-02-18 | 长沙景嘉微电子股份有限公司 | Horizontal line filling based 2D (2-dimensional) graph IP (intellectual property) core implementation method |
CN108520151B (en) * | 2018-04-12 | 2022-12-06 | 长沙景美集成电路设计有限公司 | Device and method for realizing triangle stippling function in GPU |
CN109584334B (en) * | 2018-11-14 | 2023-04-07 | 西安翔腾微电子科技有限公司 | Triangular rasterization scanning structure and rasterization scanning method based on UML |
CN109346028B (en) * | 2018-11-14 | 2021-03-23 | 西安翔腾微电子科技有限公司 | TLM-based triangular raster scanning structure |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1283835A (en) * | 1999-08-04 | 2001-02-14 | 凌阳科技股份有限公司 | 3D image processor using parallel scan lines as processing unit and its drawing method |
CN1741071A (en) * | 2005-09-19 | 2006-03-01 | 威盛电子股份有限公司 | Three-dimensional space drawing processing method and apparatus |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4157569B2 (en) * | 2006-05-11 | 2008-10-01 | 株式会社東芝 | Drawing apparatus, drawing method, and drawing program |
-
2010
- 2010-11-22 CN CN 201010555857 patent/CN102004832B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1283835A (en) * | 1999-08-04 | 2001-02-14 | 凌阳科技股份有限公司 | 3D image processor using parallel scan lines as processing unit and its drawing method |
CN1741071A (en) * | 2005-09-19 | 2006-03-01 | 威盛电子股份有限公司 | Three-dimensional space drawing processing method and apparatus |
Also Published As
Publication number | Publication date |
---|---|
CN102004832A (en) | 2011-04-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7280121B2 (en) | Image processing apparatus and method of same | |
CN104183005B (en) | Graphics processing unit and rendering intent based on segment | |
US9202303B2 (en) | System and method for compositing path color in path rendering | |
US7420559B2 (en) | Video rendering apparatus and method and program | |
US8059119B2 (en) | Method for detecting border tiles or border pixels of a primitive for tile-based rendering | |
CN101609562B (en) | System and methods for rendering transparent surfaces in high depth complexity scenes | |
BR112018014012B1 (en) | SYSTEMS AND METHODS FOR RENDERING MULTIPLE LEVELS OF DETAIL AND COMPUTER READABLE MEMORY | |
TW201439968A (en) | Conservative rasterization of primitives using an error term | |
CN105405103A (en) | Enhanced anti-aliasing by varying sample patterns spatially and/or temporally | |
CN104933749B (en) | Clipping of graphics primitives | |
CN102004832B (en) | Realization of triangle rasterization based on horizontal line scanning | |
EP1519317B1 (en) | Depth-based antialiasing | |
CN102163340A (en) | Method for labeling three-dimensional (3D) dynamic geometric figure data information in computer system | |
US20120293512A1 (en) | Three-dimensional graphics clipping method, three-dimensional graphics displaying method, and graphics processing apparatus using the same | |
US9495767B2 (en) | Indexed uniform styles for stroke rendering | |
CN102096907A (en) | Image processing technique | |
ITMI20090876A1 (en) | METHOD OF RENDERING OF AN EDGE OF A PRIMITIVE GRAPHIC | |
CN103761761A (en) | Marine scalar field volume rendering method based on earth sphere model | |
WO2013101167A1 (en) | Five-dimensional rasterization with conservative bounds | |
CN101271588B (en) | Recreatable geometric shade pattern method | |
US20160307294A1 (en) | Systems and Methods for Displaying Patterns of Recurring Graphics on Digital Maps | |
US8068120B2 (en) | Guard band clipping systems and methods | |
US10192348B2 (en) | Method and apparatus for processing texture | |
CN101216944A (en) | A method and device for morphing shading in the process of typeset | |
JP4584956B2 (en) | Graphics processor and drawing processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C53 | Correction of patent for invention or patent application | ||
CB02 | Change of applicant information |
Address after: 410205 Hunan province Changsha Hexi Lugu high tech Zone base Lu Jing Road No. 2 Changsha Productivity Promotion Center Applicant after: Changsha Jingjia Microelectronic Co., Ltd. Address before: 410205 Hunan province Changsha Hexi Lugu high tech Zone base Lu Jing Road No. 2 Changsha Productivity Promotion Center Applicant before: Changsha Jingjia Microelectronics Co., Ltd. |
|
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |