CN102737401A - Triangular plate filling method in rasterization phase in graphic rendering - Google Patents

Triangular plate filling method in rasterization phase in graphic rendering Download PDF

Info

Publication number
CN102737401A
CN102737401A CN2011101165756A CN201110116575A CN102737401A CN 102737401 A CN102737401 A CN 102737401A CN 2011101165756 A CN2011101165756 A CN 2011101165756A CN 201110116575 A CN201110116575 A CN 201110116575A CN 102737401 A CN102737401 A CN 102737401A
Authority
CN
China
Prior art keywords
triangular plate
value
color
sweep trace
rasterization stage
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.)
Pending
Application number
CN2011101165756A
Other languages
Chinese (zh)
Inventor
蔡欢
张君琦
郑培枫
孙季川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Digital Video Beijing Ltd
Original Assignee
China Digital Video Beijing Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Digital Video Beijing Ltd filed Critical China Digital Video Beijing Ltd
Priority to CN2011101165756A priority Critical patent/CN102737401A/en
Publication of CN102737401A publication Critical patent/CN102737401A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention discloses a triangular plate filling method in a rasterization phase in graphic rendering, comprising the following steps of: obtaining the data of the three vertexes of a triangular plate according to a rendering flow line before the rasterization phase; calculating a triangular plate bounding box, and recording the two groups of data of a floating point type and an integer type; and sequentially scanning each scanning line in the bounding box, and interpolating via the position values of the beginning and end of the scanning line as well as the position of the present pixel, so as to obtain the illumination colour values, depth values and texture coordinates of pixels in the triangular plate; and calculating the colours of the pixels in the triangular plate, obtaining the final colours, and writing the final colours in a colour buffer area to finish filling for the triangular plate. Via the implementation method disclosed by the invention, effective and correct filling can be performed on the pixels of the triangular plate in the rasterization phase in graphic rendering, so as to realize the rendering effect of a real three-dimensional object.

Description

The triangular plate fill method of rasterization stage in a kind of graph rendering
Technical field
The present invention relates to the captions process field in the television program designing field, relate in particular to the triangular plate fill method of rasterization stage in a kind of graph rendering.
Background technology
In the process that the TV programme captions are handled, graph rendering is a wherein requisite important step.
The graph rendering of prior art adopts scan-line algorithm mostly, and scan-line algorithm is by the sweep trace order, calculates between sweep trace and polygonal intersection, shows these interval pixels with the color that requires again, accomplishes conversion work.Interval end points can obtain through the intersection point that calculates sweep trace and Polygonal Boundary line, and for a sweep trace, polygonal scan conversion process mainly is following four processes: ask friendship, ordering, pairing and painted, detailed process is following:
Ask friendship: the intersection point that calculates sweep trace and each limit of polygon;
Ordering: press the ordering of x value incremental order to all intersection points;
Pairing: first with second, the 3rd and the 4th or the like; Every antinode is represented between a sweep trace and a polygonal intersection;
Painted: as to be set to the polygon color to the pixel between the intersection, to be set to background colour to pixel outer between the intersection;
Traditional scan-line algorithm mainly is that computation process also all is based on integer calculations to screen pixels, and traditional scan-line algorithm is to polygon, calculates to whole screen.Referring to shown in Figure 1 be prior art sweep trace and polygon scanning algorithm synoptic diagram, the inventor finds that there is following technical matters in prior art in the process of embodiment of the present invention:
(1) based on the method for integer calculations, degree of accuracy is lower;
The method computation process of (2) filling to polygon is complicated;
(3) calculate to whole screen, calculated amount is bigger.
Summary of the invention
In order to solve the shortcoming of above-mentioned prior art, fundamental purpose of the present invention provides the triangular plate fill method of rasterization stage in a kind of graph rendering, and it is low to have solved in the prior art degree of accuracy, and computation process is complicated, the problem that calculated amount is big.
In order to achieve the above object, the invention provides the triangular plate fill method of rasterization stage in a kind of graph rendering, specifically comprise:
Rendering pipeline according to before the rasterization stage obtains the data on three summits of triangular plate;
Calculate the bounding box of triangular plate in screen space;
Successively every sweep trace in the bounding box is scanned respectively, the position of positional value and current pixel through the sweep trace starting and terminal point, interpolation obtains illumination color value, depth value and the texture coordinate of triangular plate interior pixel;
Calculate the color of said triangular plate interior pixel and obtain final color and write the filling that the color buffer district accomplishes triangular plate.
Compared with prior art, the invention has the advantages that:
(1) graph rendering of the present invention is only handled to the rasterization stage in the three-dimensional body graph rendering, and is to be directed against triangular plate, simplifies when calculating the sweep trace starting and terminal point, has improved efficient.
(2) the starting and terminal point information of sweep trace of the present invention record position not only also writes down color, texture coordinate, depth value., sweep trace carried out calculating and the blend of colors etc. of judgement and the texture of the degree of depth in filling the process of triangular plate.
(3) scan-line algorithm of the present invention is not based on the scanning of whole screen, but has calculated the bounding box of triangular plate earlier, in bounding box, realizes scan-line algorithm having significantly reduced calculated amount.
Description of drawings
Technical scheme for the clearer explanation embodiment of the invention; The accompanying drawing of required use is done simple the introduction in will describing embodiment below; Conspicuous, the accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills; Under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the sweep trace and the polygon scanning algorithm synoptic diagram of prior art;
Fig. 2 is the triangular plate fill method block diagram of rasterization stage in the graph rendering of the embodiment of the invention;
Fig. 3 obtains the synoptic diagram of sweep trace maximal value and minimum value for the sweep trace scanning triangular plate of the embodiment of the invention.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below; Technical scheme in the embodiment of the invention is carried out clear, complete description; Obvious described embodiment only is a part of embodiment of the present invention, is not whole embodiment, based on the embodiment among the present invention; Those of ordinary skills are not paying the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
The embodiment of the invention provides a kind of on the one hand and realized the method that triangular plate is filled based on sweep trace, and is as shown in Figure 1, is specially:
Step S1: prepare color buffer district and depth buffer before the rasterization stage and obtain the data on three summits of triangular plate, comprise the screen position, depth value, summit illumination color and every layer texture coordinate according to the rendering pipeline before the rasterization stage.
Screen position and depth value are looked conversion by the object coordinates process world space conversion on triangular plate summit, projective transformation, and perspective division, standard device conversion etc. calculates.Illumination color in summit adopts the Gao Luode coloring mode to calculate.Every layer texture value adopts the rotation matrix that initial vertex texture coordinate multiply by this layer texture to obtain.
Step S2: calculate the x of the bounding box of triangular plate in screen space, the maximal value of y direction and minimum value.
Step S3: calculate in the bounding box maximal value of position on every sweep trace and illumination color, texture coordinate and the depth value of minimum value and these two positions.Obtaining the maximal value of sweep trace and the method for minimum value is: at first give an initial value to the Origin And Destination of sweep trace; Make three limits and the sweep trace find intersection of triangular plate successively; And make three limits and the said initial value of triangular plate do comparison, find the maximal value and the minimum value of sweep trace then.Be illustrated in figure 3 as the synoptic diagram that sweep trace scanning triangular plate of the present invention obtains the sweep trace max min.
Step S4: successively every sweep trace is scanned respectively, the position of positional value and current pixel through the sweep trace terminus, interpolation obtains illumination color value, depth value and the texture coordinate of triangular plate interior pixel.
Step S5: corresponding pixel depth value is done comparison in the pixel depth value that step S4 is obtained and the depth buffer; If greater than the depth value in the depth buffer; Represent that this pixel is nearer from the observer, replace the depth value of depth buffer relevant position with the depth value of pixel.
Step S6: calculate the color of said triangular plate interior pixel and obtain the filling that final color writes color buffer district completion triangular plate.
If there is not texture, the illumination color of the pixel that calculates among the step S4 is write the color buffer district.If texture is arranged,, obtain the texture color value through the 0th layer texture coordinate of step S4; With the illumination blend of colors, obtain color color, if also have the ground floor texture; Again with the ground floor texture color with mix the color color that obtains and mix; And the like, obtain final color, write in the color buffer district.
Step S7: the color output with the color buffer district obtains the rendering effect that rasterisation is filled triangular plate.
The triangular plate fill method of rasterization stage in the graph rendering of the embodiment of the invention through only handling to the rasterization stage in the three-dimensional body graph rendering, and is no longer to be polygon to triangular plate.Simplify when calculating the sweep trace starting and terminal point, improved efficient.The starting and terminal point information of sweep trace of the present invention is record position not only, also writes down color, and texture coordinate, depth value have carried out simultaneously calculating and the blend of colors etc. of judgement and the texture of the degree of depth in sweep trace is filled the process of triangular plate.Scan-line algorithm of the present invention is not based on the scanning of whole screen, but has calculated the bounding box of triangular plate earlier, in bounding box, realizes scan-line algorithm having significantly reduced calculated amount.
Through the description of above embodiment, those skilled in the art can be well understood to the present invention and can realize through software, also can realize by the mode that software adds necessary general hardware platform.Based on such understanding; Technical scheme of the present invention can be come out with the embodied of software product, this software product can be stored in a non-volatile memory medium (can be CD-ROM, USB flash disk; Portable hard drive etc.) in; Comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
The above; Be merely a best specific embodiment of the present invention, but characteristic of the present invention is not limited thereto, any people who is familiar with this technology is in field of the present invention; The variation that can expect easily or modification all should be encompassed in the following claim of the present invention.

Claims (10)

1. the triangular plate fill method of rasterization stage in the graph rendering is characterized in that, specifically comprises:
Rendering pipeline according to before the rasterization stage obtains the data on three summits of triangular plate;
Calculate the bounding box of triangular plate in screen space;
Successively every sweep trace in the bounding box is scanned respectively, the position of positional value and current pixel through the sweep trace starting and terminal point, interpolation obtains illumination color value, depth value and the texture coordinate of triangular plate interior pixel;
Calculate the color of said triangular plate interior pixel and obtain final color and write the filling that the color buffer district accomplishes triangular plate.
2. the triangular plate fill method of rasterization stage is characterized in that in the graph rendering as claimed in claim 1, and the said data of obtaining three summits of triangular plate comprise obtaining and comprise the screen position, depth value, summit illumination color and every layer texture coordinate.
3. the triangular plate fill method of rasterization stage is characterized in that in the graph rendering as claimed in claim 2, and said screen position and depth value are by the object coordinates process world space conversion on triangular plate summit; Look conversion; Projective transformation, perspective division, the standard device transformation calculations obtains.
4. the triangular plate fill method of rasterization stage is characterized in that in the graph rendering as claimed in claim 2, and said summit illumination color adopts the Gao Luode coloring mode to calculate.
5. the triangular plate fill method of rasterization stage is characterized in that in the graph rendering as claimed in claim 2, and said every layer texture coordinate is obtained by the rotation matrix that initial vertex texture coordinate multiply by this layer texture.
6. the triangular plate fill method of rasterization stage is characterized in that in the graph rendering as claimed in claim 1, and said calculating triangular plate bounding box is specially the x that calculates the triangular plate bounding box, the maximal value of y direction and minimum value.
7. the triangular plate fill method of rasterization stage in the graph rendering as claimed in claim 1; It is characterized in that; The said maximal value of calculating in the bounding box position on every sweep trace and illumination color, texture coordinate and the depth value of minimum value and these two positions of also comprising before successively every sweep trace in the bounding box being scanned respectively.
8. the triangular plate fill method of rasterization stage is characterized in that in the graph rendering as claimed in claim 7, in the said calculating bounding box on every sweep trace the maximal value and the minimum value concrete grammar of position be:
At first give an initial value to the Origin And Destination of sweep trace, make three limits and the sweep trace find intersection of triangular plate successively, the value of said intersection point and said initial value are done comparison, find the maximal value and the minimum value of sweep trace then.
9. the triangular plate fill method of rasterization stage in the graph rendering as claimed in claim 1; It is characterized in that; Interpolation obtains behind the depth value of triangular plate interior pixel corresponding pixel depth value in the depth value of said triangular plate interior pixel and the depth buffer is made comparisons, if the depth value of said triangular plate interior pixel is greater than the depth value in the depth buffer then with the depth value of the depth value replacement depth buffer relevant position of pixel.
10. the triangular plate fill method of rasterization stage is characterized in that in the graph rendering as claimed in claim 1, and the color of the said triangular plate interior pixel of said calculating also obtains final color and writes the filling of accomplishing triangular plate in the color buffer district and comprise:
Do not have texture, the illumination color of the pixel in the triangular plate that calculates is write the color buffer district;
Texture is arranged, and the color of multilayer texture is mixed successively and is obtained final color and write the color buffer district.
CN2011101165756A 2011-05-06 2011-05-06 Triangular plate filling method in rasterization phase in graphic rendering Pending CN102737401A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011101165756A CN102737401A (en) 2011-05-06 2011-05-06 Triangular plate filling method in rasterization phase in graphic rendering

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011101165756A CN102737401A (en) 2011-05-06 2011-05-06 Triangular plate filling method in rasterization phase in graphic rendering

Publications (1)

Publication Number Publication Date
CN102737401A true CN102737401A (en) 2012-10-17

Family

ID=46992823

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011101165756A Pending CN102737401A (en) 2011-05-06 2011-05-06 Triangular plate filling method in rasterization phase in graphic rendering

Country Status (1)

Country Link
CN (1) CN102737401A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105006010A (en) * 2014-04-23 2015-10-28 三星电子株式会社 Method and apparatus for performing path rendering
CN105283906A (en) * 2013-07-10 2016-01-27 三星电子株式会社 Method and apparatus for applying graphic effect in electronic device
CN105574925A (en) * 2015-12-11 2016-05-11 中国航空工业集团公司西安航空计算技术研究所 Self-adaptive dynamic selection strategy of light treatment algorithm
CN106201268A (en) * 2016-07-11 2016-12-07 合肥杰美电子科技有限公司 A kind of human-computer interaction interface method for rendering graph based on transformation matrix and system
CN107481307A (en) * 2017-07-05 2017-12-15 国网山东省电力公司泰安供电公司 A kind of method of Fast rendering three-dimensional scenic
CN107851330A (en) * 2015-07-21 2018-03-27 高通股份有限公司 Zero pixel for graphics process is rejected
CN108022201A (en) * 2017-11-24 2018-05-11 中国航空工业集团公司西安航空计算技术研究所 A kind of triangle primitives rasterize method for sequencing parallel
CN111260767A (en) * 2020-02-19 2020-06-09 网易(杭州)网络有限公司 Rendering method in game, rendering device, electronic equipment and readable storage medium
CN111508052A (en) * 2020-04-23 2020-08-07 网易(杭州)网络有限公司 Rendering method and device of three-dimensional grid body
CN112614221A (en) * 2020-12-29 2021-04-06 北京百度网讯科技有限公司 High-precision map rendering method and device, electronic equipment and automatic driving vehicle
CN114494550A (en) * 2021-12-30 2022-05-13 北京城市网邻信息技术有限公司 WebGPU-based rendering method, electronic device and storage medium
WO2022143922A1 (en) * 2020-12-30 2022-07-07 Shanghai United Imaging Healthcare Co., Ltd. Systems and methods for image rendering

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0553973A2 (en) * 1992-01-29 1993-08-04 International Business Machines Corporation Computer graphics display method and system with shadow generation
CN101114380A (en) * 2006-03-10 2008-01-30 株式会社东芝 Image processing apparatus and image processing method
CN101901590A (en) * 2009-05-25 2010-12-01 富士通株式会社 Method and system for anti-aliased polygonal rasterization

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0553973A2 (en) * 1992-01-29 1993-08-04 International Business Machines Corporation Computer graphics display method and system with shadow generation
CN101114380A (en) * 2006-03-10 2008-01-30 株式会社东芝 Image processing apparatus and image processing method
CN101901590A (en) * 2009-05-25 2010-12-01 富士通株式会社 Method and system for anti-aliased polygonal rasterization

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李玉云: "面向移动设备的光栅化处理器的研究与设计", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105283906B (en) * 2013-07-10 2018-10-30 三星电子株式会社 The method and apparatus of Graphics Application effect in the electronic device
CN105283906A (en) * 2013-07-10 2016-01-27 三星电子株式会社 Method and apparatus for applying graphic effect in electronic device
US10134161B2 (en) 2013-07-10 2018-11-20 Samsung Electronics Co., Ltd. Method and apparatus for applying graphic effect in electronic device
CN105006010B (en) * 2014-04-23 2020-01-07 三星电子株式会社 Method and apparatus for performing path rendering
CN105006010A (en) * 2014-04-23 2015-10-28 三星电子株式会社 Method and apparatus for performing path rendering
US10186053B2 (en) 2014-04-23 2019-01-22 Samsung Electronics Co., Ltd. Method and apparatus for performing path rendering
CN107851330B (en) * 2015-07-21 2019-05-14 高通股份有限公司 Zero pixel for graphics process is rejected
CN107851330A (en) * 2015-07-21 2018-03-27 高通股份有限公司 Zero pixel for graphics process is rejected
CN105574925A (en) * 2015-12-11 2016-05-11 中国航空工业集团公司西安航空计算技术研究所 Self-adaptive dynamic selection strategy of light treatment algorithm
CN106201268A (en) * 2016-07-11 2016-12-07 合肥杰美电子科技有限公司 A kind of human-computer interaction interface method for rendering graph based on transformation matrix and system
CN107481307A (en) * 2017-07-05 2017-12-15 国网山东省电力公司泰安供电公司 A kind of method of Fast rendering three-dimensional scenic
CN108022201B (en) * 2017-11-24 2021-09-14 中国航空工业集团公司西安航空计算技术研究所 Parallel rasterization sequencing method for triangle primitives
CN108022201A (en) * 2017-11-24 2018-05-11 中国航空工业集团公司西安航空计算技术研究所 A kind of triangle primitives rasterize method for sequencing parallel
CN111260767A (en) * 2020-02-19 2020-06-09 网易(杭州)网络有限公司 Rendering method in game, rendering device, electronic equipment and readable storage medium
CN111260767B (en) * 2020-02-19 2023-10-20 网易(杭州)网络有限公司 Rendering method, rendering device, electronic device and readable storage medium in game
CN111508052A (en) * 2020-04-23 2020-08-07 网易(杭州)网络有限公司 Rendering method and device of three-dimensional grid body
CN111508052B (en) * 2020-04-23 2023-11-21 网易(杭州)网络有限公司 Rendering method and device of three-dimensional grid body
CN112614221A (en) * 2020-12-29 2021-04-06 北京百度网讯科技有限公司 High-precision map rendering method and device, electronic equipment and automatic driving vehicle
WO2022143922A1 (en) * 2020-12-30 2022-07-07 Shanghai United Imaging Healthcare Co., Ltd. Systems and methods for image rendering
CN114494550A (en) * 2021-12-30 2022-05-13 北京城市网邻信息技术有限公司 WebGPU-based rendering method, electronic device and storage medium
CN114494550B (en) * 2021-12-30 2022-11-22 北京城市网邻信息技术有限公司 WebGPU-based rendering method, electronic device and storage medium

Similar Documents

Publication Publication Date Title
CN102737401A (en) Triangular plate filling method in rasterization phase in graphic rendering
JP6678209B2 (en) Gradient adjustment for texture mapping to non-orthonormal grid
JP6563048B2 (en) Tilt adjustment of texture mapping for multiple rendering targets with different resolutions depending on screen position
CN102722861A (en) CPU-based graphic rendering engine and realization method
US10650566B2 (en) Multiple shader processes in graphics processing
JP3608801B2 (en) Image generator
KR102275712B1 (en) Rendering method and apparatus, and electronic apparatus
US7884825B2 (en) Drawing method, image generating device, and electronic information apparatus
EP2973423B1 (en) System and method for display of a repeating texture stored in a texture atlas
CN101930620B (en) Image processing method and associated apparatus for rendering three-dimensional effect using two-dimensional image
TW201601115A (en) Varying effective resolution by screen location in graphics processing by approximating projection of vertices onto curved viewport
US20050231506A1 (en) Triangle identification buffer
CN102096907A (en) Image processing technique
JP3402610B2 (en) Method and apparatus for mapping textures
US6791569B1 (en) Antialiasing method using barycentric coordinates applied to lines
CN1816829A (en) Selection of a mipmap level
CN102722902B (en) Anti-aliasing the improving one's methods of rasterization stage in a kind of graph rendering streamline
US20050017969A1 (en) Computer graphics rendering using boundary information
US20080074435A1 (en) Texture filtering apparatus, texture mapping apparatus, and method and program therefor
JP3547250B2 (en) Drawing method
JP3872056B2 (en) Drawing method
CN102750933B (en) The dynamic display method of three-dimensional oscillography model in a kind of color three-dimensional oscilloscope
JP2003308544A (en) Quick reading method for mipmap data
JPS63289686A (en) Image shadowing device
JPH06203171A (en) Device and method for forming image

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20121017

RJ01 Rejection of invention patent application after publication