Triangular rasterization scanning method
By dividing the triangle into flat top and flat bottom triangles and using a bidirectional scanning mechanism for rasterization scanning, the problem of inefficiency of traditional rasterization algorithms in high resolution and complex scenes is solved, and more efficient rendering processing is achieved.
Patent Information
- Application Number
- CN202510641515.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-06-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional rasterization algorithms are inefficient in high-resolution and complex scenarios, especially in elongated triangles and high-resolution scenarios, resulting in extended rendering time.
The triangle rasterized scanning method is used to divide the triangle into a flat-top triangle and a flat-bottom triangle. Based on the bidirectional scanning mechanism, the flat-top triangle and the flat-bottom triangle are scanned respectively. Only by determining whether the two vertices of the currently scanned pixel block are inside the triangle, and determining the effectiveness and boundaries are judged.
By reducing invalid empty block judgment and redundant calculation, the efficiency of rasterized scanning is improved, especially in high-resolution and elongated triangle scenes, which significantly improves rendering speed.
Smart Images

Figure CN120182080A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer graphics, and more specifically, to a triangle rasterization scanning method. Background Art
[0002] In the field of computer graphics, graphics rendering technology is one of the core technologies for realizing the visualization of 3D models. In the real-time rendering pipeline, rasterization, as a key link, is to convert the two-dimensional triangle after projection transformation into pixels on the screen and calculate attributes such as the color and depth of each pixel. With the continuous development of computer graphics, the requirements for rasterization technology are getting higher and higher. Especially in the rendering of high-resolution and complex scenes, traditional rasterization algorithms face many challenges.
[0003] With the in-depth application of computer graphics in fields such as games, virtual reality (VR), augmented reality (AR), and film and television rendering, the real-time rendering requirements of high resolution (8K / 16K) and high refresh rate (120Hz+) have become the industry standard. However, the performance bottleneck of traditional rasterization algorithms in high-resolution scenarios has become the core obstacle restricting the development of the industry. Especially in slender triangles and high-resolution scenarios, the problems of empty block judgment and redundant calculation are prominent, resulting in an extended rendering time. Therefore, how to perform more efficient rasterization and improve the rendering efficiency is still a serious problem, and there is an urgent need for a rasterization method that takes into account both efficiency and robustness.
[0004] The scan-line algorithm is a common rasterization method. Its basic idea is to scan the bounding box of the triangle row by row. For each row, determine the intersection interval between the row and the triangle, and then fill the pixels within the interval. The advantage of this algorithm is relatively simple to implement, but it has obvious defects. During the row-by-row scanning process, each row of the triangle's bounding box is scanned sequentially, and there are often a large number of invalid empty blocks in the front and back parts of the triangle. Taking a slender triangle with an aspect ratio of 1:20 as an example, more than 80% of the covered area of its bounding box may contain invalid pixel blocks, which leads to a large amount of invalid calculation and seriously affects the efficiency of rasterization.
[0005] The block-based algorithm divides an image into multiple pixel blocks of a fixed size, and determines whether a block is a valid block by judging whether the four corners of the pixel block are inside the triangle. If all four corners are inside the triangle, the entire block is considered valid; if all four corners are not inside, the block is considered invalid. This method reduces the computational complexity of per-pixel judgment to a certain extent, but there are still problems in practical applications. For each pixel block, it is necessary to judge the four corners, and each corner requires three cross-product calculations (corresponding to the three sides of the triangle), which still makes the computational complexity relatively large. This will bring significant performance overhead in real-time rendering for high-resolution images. In addition, the block-based algorithm is prone to misjudgment problems when dealing with slender triangles. When a slender triangle passes through a pixel block, it is possible that all four corners are not inside the triangle, but part of the block is still covered by the triangle. Summary of the Invention
[0006] The present invention aims at the technical problems existing in the prior art, and provides a triangle rasterization scanning method to overcome the problem of low efficiency of existing rasterization scanning.
[0007] The present invention provides a triangle rasterization scanning method, including: Judging whether the triangle is a flat-top triangle or a flat-bottom triangle. If so, no processing is performed. If not, the triangle is divided into a flat-top triangle and a flat-bottom triangle; Scanning the flat-top triangle and the flat-bottom triangle respectively based on a bidirectional scanning mechanism; Among them, the scanning of the flat-top triangle and the flat-bottom triangle respectively based on the bidirectional scanning mechanism includes: For each triangle, when scanning each row, respectively determine the starting scanning blocks for leftward scanning and rightward scanning; Based on the starting scanning blocks, move leftward and rightward respectively. During the leftward and rightward scanning processes, judge whether the current scanned pixel block is a valid pixel block, and judge whether the current row scanning reaches the boundary; If the current row scanning reaches the boundary, perform the next row scanning until all rows of the triangle are scanned.
[0008] On the basis of the above technical solution, the present invention can also be improved as follows.
[0009] Optionally, the judging whether the triangle is a flat-top triangle or a flat-bottom triangle. If so, no processing is performed. If not, the triangle is divided into a flat-top triangle and a flat-bottom triangle, includes: Obtain the y coordinates of the three vertices of the triangle. If the y coordinates of two of the vertices are equal, the triangle is a flat-top triangle or a flat-bottom triangle; If the y - coordinates of the three vertices of a triangle are not all equal, then the triangle is neither a flat - top triangle nor a flat - bottom triangle. In this case, the triangle is divided into a flat - top triangle and a flat - bottom triangle.
[0010] Optionally, for each triangle, when scanning each row, the starting scan blocks for left - hand and right - hand scans are determined respectively, including: For a flat - top triangle or a flat - bottom triangle, use the x - coordinate of the opposite vertex of the flat - top base or the flat - bottom base of the triangle as the left vertex of the right starting scan block for the first - row scan, and the x - 1 coordinate as the right vertex of the left starting scan block for the first - row scan.
[0011] Optionally, based on the starting scan blocks, move left and right respectively, and determine whether the current scanned pixel block is a valid pixel block after the left - hand and right - hand movements, and determine whether the current row scan reaches the boundary, including: During the left - hand scan movement, determine whether the two vertices on the left side of the current scanned pixel block are inside the triangle. Based on the judgment result, determine the validity of the current scanned pixel block and whether the current row scan reaches the boundary, and obtain the boundary pixel block of the current row scan; During the right - hand scan movement, determine whether the two vertices on the right side of the current scanned pixel block are inside the triangle. Based on the judgment result, determine the validity of the current scanned pixel block and whether the current row scan reaches the boundary, and obtain the boundary pixel block of the current row scan.
[0012] Optionally, during the left - hand scan movement, determine whether the two vertices on the left side of the current scanned pixel block are inside the triangle. Based on the judgment result, determine the validity of the current scanned pixel block and whether the current row scan reaches the boundary, and obtain the boundary pixel block of the current row scan, including: If both vertices on the left side of the current scanned pixel block are inside the triangle, it indicates that all pixel points of the current scanned pixel block are inside the triangle, and the current scanned pixel block is a valid pixel block; If one of the two vertices on the left side of the current scanned pixel block is inside the triangle and the other is outside the triangle, it indicates that some pixel points of the current scanned pixel block are inside the triangle, and the current scanned pixel block is a valid pixel block; If both vertices on the left side of the current scanned pixel block are outside the triangle, it indicates that some pixel points of the current scanned pixel block are inside the triangle, the current scanned pixel block is a valid pixel block, and the current scanned pixel block is a boundary pixel block.
[0013] Optionally, during the process of scanning while moving right, it is determined whether the two vertices on the right side of the currently scanned pixel block are inside the triangle. Based on the determination result, the validity of the currently scanned pixel block and whether the current row scan reaches the boundary are determined, and the boundary pixel block of the current row scan is obtained, including: If both vertices on the right side of the currently scanned pixel block are inside the triangle, it indicates that all pixel points of the currently scanned pixel block are inside the triangle, and the currently scanned pixel block is a valid pixel block; If one of the two vertices on the right side of the currently scanned pixel block is inside the triangle and the other vertex is outside the triangle, it indicates that some pixel points of the currently scanned pixel block are inside the triangle, and the currently scanned pixel block is a valid pixel block; If both vertices on the right side of the currently scanned pixel block are outside the triangle, it indicates that some pixel points of the currently scanned pixel block are inside the triangle, the currently scanned pixel block is a valid pixel block, and the currently scanned pixel block is a boundary pixel block.
[0014] Optionally, after the current row scan reaches the boundary, the next row scan is performed until all row scans of the triangle are completed, including: Obtain the right x - coordinate of the boundary pixel block when scanning left of the current row and denote it as left_x, and obtain the left x - coordinate of the boundary pixel block when scanning right of the current row and denote it as right_x. Then the x - coordinate of the starting scan block of the next row is (left_x + right_x) / 2; Based on the starting scan block, scan while moving left and right respectively to complete the scan of the next row, and so on until all row scans of the triangle are completed.
[0015] A triangle rasterization scanning method provided by the present invention divides a triangle into a flat - top triangle and a flat - bottom triangle; based on a two - way scanning mechanism, the flat - top triangle and the flat - bottom triangle are scanned bidirectionally. Among them, during the process of scanning left and right respectively, it is only necessary to determine whether the two vertices of the currently scanned pixel block are inside the triangle to determine the validity of the currently scanned pixel block and find the boundary pixel block of the current row scan. Compared with the traditional method that needs to simultaneously determine whether the four vertices of the scanned pixel block are inside the triangle, the calculation workload is saved and the scanning efficiency is improved. Description of the Drawings
[0016] Figure 1 It is a flowchart of a triangle rasterization scanning method provided by an embodiment of the present invention; Figure 2 It is an overall flowchart of a triangle rasterization scanning method provided by an embodiment of the present invention; Figure 3 It is a schematic diagram of triangle segmentation; Figure 4 Schematic diagram of bidirectional left - right scanning for each line; Figure 5 Schematic diagram of scanning the entire triangle. Specific implementation manner
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention. In addition, the technical features in each embodiment or individual embodiment provided by the present invention can be combined with each other arbitrarily to form a feasible technical solution. This combination is not restricted by the order of steps and / or the mode of structural composition, but must be based on the fact that those of ordinary skill in the art can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention.
[0018] Aiming at the problem of low rasterization scanning efficiency in the background technology, the present invention provides a more efficient triangle rasterization empty block judgment algorithm to improve the efficiency of triangle rasterization, especially to solve the problems of triangle rasterization scanning speed and resource waste of slender triangles at high resolutions.
[0019] The present invention provides a triangle rasterization scanning method. By using the divide - and - conquer strategy to divide any triangle into two flat - bottom triangles (one upper and one lower), combined with bidirectional scanning and cross - product factor optimization, an efficient empty block judgment before rasterization processing is achieved. Using the solution of the present invention for rasterization calculation can accelerate the efficiency of rasterization empty block processing and improve the rasterization scanning speed.
[0020] As Figure 1 and Figure 2 shown, the triangle rasterization scanning method provided by the present invention includes the following steps: Step 1, determine whether the triangle is a flat - top triangle or a flat - bottom triangle. If so, no processing is performed. If not, divide the triangle into a flat - top triangle and a flat - bottom triangle.
[0021] Among them, the step of determining whether the triangle is a flat - top triangle or a flat - bottom triangle. If so, no processing is performed. If not, divide the triangle into a flat - top triangle and a flat - bottom triangle includes: Obtain the y - coordinates of the three vertices of the triangle. If the y - coordinates of two of them are equal, the triangle is a flat - top triangle or a flat - bottom triangle; If the y - coordinates of the three vertices of a triangle are not all equal, then the triangle is not a flat - top triangle or a flat - bottom triangle, and the triangle is divided into a flat - top triangle and a flat - bottom triangle.
[0022] See Figure 2 , first, sort the three vertices of the triangle according to their y - coordinates. If it is found that the triangle is already a flat - bottom or flat - top triangle after sorting, then the triangle is not divided anymore. If not, then the triangle is divided into two upper and lower flat - bottom or flat - top triangles. Taking triangle ABC as an example, it is divided into ABD and triangle BCD. For specific situations, refer to Figure 3 as shown.
[0023] Step 2, scan the flat - top triangle and the flat - bottom triangle respectively based on a two - way scanning mechanism.
[0024] In an embodiment of the present invention, step 2, scanning the flat - top triangle and the flat - bottom triangle respectively based on a two - way scanning mechanism, includes: Step 21, for each triangle, when scanning each row, respectively determine the starting scan blocks for scanning left and right.
[0025] Among them, for each triangle, when scanning each row, respectively determining the starting scan blocks for scanning left and right includes: For a flat - top triangle or a flat - bottom triangle, use the x - coordinate of the relative vertex of the flat - top bottom edge or the flat - bottom bottom edge of the triangle as the left vertex of the right starting scan block for the first - row scan, and the x - 1 coordinate as the right vertex of the left starting scan block for the first - row scan.
[0026] Specifically, for the divided flat - top triangle and flat - bottom triangle, for example, perform two - way scanning on triangle ABD and triangle BCD in Figure 3 , that is, scan left and right simultaneously.
[0027] First, determine the starting scan blocks for each row scan. For example, for triangle ABD, use the x - coordinate of vertex A as the left vertex of the right starting block and the x - 1 coordinate as the right vertex of the left starting block to start scanning. Next, the left starting block moves left for scanning, and the right starting block moves right for scanning.
[0028] Step 22, based on the starting scan blocks, move left and right respectively. During the process of moving left and right for scanning, determine whether the current scanned pixel block is a valid pixel block and whether the current row scan reaches the boundary.
[0029] It is understandable that during the process of scanning left and right respectively based on the starting scan block, it is necessary to determine whether the current scanned pixel block is a valid pixel block and whether the current row scan reaches the boundary.
[0030] When determining whether the current scanned pixel block is a valid pixel block, it is determined by whether the current scanned pixel block is inside the triangle. During the process of moving the scan to the left, it is determined whether the two vertices on the left side of the current scanned pixel block are inside the triangle. Based on the judgment result, the validity of the current scanned pixel block and whether the current row scan reaches the boundary are determined, and the boundary pixel block of the current row scan is obtained. During the process of moving the scan to the right, it is determined whether the two vertices on the right side of the current scanned pixel block are inside the triangle. Based on the judgment result, the validity of the current scanned pixel block and whether the current row scan reaches the boundary are determined, and the boundary pixel block of the current row scan is obtained.
[0031] Among them, when the traditional method determines whether the current scanned pixel block is a valid pixel block, it is necessary to determine whether all four corners of the pixel block are inside the triangle, and each pixel point of each corner needs to be judged three times (corresponding to the three sides of the triangle respectively). However, in the present invention, only two corners of the pixel block need to be judged, and each pixel point of each corner is judged once (corresponding to one side of the triangle). Because the triangle is divided into a flat-bottom triangle at the beginning, for triangle ABD, starting from vertex A as the starting block for scanning, then all the pixel blocks during the scanning process must be within side BD, so the judgment of side BD can be omitted here. At the same time, the starting block is inside the triangle. When moving to the left, then all the pixels of the coordinates must be within side AD, so the judgment of side AD can also be omitted. In addition, during the process of moving to the left, it is only necessary to judge whether the two vertices on the left side of the pixel block are inside the triangle. For whether the two vertices on the left side of the pixel block are inside the triangle, it can be divided into three cases. The first case is that both pixel points are inside the triangle, which means that the current block is inside the triangle. The second case is that one pixel point is inside the triangle, indicating that at this time, part of the pixels of the current block are inside the triangle. The third case is that both pixel points are not inside the triangle, indicating that at this time, there are still some pixels inside the triangle. These three cases all indicate that the current pixel block is a valid pixel block. However, when both of the two vertices on the left side of the pixel block are outside the triangle, at this time, the current pixel block is a boundary pixel block, that is, the termination pixel block. When the pixel block is scanned, the left scan of this row ends.
[0032] For the judgment of the pixel block scanned to the right, it is similar to the left scan. Specifically, if both of the two vertices on the right side of the current scanned pixel block are inside the triangle, it indicates that all the pixel points of the current scanned pixel block are inside the triangle, and the current scanned pixel block is a valid pixel block; If one of the two vertices on the right side of the current scanned pixel block is inside the triangle and the other vertex is outside the triangle, it indicates that some pixel points of the current scanned pixel block are inside the triangle, and the current scanned pixel block is a valid pixel block; If both of the two vertices on the right side of the current scanned pixel block are outside the triangle, it indicates that some pixel points of the current scanned pixel block are inside the triangle, the current scanned pixel block is a valid pixel block, and the current scanned pixel block is a boundary pixel block. The scanning process of each row is as Figure 4 shown.
[0033] Step 23, if the scanning of the current row reaches the boundary, start scanning the next row until all rows of the triangle are scanned.
[0034] It can be understood that during the process of two-way scanning of the pixel block above, the boundary pixel blocks on the left and right sides of the current row of the triangle are found respectively. At this time, record the x coordinate on the right side of the left boundary pixel block as left_x, and record the x coordinate on the left side of the right boundary pixel block as right_x. Then the starting x coordinate of the next row is (left_x + right_x) / 2, and the y coordinate of the next row increases or decreases according to a fixed offset, that is, the starting point of the next block is at the center position of the left and right boundaries of the previous row. This can ensure that the starting block must be inside the triangle and avoid querying invalid blocks. Figure 5 The downward arrow in it represents the starting point of each row of scanning.
[0035] A triangle rasterization scanning method provided by the present invention has the following beneficial effects: (1) Adopt a double triangle segmentation strategy. After arbitrarily dividing a triangle into two bottom-flat triangles, the vertex positions of each sub-triangle are easier to control the scanning direction. It reduces the invalid scanning path. The traditional method needs to judge whether it is inside the triangle block by block from left to right, which may waste calculations because the starting block is empty. However, by dividing the triangle into two triangles in the present invention and starting to scan from the vertices of the upper and lower triangles respectively, it can be ensured that the starting block is a valid pixel block.
[0036] (2) Adopt an adaptive two-way scanning mechanism, starting from the center point of the triangle and scanning left and right respectively. After scanning a row, two boundary conditions can be obtained. Then the starting block of the next row is the center position of the left and right boundaries, and the starting scanning block of the next row is the center position of the previous row, which can ensure that the starting block of the next row must also be a valid block.
[0037] (3) Adopt a boundary judgment mechanism to improve the rasterization efficiency by simplifying boundary judgment. After splitting a triangle into two upper and lower triangles, when scanning the upper triangle, it can be ensured that all pixel points are within the bottom edge. When scanning the lower triangle, it can be ensured that all pixel points are within the top edge, which can reduce the judgment conditions for one edge. When performing two-way scanning, since each time it starts from the center of the triangle, the judgment of the four vertices can be reduced to two vertices. When starting from the center of the triangle and scanning to the left, only the left two vertices of the pixel block need to be judged whether they are outside the triangle. When both left vertices are outside the triangle, the boundary conditions have been determined. And when scanning to the left, all current points are within the right boundary of the triangle, and at this time, the judgment conditions for one more edge can be reduced. When scanning to the right, it is the same as scanning to the left. Advantage: It can quickly judge the judgment conditions of the triangle and prevent the filling of invalid pixels.
[0038] It should be noted that in the above embodiments, the descriptions of each embodiment have their own focuses. For the parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0039] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0040] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded computers, or other programmable data processing devices to generate a machine, so that the instructions executed by the processors of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0041] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the functions in the process Figure 1One or more processes and / or blocks Figure 1 The functions specified in one or more blocks.
[0042] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 One or more processes and / or blocks Figure 1 The steps of the functions specified in one or more blocks.
[0043] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0044] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.
Claims
1. A triangle rasterization scanning method, characterized in that: include: Determine whether the triangle is a flat-top triangle or a flat-bottom triangle. If so, do not process it. If not, divide the triangle into a flat-top triangle and a flat-bottom triangle. Scanning the flat-top triangle and the flat-bottom triangle respectively based on a bidirectional scanning mechanism; The step of scanning the flat-top triangle and the flat-bottom triangle based on a bidirectional scanning mechanism includes: For each triangle, when scanning each row, determine the starting scanning blocks for left scanning and right scanning respectively; Based on the starting scanning block, move leftward and rightward respectively, and in the process of moving leftward and rightward scanning, determine whether the currently scanned pixel block is a valid pixel block, and determine whether the current row scanning reaches the boundary; If the current row scan reaches the boundary, the next row scan is performed until all row scans of the triangle are completed.
2. The triangle rasterization scanning method according to claim 1, characterized in that: The determining whether the triangle is a flat-top triangle or a flat-bottom triangle, if yes, no processing is performed, if no, the triangle is divided into a flat-top triangle and a flat-bottom triangle, including: Get the y coordinates of the three vertices of the triangle. If the y coordinates of two of the vertices are equal, the triangle is a flat-top triangle or a flat-bottom triangle. If the y coordinates of the three vertices of the triangle are not equal, the triangle is not a flat-top triangle or a flat-bottom triangle, and the triangle is divided into a flat-top triangle and a flat-bottom triangle.
3. The triangle rasterization scanning method according to claim 1, characterized in that: For each triangle, when scanning each row, the starting scanning blocks for left scanning and right scanning are determined respectively, including: For a flat-top triangle or a flat-bottom triangle, the x coordinate of the vertex opposite to the flat-top base or the flat-bottom base of the triangle is used as the left vertex of the right starting scanning block of the first row of scanning, and the x-1 coordinate is used as the right vertex of the left starting scanning block of the first row.
4. The triangle rasterization scanning method according to claim 3, characterized in that: The step of moving leftward and rightward based on the starting scanning block, determining whether the currently scanned pixel block is a valid pixel block after moving leftward and rightward, and determining whether the current row scanning reaches a boundary, comprises: In the process of moving the scan to the left, determine whether the two vertices on the left side of the currently scanned pixel block are inside the triangle, determine the validity of the currently scanned pixel block and whether the current row scan reaches the boundary based on the determination result, and obtain the boundary pixel block of the current row scan; During the rightward scanning process, determine whether the two vertices on the right side of the currently scanned pixel block are inside the triangle, determine the validity of the currently scanned pixel block and whether the current row scan reaches the boundary based on the determination result, and obtain the boundary pixel block of the current row scan.
5. The triangle rasterization scanning method according to claim 1, characterized in that: In the process of moving the scan to the left, judging whether the two vertices on the left side of the currently scanned pixel block are inside the triangle, determining the validity of the currently scanned pixel block and whether the current row scan reaches the boundary based on the judgment result, and obtaining the boundary pixel block of the current row scan, including: If the two vertices on the left side of the currently scanned pixel block are both inside the triangle, it means that all the pixel points of the currently scanned pixel block are inside the triangle, and the currently scanned pixel block is a valid pixel block; If one of the two vertices on the left side of the currently scanned pixel block is inside the triangle and the other vertex is outside the triangle, it means that some pixel points of the currently scanned pixel block are inside the triangle and the currently scanned pixel block is a valid pixel block; If the two vertices on the left side of the currently scanned pixel block are both outside the triangle, it means that some pixels of the currently scanned pixel block are inside the triangle, the currently scanned pixel block is a valid pixel block, and the currently scanned pixel block is a boundary pixel block.
6. The triangle rasterization scanning method according to claim 4, characterized in that: In the process of moving rightward scanning, judging whether two vertices on the right side of the currently scanned pixel block are inside the triangle, determining the validity of the currently scanned pixel block and whether the current row scan reaches the boundary based on the judgment result, and obtaining the boundary pixel block of the current row scan, including: If the two vertices on the right side of the currently scanned pixel block are both inside the triangle, it means that all the pixel points of the currently scanned pixel block are inside the triangle, and the currently scanned pixel block is a valid pixel block; If one of the two vertices on the right side of the currently scanned pixel block is inside the triangle and the other vertex is outside the triangle, it indicates that some pixel points of the currently scanned pixel block are inside the triangle, and the currently scanned pixel block is a valid pixel block; If the two vertices on the right side of the currently scanned pixel block are both outside the triangle, it means that some pixels of the currently scanned pixel block are inside the triangle, the currently scanned pixel block is a valid pixel block, and the currently scanned pixel block is a boundary pixel block.
7. The triangle rasterization scanning method according to claim 4, characterized in that: If the current row scan reaches the boundary, the next row scan is performed until all rows of the triangle are scanned, including: Get the right x-coordinate of the boundary pixel block scanned to the left of the current row and mark it as left_x, and get the left x-coordinate of the boundary pixel block scanned to the right of the current row and mark it as right_x, then the x-coordinate of the starting scanning block of the next row is (left_x +right_x) / 2; Based on the starting scanning block, the scan is moved to the left and right respectively to complete the scan of the next row, and so on, and the scan of all rows of the triangle is completed.
Citation Information
Patent Citations
Method and device for traversing triangle in graphical raster scanning
CN101661741A
A triangular multidirectional parallel scanning method and structure based on Tile
CN109741433A
Low-power-consumption rasterization design method for embedded GPU
CN118505887A
Apparatus of and method for drawing graphics, and computer program product
US20050134583A1
Method and apparatus for triangle traversal process in graphic rasterization
US20100066744A1