Graphics processing method, device and electronic equipment

By establishing auxiliary lines and converting polygons in the UE4 engine, the problem of inefficiency of existing polygon processing algorithms is solved, and efficient polygon drawing and rendering processing is achieved.

CN114022603BActive Publication Date: 2025-04-01BEIJING 51WORLD DIGITAL TWIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111340648.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-12
Publication Date
2025-04-01
Estimated Expiration
2041-11-12

AI Technical Summary

Technical Problem

The existing polygon processing algorithms are inefficient in processing polygons, especially when drawing polygons in the UE4 engine. The introduction of CGAL and GDAL for auxiliary operations will increase the burden on the engine and reduce the operation rate.

Method used

By obtaining the first graphic information of at least two layers of polygonal figures, an auxiliary line is established, and the polygons are converted into one layer of polygonal figures through these auxiliary lines, thereby achieving efficient rendering of the target object in the virtual scene.

Benefits of technology

It improves the computing efficiency of polygon drawing, reduces the burden on the engine, improves resource utilization, and realizes efficient graphics processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114022603B_ABST
    Figure CN114022603B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a graphics processing method, device and electronic device, and belongs to the field of image information processing technology. The graphics processing method includes: obtaining first graphics information of at least two layers of polygonal graphics; each layer of polygons in the at least two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon; according to the first graphics information, at least two layers of polygonal graphics are converted to obtain second graphics information of a layer of polygonal graphics, and the layer of polygonal graphics is a plane polygonal graphics without a nested relationship; according to the second graphics information, a target layer of polygonal graphics is obtained; according to the target layer of polygonal graphics, a target object in a virtual scene is rendered to obtain a rendering result of the target object. The present disclosure can realize the rapid processing of polygonal graphics and improve the rendering efficiency of target objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image information processing, and in particular relates to a graphics processing method, device and electronic equipment. Background Art

[0002] The way to draw polygons in UE4 (Unreal Engine) is triangulation. If the polygon contains an inner ring, CGAL (Computational Geometry Algorithms Library) and GDAL (Geospatial Data Abstraction Library) need to be introduced to assist the operation; however, the introduction of CGAL and GDAL for auxiliary operation may increase the burden on the engine and reduce the operation rate. At the same time, it is difficult to manage the memory during the operation. In the existing technology, the processing efficiency of polygons is low. Summary of the invention

[0003] The purpose of the embodiments of the present disclosure is to provide a graphics processing method, device and electronic device to solve the problem of low polygon processing efficiency of existing polygon processing algorithms.

[0004] In a first aspect, an embodiment of the present disclosure provides a graphics processing method, the method comprising:

[0005] Acquire first graphic information of at least two layers of polygonal graphics; each layer of polygons in the two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon;

[0006] According to the first graphic information, at least two layers of polygonal graphics are converted to obtain second graphic information of a layer of polygonal graphics, where the layer of polygonal graphics is a plane polygonal graphic without a nested relationship;

[0007] According to the second graphic information, a target layer of polygonal graphics is obtained;

[0008] According to the target layer of polygonal graphics, the target object in the virtual scene is rendered to obtain the rendering result of the target object.

[0009] Optionally, obtaining first graphic information of at least two layers of polygonal graphics includes:

[0010] Obtain coordinate information of vertices of each polygon of at least two layers of polygonal graphics in a preset coordinate system.

[0011] Optionally, according to the first graphic information, at least two layers of polygonal graphics are converted and processed to obtain second graphic information of a layer of polygonal graphics, including:

[0012] According to the first graphic information, any two polygons in at least two layers of polygonal graphics are processed to establish auxiliary lines between the two polygons;

[0013] The auxiliary lines and the vertices of all polygons in at least two layers of polygonal graphics are traversed in order to obtain second graphic information of a layer of polygonal graphics, wherein the second graphic information includes: vertex coordinates of a layer of polygonal graphics arranged in order.

[0014] Optionally, according to the first graphic information, any two polygons in the at least two layers of polygonal graphics are processed to establish auxiliary lines between the two polygons, including:

[0015] According to the first graphic information, calculating the distance between any vertex of the first polygon and any vertex of the second polygon in at least two layers of polygonal graphics to obtain multiple distance values;

[0016] Connect two vertices corresponding to the shortest distance value among multiple distance values ​​to form an auxiliary line between the first polygon and the second polygon; until the auxiliary lines between all polygons in the two-layer polygonal graphics are established; the auxiliary line does not intersect with the edges of the first polygon and the second polygon, and does not intersect with the auxiliary lines that have been established.

[0017] Optionally, traversing the auxiliary lines and the vertices of all polygons in at least two layers of polygonal graphics in order to obtain second graphic information of a layer of polygonal graphics includes:

[0018] Combine two polygons with auxiliary lines into one bucket to obtain multiple polygon buckets;

[0019] Merge multiple polygon buckets to obtain a target bucket;

[0020] The vertices of all polygons in the target bucket are output in order to obtain the second graphic information of a layer of polygonal graphics.

[0021] Optionally, multiple polygon buckets are merged to obtain a target bucket, including:

[0022] If the polygons in the first bucket of the multiple polygon buckets are exactly the same as the polygons in the second bucket, delete any bucket in the first bucket and the second bucket to obtain the current middle bucket;

[0023] If the polygons in the first bucket of the multiple polygon buckets are not completely the same as the polygons in the second bucket, the first bucket and the second bucket are merged to obtain the current middle bucket;

[0024] The polygons in the current intermediate bucket are judged to be exactly the same as those in the next polygon bucket, until all polygon buckets are traversed to obtain the target bucket.

[0025] Optionally, the vertices of all polygons in the target bucket are output in order to obtain second graphic information of a layer of polygonal graphics, including:

[0026] For all polygons in the target bucket, traverse the vertices of all polygons in order. If the current vertex has no auxiliary line, traverse the next vertex of the polygon in order;

[0027] If the current vertex has an auxiliary line, and there is only one auxiliary line, follow the auxiliary line to the next polygon connected to the auxiliary line to perform vertex traversal;

[0028] If the current vertex has an auxiliary line and there are N auxiliary lines, obtain the angles between the baseline and the N auxiliary lines and the edges starting from the current vertex, traverse in order of the size of the angles, reset the traversal direction to the auxiliary line or edge corresponding to the smallest angle, and enter the next polygon connected by the auxiliary line; until the vertices of all polygons are traversed, the second graphic information of a layer of polygonal graphics is obtained, N is an integer greater than 1, and the second graphic information includes: a vertex sequence formed by traversing the vertices of all polygons.

[0029] In a second aspect, an embodiment of the present disclosure provides a graphics processing device, including:

[0030] An acquisition module, used for acquiring first graphic information of at least two layers of polygonal graphics; each layer of polygons in the two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon;

[0031] A processing module is used to convert at least two layers of polygonal graphics according to the first graphic information to obtain second graphic information of a layer of polygonal graphics, where the layer of polygonal graphics is a plane polygonal graphic without a nested relationship; obtain a target layer of polygonal graphics according to the second graphic information; and render a target object in a virtual scene according to the target layer of polygonal graphics to obtain a rendering result of the target object.

[0032] Optionally, the acquisition module includes:

[0033] The first acquisition submodule is used to acquire coordinate information of vertices of each polygon of at least two layers of polygonal graphics in a preset coordinate system.

[0034] Optionally, the processing module includes:

[0035] A first processing submodule is used to process any two polygons in at least two layers of polygonal graphics according to the first graphic information, and establish auxiliary lines between the two polygons;

[0036] The second processing submodule is used to sequentially traverse the auxiliary lines and the vertices of all polygons in at least two layers of polygonal graphics to obtain second graphic information of a layer of polygonal graphics, wherein the second graphic information includes: vertex coordinates of a layer of polygonal graphics arranged in sequence.

[0037] Optionally, the first processing submodule includes:

[0038] A first processing unit, configured to calculate, based on the first graphic information, a distance between any vertex of a first polygon and any vertex of a second polygon in at least two layers of polygonal graphics to obtain a plurality of distance values;

[0039] The second processing unit is used to connect two vertices corresponding to the shortest distance value among multiple distance values ​​to form an auxiliary line between the first polygon and the second polygon; until the auxiliary lines between all polygons in the two-layer polygonal graphics are established; the auxiliary line does not intersect with the edges of the first polygon and the second polygon, and does not intersect with the already established auxiliary lines.

[0040] Optionally, the second processing submodule includes:

[0041] A third processing unit is used to group two polygons with auxiliary lines into one bucket to obtain a plurality of polygon buckets;

[0042] The fourth processing unit is used to merge the multiple polygon buckets to obtain a target bucket;

[0043] The fifth processing unit is used to output the vertices of all polygons in the target bucket in order to obtain second graphic information of a layer of polygonal graphics.

[0044] Optionally, the fourth processing unit includes:

[0045] A first processing subunit is configured to delete any one of the first bucket and the second bucket to obtain a current intermediate bucket if the polygons in the first bucket of the plurality of polygon buckets are exactly the same as the polygons in the second bucket;

[0046] A second processing subunit is configured to merge the first bucket and the second bucket among the multiple polygon buckets to obtain a current intermediate bucket if the polygons in the first bucket and the polygons in the second bucket are not completely the same;

[0047] The third processing subunit is used to determine whether the polygons in the current intermediate bucket are identical to the polygons in the next polygon bucket, until all polygon buckets are traversed to obtain a target bucket.

[0048] Optionally, the fifth processing unit includes:

[0049] The fourth processing sub-unit is used to traverse the vertices of all polygons in the target bucket in order, and if the current vertex has no auxiliary line, traverse the next vertex of the polygon in order;

[0050] A fifth processing sub-unit, configured to, if the current vertex has an auxiliary line, and the auxiliary line is one, proceed along the auxiliary line to the next polygon connected to the auxiliary line to perform vertex traversal;

[0051] The sixth processing sub-unit is used to obtain the angles between the baseline and the N auxiliary lines and the edges starting from the current vertex if the current vertex has an auxiliary line and there are N auxiliary lines, traverse in order of the size of the angles, reset the traversal direction to the auxiliary line or edge corresponding to the smallest angle, and enter the next polygon connected by the auxiliary line; until the vertices of all polygons are traversed, the second graphic information of a layer of polygonal graphics is obtained, N is an integer greater than 1, and the second graphic information includes: a vertex sequence formed by completing the traversal of the vertices of all polygons.

[0052] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, and when the program or instruction is executed by the processor, the steps of the graphics processing method of the first aspect are implemented.

[0053] In a fifth aspect, an embodiment of the present disclosure provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the graphics processing method of the first aspect are implemented.

[0054] In the disclosed embodiment, by obtaining the first graphic information of at least two layers of polygonal graphics; each layer of polygons in the two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon; according to the first graphic information, at least two layers of polygonal graphics are converted to obtain the second graphic information of a layer of polygonal graphics, and the layer of polygonal graphics is a plane polygonal graphics without a nested relationship; according to the second graphic information, a target layer of polygonal graphics is obtained; according to the target layer of polygonal graphics, a target object in a virtual scene is rendered to obtain a rendering result of the target object. The problem of low polygon drawing processing efficiency in the prior art is solved, and the computational efficiency of polygon drawing can be accelerated. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a schematic diagram showing at least two layers of polygonal graphics in an embodiment provided by the present disclosure;

[0056] Figure 2 It is a schematic diagram of the flow of the graphics processing method provided by the embodiment of the present disclosure;

[0057] Figure 3 A schematic diagram showing the establishment of auxiliary lines in at least two layers of polygons in a specific embodiment 1 of the present disclosure is shown;

[0058] Figure 4 A schematic diagram showing the storage of polygons into polygon buckets in a specific embodiment 2 of the present disclosure is shown;

[0059] Figure 5 A first schematic diagram showing the storage of polygons into polygon buckets in a specific embodiment 3 of the present disclosure is shown;

[0060] Figure 6 A second schematic diagram showing the storage of polygons into polygon buckets in a specific embodiment 3 of the present disclosure is shown;

[0061] Figure 7 A first schematic diagram showing a merging process of polygon buckets in a specific embodiment 3 of the present disclosure is shown;

[0062] Figure 8 A second schematic diagram showing the merging process of polygon buckets in the specific embodiment 3 of the present disclosure is shown;

[0063] Fig. 9 A third schematic diagram showing the merging process of polygon buckets in the specific embodiment 3 of the present disclosure is shown;

[0064] Fig.10 A fourth schematic diagram showing the merging process of polygon buckets in the specific embodiment 3 of the present disclosure is shown;

[0065] Fig.11 A schematic diagram showing second graphic information for generating a layer of polygonal graphics in a specific embodiment 4 provided by the present disclosure is shown;

[0066] Fig.12 A schematic diagram showing second graphic information for generating a layer of polygonal graphics in a specific embodiment 5 provided by the present disclosure is shown;

[0067] Fig.13 A schematic diagram showing second graphic information for generating a layer of polygonal graphics in a specific embodiment 6 provided by the present disclosure is shown;

[0068] Fig.14 A schematic diagram showing the structure of a graphics processing device provided by an embodiment of the present disclosure is shown;

[0069] Fig.15 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown;

[0070] Fig.16 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present disclosure to clearly describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present disclosure are within the scope of protection of the present disclosure.

[0072] The terms "first", "second", etc. in the specification and claims of the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0073] The disclosed embodiments mainly relate to graphics processing. When a user draws polygonal graphics in the virtual engine UE4 (Unreal Engine 4), based on triangulation drawing, combined with a method of reducing the number of layers of polygonal graphics, at least two layers of nested polygonal graphics on a two-dimensional plane are converted to obtain a layer of polygonal graphics. When at least two layers of polygonal graphics are converted to a layer of polygonal graphics, auxiliary lines are added between the at least two layers of polygonal graphics, and then the at least two layers of polygonal graphics are sequentially connected in a certain order through the auxiliary lines, and then the auxiliary lines are removed, so that the at least two layers of polygonal graphics can be quickly drawn in an "approximate one-stroke" manner. The "approximate one-stroke" manner here specifically refers to starting to draw the polygonal graphics from one of the vertices, and the polygonal graphics can be drawn continuously without breaking; Figure 1 As shown, on a two-dimensional plane, a polygon DEFGD is nested inside a polygon ABCA, and the auxiliary line added between the two layers of polygonal graphics is line segment AD. After the two layers of polygonal graphics are converted, a layer of polygonal graphics is ABCADGFEDA, and then the auxiliary line AD of a layer of polygonal graphics ABCADGFEDA is removed to achieve the rapid drawing of the two layers of polygonal graphics nested with the polygon DEFGD in a "quasi-one-stroke" manner.

[0074] The at least two layers of polygonal graphics involved in the present disclosure are arranged on a two-dimensional plane in a nested manner. The concept of "number of layers" of the at least two layers of polygonal graphics mentioned here refers to the maximum number of peripheral polygons nested outside any polygon among all polygons of the at least two layers of polygonal graphics on the two-dimensional plane. The nested arrangement refers to an arrangement in which a peripheral polygon completely larger than the polygon is arranged outside any polygon, and all edges of the peripheral polygon do not intersect with edges of the nested polygon.

[0075] For example, Figure 1 In the figure, at least two layers of polygons include polygon ABCA and polygon DEFGD. There is no nested peripheral polygon outside polygon ABCA. Therefore, the number of layers of polygon ABCA is 1, and Figure 1 In the polygon DEFGD, the peripheral polygon ABCA is nested, so the number of layers of the polygon DEFGD is 2; since the number of layers of the polygon ABCA is 1, the number of layers of the polygon DEFGD is 2, and the maximum number of peripheral polygonal graphics nested outside any polygonal graphics is 2, the number of layers of at least two layers of polygonal graphics is 2, that is, two layers of polygonal graphics are set on the two-dimensional plane;

[0076] It should be noted that the nested arrangement of at least two layers of polygonal graphics here is not limited to the nested arrangement of polygon 1 and polygon 2 mentioned above, but polygon 1 can also be nested with polygon 2 and polygon 3 respectively, but there is no nested arrangement relationship between polygon 2 and polygon 3. The present application is not limited to this, that is, in the nested arrangement of at least two layers of polygonal graphics, at least two polygons are in a nested arrangement relationship.

[0077] The graphics processing method, device and electronic device provided by the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0078] Figure 2 is a flowchart of a graphics processing method provided by an embodiment of the present disclosure, see Figure 2 , the method may include the following steps:

[0079] Step 201, obtaining first graphic information of at least two layers of polygonal graphics; each layer of polygons in the two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon;

[0080] Each layer of polygons in the at least two layers of polygonal graphics here includes at least one polygon, wherein a polygon in any layer of polygons preferably has a nested relationship with polygons in other layers respectively, and the first graphic information is preferably represented by an array, which can be a two-dimensional array, and of course can also be an N-dimensional array that can clearly show the vertex coordinates corresponding to each polygon, and this is not limited in the present application;

[0081] When the array is a two-dimensional array, in the two-dimensional array, the elements of the first dimension are the coordinate structures corresponding to each polygon, and the coordinate structures are used to represent the vertex coordinates of the polygon, and the elements of the second dimension are the outermost polygons and other polygons in the nested relationship in sequence;

[0082] The coordinate structure preferably includes an x-axis coordinate and a y-axis coordinate, and a built-in data structure comparison method is also required to sort and compare the coordinate structure in a custom manner;

[0083] For example, Figure 1 As shown, at least two layers of polygonal graphics include polygon ABC and polygon DEGF, and the two-dimensional array is preferably M[2][4]; the elements in the second dimension represent polygon ABC and polygon DEGF respectively, and the elements in the first dimension correspond to the vertex coordinates of point A, point B, and point C in polygon ABC, and the vertex coordinates of point D, point E, point G, and point F in polygon DEGF. Here, the representation of the vertex coordinates preferably includes the horizontal coordinate x value and the vertical coordinate y value of the point;.

[0084] Furthermore, in the above step 201, obtaining the first graphic information of at least two layers of polygonal graphics may include:

[0085] Step 2011, obtaining coordinate information of vertices of each polygon of at least two layers of polygonal graphics in a preset coordinate system.

[0086] In this embodiment, the preset coordinate system is preferably a two-dimensional coordinate system, and the coordinate information of the vertices of each polygon in the preset coordinate system is preferably the horizontal coordinate x value and the vertical coordinate y value of the point; the obtained coordinate information of the vertices of each polygon in the preset coordinate system is preferably represented in the form of the above-mentioned input array to obtain the first graphic information; it should be noted that the first graphic information here can not only be represented in the form of an input array, but also can be represented in other ways, and this is not limited to this in the present application.

[0087] Step 202, converting at least two layers of polygonal graphics according to the first graphic information to obtain second graphic information of a layer of polygonal graphics, wherein the layer of polygonal graphics is a plane polygonal graphics without a nested relationship formed by sequentially connecting multiple vertices;

[0088] In this embodiment, the first graphic information obtained in step 201 is converted, and the conversion process is used to add auxiliary lines to at least two layers of polygonal graphics corresponding to the first graphic information to obtain second graphic information corresponding to a layer of polygonal graphics carrying auxiliary lines; it should be noted that the second graphic information here is similar to the expression method of the above-mentioned first graphic information, that is, it can also be expressed in an array form, and can also be expressed in other ways, which is not limited to this in the present application.

[0089] The above step 202 may include:

[0090] Step 2021, processing any two polygons in at least two layers of polygonal graphics according to the first graphic information, and establishing auxiliary lines between the two polygons;

[0091] Here, auxiliary lines are established in any two polygons in at least two layers of polygonal graphics corresponding to the first image information. The establishment of the auxiliary lines here needs to meet the following conditions:

[0092] (1) When the number of layers of at least two layers of polygonal graphics is N, the number of auxiliary lines established is M≤N;

[0093] (2) Each auxiliary line established will not intersect any edge of at least two layers of polygonal figures and any established auxiliary line;

[0094] (3) Each auxiliary line established will not form a loop with any edge of at least two layers of polygonal figures and the established auxiliary lines, and the loop refers to the formation of a new closed inner ring polygon;

[0095] Further, step 2021 may include:

[0096] Step 20211, calculating the distance between any vertex of the first polygon and any vertex of the second polygon in at least two layers of polygonal graphics according to the first graphic information, to obtain multiple distance values;

[0097] In the process of establishing auxiliary lines, it is necessary to avoid any edge in at least two layers of polygonal graphics and the established auxiliary lines, so as to avoid forming a new closed loop or intersection with any edge in at least two layers of polygonal graphics and the established auxiliary lines. The distance between the vertex of the first polygon and the vertex of the second polygon in at least two layers of polygonal graphics is calculated, and the shortest auxiliary line between the first polygon and any other polygon in at least two layers of polygonal graphics can be established. The shortest auxiliary line is established because there are many obstacles caused by long auxiliary line pairs, that is, it will hinder the subsequent process of establishing auxiliary lines. Therefore, the establishment of each auxiliary line needs to follow the principle of finding the shortest auxiliary line, that is, to establish an auxiliary line between a corresponding polygon and another polygon closest to the polygon;

[0098] Here, it should be noted that when at least one vertex of the first polygon and the second polygon is the same, since the shortest distance between the first polygon and the second polygon is 0, an auxiliary line with a length of 0 is established between the first polygon and the second polygon, that is, no auxiliary line is established between the first polygon and the second polygon.

[0099] Step 20212, connect the vertices corresponding to the shortest distance value among multiple distance values ​​to form an auxiliary line between the first polygon and the second polygon; until the auxiliary lines between all polygons in the two-layer polygonal graphics are established; the auxiliary lines do not intersect with the edges of the first polygon and the second polygon, and do not intersect with the auxiliary lines that have been established.

[0100] In this embodiment, auxiliary lines are established between all polygons in at least two layers of polygonal graphics. Here, the auxiliary lines between all polygons refer to connecting each polygon to another polygon through at least one auxiliary line. The auxiliary lines should satisfy the requirements of not intersecting with the edges of the first polygon and the second polygon and not forming a loop, and not intersecting with the established auxiliary lines and not forming a loop. The shortest distance value corresponding to each polygon is recorded in a state node. Here, the state node is used to record the shortest distance value and the two points with the shortest distance between the two polygons corresponding to the shortest distance value, so as to avoid multiple calculations of the shortest distance value and improve the running speed. That is, the state node includes: the coordinate information of the first vertex of the first polygon, the coordinate information of the second vertex of the second polygon and the shortest distance value. The distance between the first vertex of the first polygon and the second vertex of the second polygon is the shortest distance value.

[0101] Whether there is an intersection can be determined by vector calculation whether there is an intersection between the auxiliary line to be established and other line segments, specifically, it can include:

[0102] Step a, perform vector calculation on the auxiliary line to be established and all the edges of the polygonal figure, and calculate and determine whether there is an obstacle. If there is an obstacle, the auxiliary line cannot be established. If there is no obstacle, the calculation of the next step b is performed; it should be noted that since the auxiliary line will not be the same as the established auxiliary line, when performing vector calculation with all the edges of the polygonal figure, the same repeated calculation process as before will not be generated, so each auxiliary line to be established should perform vector calculation with all the edges of the polygonal figure;

[0103] Step b, performing vector calculation on the auxiliary line to be established and the established auxiliary line, and calculating and judging whether there is an obstacle. If there is an obstacle, the auxiliary line cannot be established. If there is no obstacle, the auxiliary line can be established. It should be noted that since the auxiliary line will not be the same as the established auxiliary line, when performing vector calculation with the established auxiliary line, the same repeated calculation process as before will not be generated, so each auxiliary line to be established should perform vector calculation with the established auxiliary line;

[0104] It should be noted that the established auxiliary lines are stored in an obstacle container, which is a repeatable unordered set used to record the two end points of the auxiliary line so that obstacles can be avoided for the established auxiliary lines when establishing new auxiliary lines.

[0105] Figure 3 FIG. 1 shows a schematic diagram of establishing auxiliary lines in at least two layers of polygons in a specific embodiment 1 of the present disclosure; Figure 3 As shown, in a specific embodiment 1, the polygon with the shortest distance value to polygon 0 is polygon 1. Through the obstacle container judgment and the hash table judgment, it can be known that there is no obstacle in establishing the first target auxiliary line (0-0, 1-0) between polygon 0 and polygon 1, and the target auxiliary line (0-0, 1-0) is recorded in the obstacle container;

[0106] The polygon with the shortest distance to polygon 1 is polygon 2. Similarly, through the obstacle container, it can be seen that there is no obstacle when establishing the second target auxiliary line (1-2, 2-0) between polygon 1 and polygon 2. At the same time, the target auxiliary line (1-2, 2-0) is recorded in the obstacle container.

[0107] The polygon with the shortest distance to polygon 2 is polygon 1. According to the obstacle container, the third target auxiliary line (2-0, 1-2) established between polygon 1 and polygon 2 is the same as the second target auxiliary line (1-2, 2-0), so the auxiliary line is not established repeatedly.

[0108] The polygon with the shortest distance to polygon 3 is polygon 4. According to the obstacle container, it can be seen that there is no obstacle in establishing the fourth target auxiliary line (3-3, 4-0) between polygon 3 and polygon 4. At the same time, the fourth target auxiliary line (3-3, 4-0) is recorded in the obstacle container.

[0109] The polygon with the shortest distance to polygon 4 is polygon 3. According to the obstacle container, it can be known that the fifth target auxiliary line (4-0, 3-3) established between polygon 3 and polygon 4 is the same as the fourth target auxiliary line (3-3, 4-0), so the auxiliary line is not established repeatedly;

[0110] The polygon with the shortest distance to polygon 5 is polygon 2. According to the obstacle container, it can be seen that there is no obstacle in establishing the sixth target auxiliary line (5-0, 2-2) between polygon 5 and polygon 2. At the same time, the sixth target auxiliary line (5-0, 2-2) is recorded in the obstacle container.

[0111] Since a first single-layer polygon is formed between polygons 0, polygons 1, polygons 2 and polygons 5 through auxiliary lines, and a second single-layer polygon is formed between polygons 3 and polygons 4 through auxiliary lines, it can be judged through the obstacle container that the shortest distance between the first single-layer polygon and the second single-layer polygon is the seventh target auxiliary line (1-2, 3-1), and there is no obstacle on the seventh target auxiliary line, and the seventh target auxiliary line (1-2, 3-1) is recorded in the obstacle container.

[0112] Step 2022, traverse the auxiliary lines and the vertices of all polygons in at least two layers of polygon graphics in order to obtain second graphic information of a layer of polygon graphics, the second graphic information including: vertex coordinates of a layer of polygon targets arranged in order.

[0113] The second graphic information in this embodiment is preferably represented in the form of an output array, which includes: a new polygon array and an ignore array; the new polygon array is an array of a layer of polygon graphics corresponding to the second graphic information, and the new polygon array is used to represent the vertex coordinates of a layer of polygon targets arranged in sequence, and the ignore array is an array that records the endpoint coordinate information of the added auxiliary lines.

[0114] Further, step 2022 includes:

[0115] Step 20221, two polygons with auxiliary lines are grouped into one bucket to obtain multiple polygon buckets;

[0116] Here, when the polygon with the shortest distance value corresponding to the first polygon is calculated to be the second polygon, the first polygon and the second polygon are stored in the polygon bucket;

[0117] Figure 4 FIG. 2 shows a schematic diagram of storing polygons into polygon buckets in a specific embodiment 2 of the present disclosure; Figure 3 and Figure 4 As shown, in a specific embodiment 2, the polygon with the shortest distance value to polygon 0 is polygon 1, and polygon 1 and polygon 2 are stored in the polygon bucket in the form of "0, 1".

[0118] Step 20222, merging multiple polygon buckets to obtain a target bucket; the merged target bucket can determine that all polygon graphics have at least one auxiliary line connected to at least one polygon, and ensure that the auxiliary lines do not form loops or crosses; the bucket is used to record the connection between polygons, but not the connection between points;

[0119] Further, step 20222 includes:

[0120] Step 202221, if the polygons in the first bucket of the multiple polygon buckets are exactly the same as the polygons in the second bucket, delete any bucket in the first bucket and the second bucket to obtain the current middle bucket; please note that the polygons being exactly the same here has nothing to do with the order of the polygons in the buckets, that is, when the polygons in the first bucket are "1, 2" and the polygons in the second bucket are "2, 1", the first bucket and the second bucket are the same;

[0121] Step 202222, if the polygons in the first bucket of the multiple polygon buckets are not completely the same as the polygons in the second bucket, then merge the first bucket and the second bucket to obtain a current intermediate bucket; the fact that the polygons are not completely the same here is also irrelevant to the order of the polygons in the buckets, that is, when the polygons in the first bucket are "0, 1, 2", and the polygons in the second bucket are "2, 3", then the first bucket and the second bucket are not completely the same; wherein the role of the bucket is similar to a container for storing the connection relationship between at least two polygons, and the content in the bucket is dynamically changing, and when the first bucket and the second bucket are merged, the current intermediate bucket is obtained, and here, the current intermediate bucket is used to store the connection relationship between at least two polygons in the process of bucket merging; further, if the third bucket and the first current intermediate bucket are merged, a second current intermediate bucket can be obtained on the basis of the first current intermediate bucket, and at this time, the content in the first current intermediate bucket is updated to the content of the second current intermediate bucket;

[0122] Step 202223, determine whether the polygons in the current intermediate bucket are exactly the same as the polygons in the next polygon bucket, until all polygon buckets are traversed to obtain the target bucket.

[0123] The target bucket is preferably a bucket list, which is a one-dimensional array whose elements are sets with the same key value and records the information of polygons. If the polygon buckets are initialized, they can be divided into several buckets. When the buckets are iteratively merged, the merging process is completed when the remaining number of buckets is 1. A set is similar to a container and can store objects. The set does not record the order of addition. When duplicate objects are saved in a set, the duplicate objects added later will not be added.

[0124] It should be noted that, before the polygon bucket merging process is performed, a polygon bucket cleaning process may be included to clean the polygon bucket data for the external algorithm rules.

[0125] like Figures 3 to 10 As shown, in a specific embodiment 3, Figure 3 The two-dimensional coordinate system xy in the figure includes two layers of polygonal graphics, which include polygon 0, polygon 1, polygon 2, polygon 3, polygon 4 and polygon 5. The dotted line is an auxiliary line. When the shortest distance value of polygon 0 is calculated, it can be known that the polygon with the shortest distance value corresponding to polygon 0 is polygon 1. Figure 4 The polygon bucket in is recorded as "0, 1"; when the shortest distance value of polygon 1 is calculated, it is known that the polygon figure with the shortest distance value corresponding to polygon 1 is polygon 2, then Figure 5 "1, 2" is recorded in the polygon bucket in ; when the shortest distance values ​​of polygon 2, polygon 3, polygon 4 and polygon 5 are calculated, it can be known that the polygon figures with the shortest distance values ​​corresponding to polygon 2, polygon 3, polygon 4 and polygon 5 are polygon 1, polygon 4, polygon 3 and polygon 2 respectively. Figure 6 The polygon buckets in record "2, 1", "3, 4", "4, 3" and "5, 2" in sequence;

[0126] Merge the polygon buckets. Figure 6 The "0, 1" and "1, 2" in are not exactly the same, so "0, 1" and "1, 2" are combined into Figure 7 The "0, 1, 2" shown; due to Figure 7 The polygons in "0, 1, 2" and "2, 1" are exactly the same, so Figure 7 The "2, 1" in the polygon bucket is deleted, and the remaining data in the polygon bucket is as follows Figure 8 As shown; due to Figure 8 The "0, 1, 2" and "3, 4" in are not exactly the same, so "0, 1, 2" and "3, 4" are combined into Fig. 9 The "0, 1, 2, 3, 4" shown; due to Fig. 9 The polygons in "0, 1, 2, 3, 4" and "4, 3" are exactly the same, so Fig. 9 The "4, 3" in the polygon bucket is deleted, and the remaining data in the polygon bucket is as follows Fig.10 As shown; Finally, due to Fig.10 The polygons in "0, 1, 2, 3, 4" and "5, 2" shown in the figure are not exactly the same, so "0, 1, 2, 3, 4" and "5, 2" can be merged into "0, 1, 2, 3, 4, 5, 2".

[0127] Step 20223, output the vertices of all polygons in the target bucket in order to obtain the second graphic information of a layer of polygonal graphics.

[0128] The second graphic information of a layer of polygonal graphics in this embodiment is preferably a one-dimensional array, which includes the coordinate structures of each vertex in a layer of polygons, wherein the coordinate structures of each vertex in the one-dimensional array are arranged in a certain order, and according to the order, a layer of polygons can be output in a "similar one-stroke" manner;

[0129] Further, step 20223 includes:

[0130] Step 202231, for all polygons in the target bucket, traverse the vertices of all polygons in order. If the current vertex has no auxiliary line, traverse the next vertex of the polygon in order;

[0131] Step 202232: if the current vertex has an auxiliary line, and there is only one auxiliary line, proceed along the auxiliary line to the next polygon connected to the auxiliary line to perform vertex traversal;

[0132] Step 202233, if the current vertex has an auxiliary line and there are N auxiliary lines, obtain traversal in order of the size of the angle, reset the traversal direction to the auxiliary line or edge corresponding to the smallest angle, and enter the next polygon connected by the auxiliary line; until the vertices of all polygons are traversed, the second graphic information of a layer of polygonal graphics is obtained, N is an integer greater than 1, and the second graphic information includes: a vertex sequence formed by the traversal of the vertices of all polygons.

[0133] In this embodiment, all polygons in the target bucket are traversed in order for each polygon's vertex. The traversal order can be clockwise or counterclockwise. For each polygon, it is possible to traverse in a clockwise or counterclockwise direction during the traversal process. Here, the polygon data source is preferably calculated, and the index is incremented in the clockwise case and decremented in the counterclockwise case, which can reduce resource waste and time loss in sorting data.

[0134] When traversing all polygons in the target bucket, determine whether there is an auxiliary line on the current vertex. If there is no auxiliary line on the current vertex, traverse to the next vertex in order; if there is only one auxiliary line on the current vertex, traverse to the other end point of the auxiliary line, that is, the other end point of the auxiliary line is used as the next vertex; if there are N auxiliary lines on the current vertex, obtain the angle between the baseline and the N auxiliary lines and the edges starting from the current vertex, and traverse the angles in order of size until the vertices of all polygons are traversed;

[0135] It should be noted that, in addition to the auxiliary lines, the current vertex may also have edges of other polygons. When the current vertex has at least one auxiliary line and at least one edge of other polygons, it is also sorted according to the angle size and traversed in sequence in the same way as in step 202233; it is also possible that the vertex is another vertex within the self-enclosed polygon, that is, the current vertex has, in addition to at least one auxiliary line and at least one edge of other polygons, an edge of the self-enclosed polygon itself. If there is only one edge of the self-enclosed polygon and it has been traversed, it can be ignored; if there are M edges of the self-enclosed polygon (M>1) and they have all been traversed, they can be ignored; if there are M edges of the self-enclosed polygon (M>1) and there are edges that have not been traversed, the traversed edges can be ignored, and the remaining untraversed edges are sorted according to the angle size and traversed in sequence in the manner in step 202233.

[0136] Fig.11 FIG. 4 is a schematic diagram showing the second graphic information of generating a layer of polygonal graphics in a specific embodiment 4 provided by the present disclosure; Fig.11As shown, in a specific embodiment 4, starting from the 0-0 point of polygon 0, the traversal of polygon 0 is completed in sequence according to 0-0, 0-1, 0-2, 0-3, and 0-0. When the traversal of polygon 0 is completed, there are auxiliary lines (0-0, 2-0), the edge of polygon 3 (0-0, 3-2), the edge of polygon 3 (0-0, 3-1), the auxiliary lines (0-0, 1-0), and the edge of polygon 0 itself (0-0, 0-1) at the 0-0 point. The edge at the current 0-0 point is judged. Since the edge of polygon 0 itself (0-0, 0-1) If it has been traversed, the edge (0-0, 0-1) of polygon 0 itself is ignored, and the edge (0-0, 0-3) of the most recent traversal is used as the baseline. The angles between the baseline and the auxiliary line (0-0, 2-0), the edge (0-0, 3-2) of polygon 3, the edge (0-0, 3-1) of polygon 3, and the auxiliary line (0-0, 1-0) are calculated as ∠1, ∠2, ∠3, and ∠4, respectively. The order of the angles is ∠1<∠2<∠3<∠4. The traversal is performed in the order of the angles from small to large. Therefore, the next vertex traversed by the current 0-0 point is 2-0 point.

[0137] At point 2-0, there are the edge (2-0, 2-1) of polygon 2 and the edge (2-0, 2-2) of polygon 2. With the auxiliary line (0-0, 2-0) as the baseline, traverse in the order of angle from small to large. The next vertex traversed by the current point 2-0 is point 2-1, the next vertex of point 2-1 is point 2-2, and the next vertex of point 2-2 is point 2-0. When at point 2-0, with the edge (2-0, 2-2) of polygon 2 as the baseline, there are the edge (2-0, 2-1) of polygon 2 and the auxiliary line (0-0, 2-0). Since the edge (2-0, 2-1) of polygon 2 has been traversed and there is only one auxiliary line (0-0, 2-0), the next vertex of point 2-0 is the other end point 0-0 of the auxiliary line.

[0138] At this time, we return to the 0-0 point again, with the auxiliary line (0-0, 2-0) as the baseline. There are the edge of polygon 0 (0-0, 0-3), the edge of polygon 3 (0-0, 3-2), the edge of polygon 3 (0-0, 3-1), the auxiliary line (0-0, 1-0) and the edge of polygon 0 (0-0, 0-1). We ignore the edge of polygon 0 (0-0, 0-3) and the edge of polygon 0 (0-0, 0-1) that have been traversed. We traverse in order from the smallest to the largest angle. The current 0-0 point is traversed. The next vertex of 3-2 is point 3-2; currently, there are auxiliary lines (3-2, 6-0), the edge of polygon 4 (3-2, 4-1), the edge of polygon 4 (3-2, 4-2), auxiliary lines (3-2, 7-0) and the edge of polygon 3 (3-2, 3-1) on point 3-2. At this time, since the edge of polygon 3 (3-2, 3-1) has not been traversed, it cannot be ignored. The traversal is carried out in the order of small to large angles. The next vertex traversed by the current point 0-0 is point 6-0; and so on, the corresponding Fig.11 The second graphic information in is {0-0,0-1,0-2,0-3,0-0,2-0,2-1,2-2,2-0,0-0,3-2,6-0,6-1,6-2,6-0,3-2,4-1,4-2,3-2,7-0,5-0,5-2,5-1,5-0,7-0,7-2,7-1,7-0,3-2,3-1,0-0,1-0,1-2,1-1,1-0,0-0}. It should be noted that 0-0 Point 0-0 and point 3-0 coincide as the same point, point 3-2 and point 4-0 coincide as the same point. For uniform expression, point 0-0 represents point 0-0 and point 3-0, and point 3-2 represents point 3-2 and point 4-0. In this embodiment, traversal is performed in order from small to large angles based on the opposite direction of the outermost circle of the polygonal figure. That is, when the outermost circle of polygons (polygon 0 in this embodiment) is traversed in a counterclockwise direction, the inner circle of polygons are traversed in a clockwise direction.

[0139] Fig.12 FIG. 5 is a schematic diagram showing the second graphic information of generating a layer of polygonal graphics in a specific embodiment 5 provided by the present disclosure; Fig.12As shown, in a specific embodiment 5, the polygonal figure includes polygon 0, polygon 1 and polygon 2. Polygon 0 and polygon 1 are connected by auxiliary lines (0-0, 1-0), and polygon 1 and polygon 2 are connected by auxiliary lines (1-0, 2-0). Starting from vertex 0-0, traversal is performed in the order of 0-0, 0-1, 0-2, 0-3, and 0-0. The current point is point 0-0. At this time, there are edges (0-0, 0-1) and auxiliary lines (0-0, 1-0) of polygon 0. The edges (0-0, 0-1) of polygon 0 are ignored, and the next vertex of the current point 0-0 is point 1-0. Taking the line segment (0-0, 1-0) traversed the most recently as the baseline, the angles are ∠5<∠6<∠7 respectively. Traversal is performed in the order of angles from small to large. The next vertex traversed by the current point 1-0 is point 2-0. And so on. Fig.12 The second graphic information in is:

[0140] {0-0,0-1,0-2,0-3,0-0,1-0,2-0,2-2,2-1,2-0,1-0,1-2,1-1,1-0,0-0}, it should be noted that, in this embodiment, the traversal in order from small to large angles is based on the opposite direction of the outermost circle of polygons of the polygonal figure, that is, when the outermost circle of polygons (polygon 0 in this embodiment) is traversed in a counterclockwise direction, the inner circle of polygons are traversed in a clockwise direction.

[0141] Fig.13 FIG. 4 is a schematic diagram showing the second graphic information of generating a layer of polygonal graphics in a specific embodiment 6 provided by the present disclosure; Fig.13 As shown, in a specific embodiment 6, the polygonal figure includes polygon 0, polygon 1, polygon 2 and polygon 3. Auxiliary lines (0-0, 1-5) are used to connect polygon 0 and polygon 1, auxiliary lines (0-2, 3-2) are used to connect polygon 0 and polygon 3, and auxiliary lines (3-1, 2-3) are used to connect polygon 3 and polygon 2. The traversal is performed in the order of 0-0, 0-1, and 0-2. When the current point is 0-2, there are auxiliary lines (0-2, 3-2) and the edge (0-2, 0-1) of polygon 0 itself. At this time, the line segment (0-3, 0-2) traversed most recently is used as the baseline, and angles ∠8 < ∠9 are obtained respectively. The traversal is performed in the order of the angles from small to large. The next vertex traversed by the current 0-2 point is 3-2. By analogy, the corresponding Fig.13 The second graphic information in is:

[0142] {0-0,0-1,0-2,3-2,3-3,3-0,3-1,2-3,2-0,2-1,2-2,2-3,3-1,3-2,0-2,0-1,0-0,1-5,1,4,1-3,1-2,1-1,1-0,1-5,0-0}, it should be noted that in this embodiment, the traversal in the order of angle from small to large is based on the opposite direction of the outermost circle of polygons of the polygonal figure, that is, when the outermost circle of polygons (polygon 0 in this embodiment) is traversed in a counterclockwise direction, the inner circle of polygons are traversed in a clockwise direction.

[0143] Step 203, obtaining a target layer of polygonal graphics according to the second graphics information;

[0144] The head and tail of the auxiliary line are preset marked in the second graphic information, and then the auxiliary line is deleted according to the preset mark to obtain a target layer of polygonal graphics.

[0145] Step 204 , rendering the target object in the virtual scene according to the target layer of polygonal graphics to obtain a rendering result of the target object.

[0146] The target layer of polygonal graphics obtained by the above "approximate one-stroke drawing" is rendered in the virtual scene, and there is no need to introduce auxiliary computing tools such as CGAL or GDAL for auxiliary operation, which greatly speeds up the computing speed and improves resource utilization.

[0147] The graphics processing method in the embodiment of the present disclosure can be applied to the UE4 engine, but is not limited to the engine, and can also be applied to any application or device that needs to process polygons according to the above method. The above embodiment obtains the first graphic information of at least two layers of polygonal graphics; each layer of polygons in the two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon; according to the first graphic information, the at least two layers of polygonal graphics are converted and processed to obtain the second graphic information of a layer of polygonal graphics, and the layer of polygonal graphics is a plane polygonal graphics without a nested relationship; according to the second graphic information, a target layer of polygonal graphics is obtained; according to the target layer of polygonal graphics, a target object in the virtual scene is rendered to obtain a rendering result of the target object; the polygons are efficiently processed, so as to achieve the goal of efficiently rendering the target object. At the same time, when applied to related engines or applications, multi-caching and multi-tasking can be expanded to speed up the computing rate and resource utilization of the above graphics processing method.

[0148] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, which will not be described one by one here.

[0149] Fig.14is a schematic diagram of a graphics processing device provided by an embodiment of the present disclosure, see Fig.14 , the device 1400 comprises:

[0150] An acquisition module 1401 is used to acquire first graphic information of at least two layers of polygonal graphics; each layer of polygons in the two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon;

[0151] Processing module 1402 is used to convert at least two layers of polygonal graphics according to the first graphic information to obtain second graphic information of a layer of polygonal graphics, where the layer of polygonal graphics is a plane polygonal graphic without a nested relationship; obtain a target layer of polygonal graphics according to the second graphic information; and render a target object in a virtual scene according to the target layer of polygonal graphics to obtain a rendering result of the target object.

[0152] Optionally, the acquisition module 1401 includes:

[0153] The first acquisition submodule is used to acquire coordinate information of vertices of each polygon of at least two layers of polygonal graphics in a preset coordinate system.

[0154] Optionally, the processing module 1402 includes:

[0155] A first processing submodule is used to process any two polygons in at least two layers of polygonal graphics according to the first graphic information, and establish auxiliary lines between the two polygons;

[0156] The second processing submodule is used to sequentially traverse the auxiliary lines and the vertices of all polygons in at least two layers of polygonal graphics to obtain second graphic information of a layer of polygonal graphics, wherein the second graphic information includes: vertex coordinates of a layer of polygonal graphics arranged in sequence.

[0157] Optionally, the first processing submodule includes:

[0158] A first processing unit, configured to calculate, based on the first graphic information, a distance between any vertex of a first polygon and any vertex of a second polygon in at least two layers of polygonal graphics to obtain a plurality of distance values;

[0159] The second processing unit is used to connect two vertices corresponding to the shortest distance value among multiple distance values ​​to form an auxiliary line between the first polygon and the second polygon; until the auxiliary lines between all polygons in the two-layer polygonal graphics are established; the auxiliary line does not intersect with the edges of the first polygon and the second polygon, and does not intersect with the already established auxiliary lines.

[0160] Optionally, the second processing submodule includes:

[0161] A third processing unit is used to group two polygons with auxiliary lines into one bucket to obtain a plurality of polygon buckets;

[0162] The fourth processing unit is used to merge the multiple polygon buckets to obtain a target bucket;

[0163] The fifth processing unit is used to output the vertices of all polygons in the target bucket in order to obtain second graphic information of a layer of polygonal graphics.

[0164] Optionally, the fourth processing unit includes:

[0165] A first processing subunit is configured to delete any one of the first bucket and the second bucket to obtain a current intermediate bucket when the polygons in the first bucket and the second bucket are exactly the same among the multiple polygon buckets;

[0166] A second processing subunit is configured to merge the first bucket and the second bucket among the multiple polygon buckets to obtain a current intermediate bucket when the polygons in the first bucket and the polygons in the second bucket are not completely the same;

[0167] The third processing subunit is used to determine whether the polygons in the current intermediate bucket are identical to the polygons in the next polygon bucket, until all polygon buckets are traversed to obtain a target bucket.

[0168] Optionally, the fifth processing unit includes:

[0169] The fourth processing sub-unit is used to traverse the vertices of all polygons in the target bucket in order, and if the current vertex has no auxiliary line, traverse the next vertex of the polygon in order;

[0170] A fifth processing sub-unit, configured to, if the current vertex has an auxiliary line, and the auxiliary line is one, proceed along the auxiliary line to the next polygon connected to the auxiliary line to perform vertex traversal;

[0171] The sixth processing sub-unit is used to obtain the angles between the baseline and the N auxiliary lines and the edges starting from the current vertex if the current vertex has an auxiliary line and there are N auxiliary lines, traverse in order of the size of the angles, reset the traversal direction to the auxiliary line or edge corresponding to the smallest angle, and enter the next polygon connected by the auxiliary line; until the vertices of all polygons are traversed, the second graphic information of a layer of polygonal graphics is obtained, N is an integer greater than 1, and the second graphic information includes: a vertex sequence formed by completing the traversal of the vertices of all polygons.

[0172] The device provided by the embodiment of the present disclosure, when performing graphics processing, converts at least two layers of polygonal graphics to obtain second graphics information of a layer of polygonal graphics, thereby obtaining a target layer of polygonal graphics based on the second graphics information, and then rendering the target object in the virtual scene based on the layer of polygonal graphics, thereby improving the efficiency of graphics processing.

[0173] It should be noted that: the graphics processing device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the graphics processing device provided in the above embodiment and the graphics processing method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0174] The graphics processing device in the embodiments of the present disclosure may be a virtual device, or a component, integrated circuit or chip in a server or terminal. The device may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device may be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiments of the present disclosure.

[0175] The graphics processing device in the embodiment of the present disclosure may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present disclosure.

[0176] The graphics processing device provided by the embodiment of the present disclosure can achieve Figures 2 to 13 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0177] Alternatively, if Fig.15As shown, the embodiment of the present disclosure further provides an electronic device 1500, including a processor 1501, a memory 1502, and a program or instruction stored in the memory 1502 and executable on the processor 1501. When the program or instruction is executed by the processor 1501, each process of the above-mentioned graphics processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. It should be noted that the electronic device in the embodiment of the present disclosure includes the above-mentioned mobile electronic device and non-mobile electronic device.

[0178] Fig.16 A schematic diagram of the hardware structure of an electronic device for implementing an embodiment of the present disclosure.

[0179] The electronic device 1600 includes but is not limited to: a radio frequency unit 1601, a network module 1602, an audio output unit 1603, an input unit 1604, a sensor 1605, a display unit 1606, a user input unit 1607, an interface unit 1608, a memory 1609, and a processor 1610 and other components.

[0180] Those skilled in the art will appreciate that the electronic device 1600 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1610 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.16 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0181] It should be understood that in the embodiment of the present disclosure, the input unit 1604 may include a graphics processor (GPU) 16041 and a microphone 16042, and the graphics processor 16041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1606 may include a display panel 16061, and the display panel 16061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1607 includes a touch panel 16071 and other input devices 16072. The touch panel 16071 is also called a touch screen. The touch panel 16071 may include two parts: a touch detection device and a touch controller. Other input devices 16072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1609 may be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1610 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1610.

[0182] The disclosed embodiment also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned remote autonomous driving simulation control method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0183] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0184] The disclosed embodiment further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned remote autonomous driving simulation control method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0185] It should be understood that the chip mentioned in the embodiments of the present disclosure may also be referred to as a system-level chip, a system chip, a chip system, or a system-on-chip chip, etc.

[0186] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiments of the present disclosure is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0187] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present disclosure.

[0188] The embodiments of the present disclosure are described above in conjunction with the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present disclosure, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present disclosure and the claims, all of which are within the protection of the present disclosure.

Claims

1. A graphics processing method, characterized in that: The method comprises: Acquire first graphic information of at least two layers of polygonal graphics; each layer of polygons in the at least two layers of polygonal graphics has a nested relationship, and each layer of polygons includes at least one polygon; According to the first graphic information, the at least two layers of polygonal graphics are converted to obtain second graphic information of a layer of polygonal graphics, wherein the layer of polygonal graphics is a plane polygonal graphic without a nested relationship; According to the second graphic information, a target layer of polygonal graphics is obtained; Rendering the target object in the virtual scene according to the target layer of polygonal graphics to obtain a rendering result of the target object; The at least two layers of polygonal graphics are converted and processed according to the first graphic information to obtain second graphic information of a layer of polygonal graphics, including: According to the first graphic information, any two polygons in the at least two layers of polygonal graphics are processed to establish auxiliary lines between the two polygons; The auxiliary lines and the vertices of all polygons in the at least two layers of polygonal graphics are traversed in order to obtain second graphic information of a layer of polygonal graphics, wherein the second graphic information includes: vertex coordinates of a layer of polygonal graphics arranged in order.

2. The graphics processing method according to claim 1, characterized in that: Obtaining first graphic information of at least two layers of polygonal graphics, including: Obtain coordinate information of vertices of each polygon of at least two layers of polygonal graphics in a preset coordinate system.

3. The graphics processing method according to claim 1, characterized in that: According to the first graphic information, any two polygons in the at least two layers of polygonal graphics are processed to establish auxiliary lines between the two polygons, including: According to the first graphic information, calculating the distance between any vertex of the first polygon and any vertex of the second polygon in the at least two layers of polygonal graphics to obtain multiple distance values; Connect two vertices corresponding to the shortest distance value among the multiple distance values ​​to form an auxiliary line between the first polygon and the second polygon; until the auxiliary lines between all polygons in the two-layer polygonal graphics are established; the auxiliary line does not intersect with the edges of the first polygon and the second polygon, and does not intersect with the auxiliary lines that have been established.

4. The graphics processing method according to claim 1, characterized in that: The auxiliary lines and the vertices of all polygons in the at least two layers of polygonal graphics are traversed in order to obtain second graphic information of a layer of polygonal graphics, including: Combine two polygons with auxiliary lines into one bucket to obtain multiple polygon buckets; Merging the multiple polygonal buckets to obtain a target bucket; The vertices of all polygons in the target bucket are output in order to obtain second graphic information of a layer of polygons.

5. The graphics processing method according to claim 4, characterized in that: The multiple polygon buckets are merged to obtain a target bucket, including: If the polygons in a first bucket of the multiple polygon buckets are exactly the same as the polygons in a second bucket, deleting any one of the first bucket and the second bucket to obtain a current intermediate bucket; If the polygons in a first bucket of the plurality of polygon buckets are not completely the same as the polygons in a second bucket, merging the first bucket and the second bucket to obtain a current intermediate bucket; It is determined whether the polygons in the current intermediate bucket are identical to the polygons in the next polygon bucket, until all polygon buckets are traversed to obtain the target bucket.

6. The graphics processing method according to claim 4, characterized in that: Output the vertices of all polygons in the target bucket in order to obtain second graphic information of a layer of polygonal graphics, including: For all polygons in the target bucket, traverse the vertices of all polygons in order. If the current vertex has no auxiliary line, traverse the next vertex of the polygon in order. If the current vertex has an auxiliary line, and there is only one auxiliary line, proceed along the auxiliary line to the next polygon connected to the auxiliary line to perform vertex traversal; If the current vertex has an auxiliary line and there are N auxiliary lines, obtain the angles between the baseline and the N auxiliary lines and the edges starting from the current vertex, traverse in order of the angles, reset the traversal direction to the auxiliary line or edge corresponding to the smallest angle, and enter the next polygon connected by the auxiliary line; until all polygon vertices are traversed, obtain the second graphic information of a layer of polygon graphics, N is an integer greater than 1, and the second graphic information includes: The vertex sequence formed after traversing the vertices of all polygons.

7. A graphics processing device, characterized in that: include: An acquisition module, used for acquiring first graphic information of at least two layers of polygonal graphics; There is a nested relationship between each layer of polygons in the two layers of polygon graphics, and each layer of polygons includes at least one polygon; A processing module, configured to convert the at least two layers of polygonal graphics according to the first graphic information to obtain second graphic information of a layer of polygonal graphics, wherein the layer of polygonal graphics is a plane polygonal graphic without a nested relationship; According to the second graphic information, a target layer of polygonal graphics is obtained; Rendering the target object in the virtual scene according to the target layer of polygonal graphics to obtain a rendering result of the target object; The at least two layers of polygonal graphics are converted and processed according to the first graphic information to obtain second graphic information of a layer of polygonal graphics, including: According to the first graphic information, any two polygons in the at least two layers of polygonal graphics are processed to establish auxiliary lines between the two polygons; The auxiliary lines and the vertices of all polygons in the at least two layers of polygonal graphics are traversed in order to obtain second graphic information of a layer of polygonal graphics, wherein the second graphic information includes: vertex coordinates of a layer of polygonal graphics arranged in order.

8. An electronic device, characterized in that: It comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the graphics processing method as described in any one of claims 1 to 6.

9. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the graphics processing method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Three-dimensional model generation method and device, storage medium and electronic equipment

    CN113256782A

  • Customizable Render Pipelines using Render Graphs

    US20200104970A1