A method of marking edge_flag in a triangular clipping

By marking Edge_Flag during triangle clipping, the problem of graphics processors being unable to effectively mark common edges is solved, rasterization performance is improved, the load on rasterization units is reduced, and graphics rendering efficiency is increased.

CN115393159BActive Publication Date: 2026-03-17西安翔腾微电子科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-20
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing graphics processors cannot effectively mark common edges after triangle clipping, which requires repeated drawing of internal edges and clipping edges during rasterization, increasing the load on rasterization units and reducing graphics rendering performance.

Method used

This paper provides a method for marking Edge_Flag in triangle clipping. By encoding the vertices of the original triangle and marking the Edge_Flag attribute of new points and edges during the clipping process, the properties of the edges are determined based on the vertex encoding and sequence number when assembling the clipped triangle, thus avoiding the drawing of internal edges and clipping edges.

Benefits of technology

By marking Edge_Flag, the graphics processor can avoid drawing internal edges and clipping edges during rasterization, reducing the load on the rasterization unit and improving graphics rendering performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115393159B_ABST
    Figure CN115393159B_ABST
Patent Text Reader

Abstract

The present application relates to a method for marking Edge_Flag in triangle clipping. The present application comprises the following steps: 1) corresponding the three edges of the original triangle received by the clipping unit to the three vertices, so that the vertex information is the information of the corresponding edge, and then encoding each vertex; 2) encoding the new point generated in the clipping process; 3) assembling the triangle after clipping, and marking the corresponding Edge_Flag according to the encoding of each vertex. The present application can mark the Edge_Flag attribute of each vertex of the triangle graphics primitive after clipping in the process of plane clipping and three-dimensional clipping, so that the graphics processor can avoid drawing the internal variation and the clipping edge when rasterizing, reduce the load of the rasterizing unit of the graphics processor, and improve the graphics drawing performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer hardware technology, and more particularly to a method for marking Edge_Flag in triangle clipping within a graphics processor clipping unit. Background Technology

[0002] With the increasing number of graphical applications, early solutions that relied solely on CPUs for graphics rendering could no longer meet the demands of performance and technological advancements in graphics processing. This led to the development of the Graphics Processing Unit (GPU). The high-speed, parallel characteristics of GPU pipelines and their flexible programmability provide a robust operating platform for graphics processing and general-purpose parallel computing.

[0003] Clipping units are an important part of the GPU's geometry engine. Their function is to clip the graphics primitives outside the clipping plane. After clipping a triangle, it may become a polygon, and then be broken down into multiple triangles. Different triangles may share common edges. If these common edges can be marked, rasterization performance can be improved by drawing them only once during rasterization. Summary of the Invention

[0004] To address the problems existing in the background art, the present invention provides a method for marking Edge_Flag in triangle clipping. During planar clipping and three-dimensional clipping, the Edge_Flag attribute of each vertex of the processed triangle graphic primitive after clipping can be marked, thereby enabling the graphics processor to avoid drawing internal variables and clipping edges during rasterization, reducing the load on the graphics processor's rasterization unit, and improving graphics rendering performance.

[0005] The technical solution of this invention is: This invention is a method for marking Edge_Flag in triangle clipping, and its special feature is that the method includes the following steps:

[0006] 1) Assign a one-to-one correspondence between the three sides and three vertices of the original triangle received by the clipping unit, so that the vertex information can be the information of the corresponding side, and then encode each vertex;

[0007] 2) Encode the new points generated during the cutting process;

[0008] 3) Assemble the clipped triangle and mark the corresponding Edge_Flag according to the encoding of each vertex.

[0009] Furthermore, in step 1), each of the three vertices of the original triangle is assigned a code, which includes the sequence number of each vertex, the original Edge_Flag of each vertex, and the state information of whether each vertex is a new point to be clipped.

[0010] Furthermore, in step 1), the triangle has not yet been clipped, so each vertex will not be marked as a new point.

[0011] Furthermore, the specific steps of step 2) are as follows:

[0012] 2.1) The intersection points generated by clipping the clipped plane are marked as new clipped points in the vertex encoding;

[0013] 2.2) Assign the new points to the new edges;

[0014] 2.3) The new vertex inherits the Edge_Flag of the vertex corresponding to the edge it is on;

[0015] 2.4) If the new point is generated by a clipped edge, then assign it a new index; otherwise, the new point inherits the index of the vertex corresponding to the original edge it belongs to.

[0016] 2.5) Repeat steps 1) to 3) when the cutting is performed sequentially by multiple cutting planes.

[0017] Furthermore, the specific steps of step 3) are as follows:

[0018] 3.1) The polygon generated by the trimming is broken down into triangles. The vertices of the first triangle are the first three vertices of the polygon. The starting point of all subsequent triangles is the first vertex of the polygon, the midpoint is the end point of the previous triangle, and the end point is the next vertex in the polygon in sequence. For example, the midpoint of the second triangle is the end point of the first triangle, and the end point of the second triangle is the fourth point of the polygon. And so on, until all triangles are assembled.

[0019] 3.2) For the first triangle assembled, if both the starting point and the midpoint are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the Edge_Flag of the starting point is set to invalid; otherwise, the Edge_Flag of the vertex is kept. If both the midpoint and the ending point are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the Edge_Flag of the midpoint is set to invalid; otherwise, the Edge_Flag of the vertex is kept. For the edge from the ending point to the starting point, if the total number of triangles formed is greater than 1, then the edge is an internal edge, and the Edge_Flag of the ending point is set to invalid. When there is only 1 triangle assembled, if both the ending point and the starting point are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the Edge_Flag of the ending point is set to invalid; otherwise, the Edge_Flag of the vertex is kept.

[0020] 3.3) When assembling multiple triangles, for the middle triangles, the edge from the starting point to the midpoint is an internal edge, and the starting point's Edge_Flag is set to an invalid state; if both the midpoint and the ending point are new points generated by clipping, and the indexes of the two vertices are not equal, then the edge is a clipped edge, and the midpoint's Edge_Flag is set to an invalid state; otherwise, the vertex's Edge_Flag is maintained; the edge from the ending point to the starting point is an internal edge, and the ending point's Edge_Flag is set to an invalid state.

[0021] 3.4) For the last triangle when assembling multiple triangles, the edge from the starting point to the midpoint is an internal edge, and the starting point's Edge_Flag is set to an invalid state; if both the midpoint and the ending point are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the midpoint's Edge_Flag is set to an invalid state; otherwise, the vertex's Edge_Flag is maintained.

[0022] Furthermore, in step 3), for triangles that are entirely within the clipping plane, each vertex retains its original Edge_Flag value.

[0023] This invention provides a method for marking Edge_Flag in triangle clipping. When clipping triangles input from previous units in planar and 3D clipping units, the Edge_Flag of each vertex after clipping can be marked. This data is then transmitted to the rasterization unit of the graphics processor for triangle rasterization, avoiding the drawing of internal edges and clipping edges, thus reducing the load on the graphics processor's rasterization unit and improving graphics rendering performance. This invention can mark the internal edges and clipping edges of the clipped triangle primitives, eliminating the need to draw these two types of edges during rasterization, thereby improving the performance of triangle rasterization. Attached image description:

[0024] Figure 1 This is a flowchart illustrating the processing of the triangle clipping mark Edge_Flag in this invention;

[0025] Figure 2 This is a schematic diagram of an embodiment of the present invention. Detailed Implementation

[0026] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0027] See Figure 1In this invention, during the clipping of triangles input from the preceding unit in both planar and 3D clipping units, the Edge_Flag of each vertex of the clipped triangle can be marked, and this data is then transmitted to the rasterization unit of the graphics processor after passing through the subsequent units. The specific steps are as follows:

[0028] 1) Assign a one-to-one correspondence between the three sides and three vertices of the original triangle received by the clipping unit, so that the vertex information can be the information of the corresponding side, and then encode each vertex;

[0029] Each of the three vertices of the original triangle is assigned a code, which includes the vertex's index, its original Edge_Flag, and whether it is a new point to be clipped. Since the triangle has not yet been clipped, each vertex is not marked as a new point.

[0030] 2) Encode the new points generated during the cutting process;

[0031] 2.1) The intersection points generated by clipping the clipped plane are marked as new clipped points in the vertex encoding;

[0032] 2.2) Assign the new points to the new edges;

[0033] 2.3) The new vertex inherits the Edge_Flag of the vertex corresponding to the edge it is on;

[0034] 2.4) If the new point is generated by a clipped edge, then assign it a new index; otherwise, the new point inherits the index of the vertex corresponding to the original edge it belongs to.

[0035] 2.5) Repeat steps 1) to 3) when the cutting is performed sequentially by multiple cutting planes.

[0036] 3) Assemble the clipped triangle and mark the corresponding Edge_Flag according to the encoding of each vertex.

[0037] 3.1) The polygon generated by the trimming is broken down into triangles. The vertices of the first triangle are the first three vertices of the polygon. The starting point of all subsequent triangles is the first vertex of the polygon, the midpoint is the end point of the previous triangle, and the end point is the next vertex in the polygon in sequence. For example, the midpoint of the second triangle is the end point of the first triangle, and the end point of the second triangle is the fourth point of the polygon. And so on, until all triangles are assembled.

[0038] 3.2) For the first triangle assembled, if both the starting point and the midpoint are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the Edge_Flag of the starting point is set to invalid; otherwise, the Edge_Flag of the vertex is kept. If both the midpoint and the ending point are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the Edge_Flag of the midpoint is set to invalid; otherwise, the Edge_Flag of the vertex is kept. For the edge from the ending point to the starting point, if the total number of triangles formed is greater than 1, then the edge is an internal edge, and the Edge_Flag of the ending point is set to invalid. When there is only 1 triangle assembled, if both the ending point and the starting point are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the Edge_Flag of the ending point is set to invalid; otherwise, the Edge_Flag of the vertex is kept.

[0039] 3.3) When assembling multiple triangles, for the middle triangles, the edge from the starting point to the midpoint is an internal edge, and the starting point's Edge_Flag is set to an invalid state; if both the midpoint and the ending point are new points generated by clipping, and the indexes of the two vertices are not equal, then the edge is a clipped edge, and the midpoint's Edge_Flag is set to an invalid state; otherwise, the vertex's Edge_Flag is maintained; the edge from the ending point to the starting point is an internal edge, and the ending point's Edge_Flag is set to an invalid state.

[0040] 3.4) For the last triangle when assembling multiple triangles, the edge from the starting point to the midpoint is an internal edge, and the starting point's Edge_Flag is set to an invalid state; if both the midpoint and the ending point are new points generated by clipping, and the indices of the two vertices are not equal, then the edge is a clipped edge, and the midpoint's Edge_Flag is set to an invalid state; otherwise, the vertex's Edge_Flag is maintained.

[0041] For triangles that are entirely within the clipping plane, each vertex retains its original Edge_Flag value.

[0042] See Figure 2In a specific embodiment of the present invention, when clipping triangle ABC, the clipping unit first generates a 6-bit signal for each vertex of the input triangle, denoted as et[5:0]. et[5] represents the original edgeFlag value carried by the triangle vertex (in the current embodiment, all three vertices of the input triangle are set to 1); et[4] represents whether the point is a new point obtained after clipping, et[4] = 1'b1 represents a new point; et[3:0] represents the number of the clipped edge corresponding to the vertex. Then, et[5:0] corresponding to point A (mapped edge AB) = 6'b1_0_0001, et[5:0] corresponding to point B (mapped edge BC) = 6'b1_0_0010, and et[5:0] corresponding to point C (mapped edge CA) = 6'b1_0_0000.

[0043] 1) When cutting on cutting plane 1:

[0044] 1.1) The intersection of edge CA and clipping plane 1 is m. Then the et[4] of point m is 1'b1. Points C and A do not satisfy the condition that et[4] is 1 and et[3:0] is not equal. Therefore, point m is not a point generated by the clipping edge. So the et[3:0] of point m inherits the index of the vertex C corresponding to the edge CA. So the et[5:0] of point m is 6'b1_1_0000.

[0045] 1.2) Similarly, the intersection point n of side AB and cutting plane 1 has et[5:0]=6'b1_1_0001;

[0046] 1.3) Side BC has no intersection with the cutting plane 1, so after cutting triangle ABC, the cutting plane 1 cuts the triangle into quadrilateral mnBC.

[0047] 2) When cutting on cutting plane 2:

[0048] 2.1) At this point, the clipping plane is actually clipping quadrilateral mnBC from step 1. Both sides mn and nB lie within clipping plane 2 and have no intersection.

[0049] 2.2) The intersection of edge BC and clipping plane 2 is f. Then the et[4] of point f is 1'b1. Points B and C do not satisfy the condition that et[4] is 1 and their et[3:0] are not equal. Therefore, point f is not a point generated by the clipping edge. So the et[3:0] of point f inherits the index of the vertex B corresponding to the edge BC. Therefore, the et[5:0] of point f is 6'b1_1_0010.

[0050] 2.3) Similarly, the intersection point e of side Cm and cutting plane 2 has et[5:0]=6'b1_1_0000. Finally, cutting plane 2 cuts quadrilateral mnBC into pentagon nBfem.

[0051] 3) When cutting on cutting plane 3:

[0052] 3.1) At this point, the cutting plane is actually cutting the pentagon nBfem in step 2. Side nB is outside the cutting plane 3, so there is no intersection point.

[0053] 3.2) The intersection of edge Bf and clipping plane 3 is i. Then the i-th point et[4] = 1'b1; however, the B-th and f-th points do not satisfy the condition that et[4] is 1 and the two et[3:0] are not equal. Therefore, the i-th point is not a point generated by the clipping edge. Therefore, the et[3:0] of the i-th point inherits the index of the vertex B corresponding to the edge Bf; therefore, the et[5:0] of the i-th point = 6'b1_1_0010;

[0054] 3.3) The edges fe and em lie within the clipping plane 3 and have no intersection.

[0055] 3.4) The intersection of the mn side and the clipping plane 3 is point g. Then, the et[4] of point g is 1'b1. The et[4] of both points m and n is 1, and their et[3:0] are not equal. Therefore, a new sequence number of 4'b0011 is assigned to the et[3:0] of point g (in this embodiment, the new sequence number is the maximum value of the existing sequence number plus 1); so the et[5:0] of point g is 6'b1_1_0011. Finally, it is clipped to become a pentagon ifemg.

[0056] 4) After cutting, the pentagon ifemg is assembled into triangle ife, triangle iem and triangle img with i as the first point;

[0057] 4.1) Triangle ife: if all et[4] are 1, but et[3:0] are equal, so if is not a clipping edge or an interior edge, and the Edge_Flag of point i keeps its et[5] unchanged; fe all et[4] are 1, and et[3:0] are not equal, so fe is a clipping edge, and the Edge_Flag of point f is invalid state 0; ei is an interior edge, so the Edge_Flag of point e is set to invalid state 0;

[0058] 4.2) Triangle iem: ie is an internal edge, so the Edge_Flag of point i is set to the invalid state 0; the et[4] of em are all 1, but et[3:0] are equal, so the em edge is not a clipping edge or an internal edge, and the Edge_Flag of point e keeps its et[5] value unchanged; mi is an internal edge, so the Edge_Flag of point m is set to the invalid state 0;

[0059] 4.3) Triangle img: im is an internal edge, so the Edge_Flag of point i is set to invalid state 0; the et[4] of mg are all 1, and et[3:0] are not equal, so the mg edge is a clipping edge, and the Edge_Flag of point m is set to invalid state 0; the et[4] of gi are all 1, and et[3:0] are not equal, so the gi edge is a clipping edge, and the Edge_Flag of point g is set to invalid state 0.

[0060] This concludes the Edge_Flag marking of the clipped triangle vertices.

[0061] The clipping edge mentioned above refers to the edge where the clipping plane intersects the polygon, such as... Figure 2 The middle edge; the internal edge is the edge inside the polygon when it is assembled into a triangle, such as... Figure 2 The middle edge of ie.

[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method of marking Edge_Flag in a triangle clipping, characterized by: The method comprises the following steps: 1) Corresponding the three edges of the original triangle received by the clipping unit to the three vertices, so that the vertex information is the information of the corresponding edge, and then encoding each vertex; 2) Encoding the new points generated in the clipping process; 3) Assembling the clipped triangle, and marking the corresponding Edge_Flag according to the encoding of each vertex; 3.1) Disassembling the polygon generated by clipping into triangles, the first triangle is composed of the first three vertices of the polygon, the starting vertex of all subsequent triangles is the first vertex of the polygon, the middle vertex is the terminal vertex of the previous triangle, and the terminal vertex is the next vertex in the polygon in sequence; all triangles are assembled; 3.2) For the first assembled triangle, if the starting vertex and the middle vertex are both new points generated by clipping, and the sequence numbers of the two vertices are not equal, then the edge between the starting vertex and the middle vertex is a clipping edge, the Edge_Flag of the starting vertex is set to an invalid state, otherwise the Edge_Flag of the starting vertex is kept; if the middle vertex and the terminal vertex are both new points generated by clipping, and the sequence numbers of the two vertices are not equal, then the edge between the middle vertex and the terminal vertex is a clipping edge, the Edge_Flag of the middle vertex is set to an invalid state, otherwise the Edge_Flag of the middle vertex is kept; for the edge from the terminal vertex to the starting vertex, if the total number of triangles composed is greater than 1, then the edge is an internal edge, and the Edge_Flag of the terminal vertex is set to an invalid state; when the number of assembled triangles is 1, if the terminal vertex and the starting vertex are both new points generated by clipping, and the sequence numbers of the two vertices are not equal, then the edge between the terminal vertex and the starting vertex is a clipping edge, the Edge_Flag of the terminal vertex is set to an invalid state, otherwise the Edge_Flag of the terminal vertex is kept; 3.3) For the middle several triangles when assembling multiple triangles, the edge from the starting vertex to the middle vertex is an internal edge, the Edge_Flag of the starting vertex is set to an invalid state; if the middle vertex and the terminal vertex are both new points generated by clipping, and the sequence numbers of the two vertices are not equal, then the edge between the middle vertex and the terminal vertex is a clipping edge, the Edge_Flag of the middle vertex is set to an invalid state, otherwise the Edge_Flag of the middle vertex is kept; the edge from the terminal vertex to the starting vertex is an internal edge, and the Edge_Flag of the terminal vertex is set to an invalid state; 3.4) For the last triangle when assembling multiple triangles, the edge from the starting vertex to the middle vertex is an internal edge, the Edge_Flag of the starting vertex is set to an invalid state; if the middle vertex and the terminal vertex are both new points generated by clipping, and the sequence numbers of the two vertices are not equal, then the edge between the middle vertex and the terminal vertex is a clipping edge, the Edge_Flag of the middle vertex is set to an invalid state, otherwise the Edge_Flag of the middle vertex is kept; if the terminal vertex and the starting vertex are both new points generated by clipping, and the sequence numbers of the two vertices are not equal, then the edge between the terminal vertex and the starting vertex is a clipping edge, the Edge_Flag of the terminal vertex is set to an invalid state, otherwise the Edge_Flag of the terminal vertex is kept; 4) According to the internal edges and clipping edges of the triangle primitive marked in step 3), the rasterization unit does not draw the internal edges and clipping edges when performing triangle rasterization.

2. The method of marking Edge_Flag in triangle clipping according to claim 1, characterized in that: The step 1) includes assigning a code to each of the three vertices of the original triangle, which includes the serial number of each vertex, the original Edge_Flag of each vertex, and the state information of whether each vertex is a new point after clipping.

3. The method of marking Edge_Flag in triangle clipping according to claim 2, characterized in that: In the step 1), the triangle has not been clipped, so each vertex is not marked as a new point.

4. The method of marking Edge_Flag in triangle clipping according to claim 2, characterized in that: The specific steps of the step 2) are as follows: 2.1) marking the intersection point generated by clipping the clipping plane as a new point after clipping in the vertex code; 2.2) corresponding the new point with a new edge; 2.3) the new point inherits the Edge_Flag of the vertex corresponding to the edge where the new point is located; 2.4) if the new point is generated by a clipping edge, a new serial number is assigned to the new point, otherwise the new point inherits the serial number of the vertex corresponding to the original edge where the new point is located; 2.5) repeating steps 1) to 3) when the intersection point is sequentially clipped by multiple clipping planes.

5. The method of marking Edge_Flag in triangle clipping according to claim 4, characterized in that: In the step 3), for each vertex of the triangle, the original Edge_Flag value is kept and output.

Citation Information

Patent Citations

  • Device and method for entity clipping during graphic processing unit (GPU) graphic processing

    CN104200425A

  • Parallel hardware acceleration circuit for three-dimensional clipping in general-purpose graphics processors

    CN109064383A