Three-dimensional primitive rendering method and device, storage medium and electronic equipment
By managing triangular primitives using a binary tree linked list, efficient rendering of 3D primitives is achieved, solving the problems of storage resources and time consumption, and improving rendering efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
- Filing Date
- 2022-07-29
- Publication Date
- 2026-05-29
AI Technical Summary
Existing 3D primitive rendering methods consume a lot of storage resources and time, resulting in low rendering efficiency.
By determining the binary tree linked list corresponding to the triangular primitive, it is determined whether thinning or coarsening is required. Based on the preset binary triangulation strategy, the triangular primitive is subdivided into triangles or vertices are deleted. The binary tree linked list is then updated to achieve rendering.
This reduces the storage requirements for models at various levels of detail, improving rendering efficiency and speed.
Smart Images

Figure CN115272547B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a three-dimensional primitive rendering method and apparatus, storage medium and electronic device. Background Technology
[0002] With the development of image processing technology, 3D primitive rendering has become one of the commonly used image processing techniques. In the process of rendering and displaying 3D primitives, it is often necessary to refine and coarse the 3D primitives, that is, to render 3D primitives with different precision effects.
[0003] Existing rendering methods typically rely on Levels of Detail (LOD) technology to render 3D primitives. This involves constructing multiple LOD models, each describing the detailed mesh of the corresponding 3D primitive. When a 3D primitive needs to be rendered at a specific LOD level, the rendering is switched to the corresponding LOD model to achieve either refined or coarser rendering of the 3D primitive.
[0004] In real-world applications, the mesh structure of 3D primitives is typically very complex, and the detailed meshes described by the corresponding level-of-detail (HLD) models are also extremely complex. Therefore, existing rendering methods require a large amount of storage space to store the detailed mesh information for each HLD model, consuming significant storage resources. Furthermore, the application of the HLD model during rendering involves large amounts of data, which can easily lead to excessively long rendering times and low rendering efficiency. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a three-dimensional primitive rendering method to solve the problem that existing rendering methods require a large amount of storage resources and have low rendering efficiency.
[0006] This invention also provides a three-dimensional primitive rendering device to ensure the practical implementation and application of the above method.
[0007] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0008] A method for rendering 3D primitives, comprising:
[0009] When it is necessary to render a 3D primitive, determine multiple triangular primitives corresponding to the 3D primitive;
[0010] Each of the triangular primitives is rendered sequentially to render the three-dimensional primitive;
[0011] The rendering process for each of the triangular primitives includes:
[0012] Determine the binary tree linked list corresponding to the current triangular primitive, wherein the binary tree linked list contains a vertex array and a triangle index array;
[0013] Determine whether the current triangular primitive needs to be refined;
[0014] If the current triangular primitive needs to be refined, then based on the preset binary triangular subdivision strategy, the current triangular primitive is subdivided into triangles to obtain the new vertices corresponding to the current triangular primitive.
[0015] The binary tree linked list is updated based on the newly added vertex to obtain the updated binary tree linked list, and the current triangular primitive is rendered based on the updated binary tree linked list.
[0016] Optionally, in the above method, determining the binary tree linked list corresponding to the current triangular primitive includes:
[0017] Determine whether a target binary tree list exists in a plurality of pre-stored preset binary tree lists, wherein the target binary tree list is a preset binary tree list associated with the current triangular primitive;
[0018] If the target binary tree list does not exist in any of the multiple preset binary tree lists, a new binary tree list is created, and the newly created binary tree list is used as the binary tree list corresponding to the current triangular primitive.
[0019] The above methods may also include:
[0020] If the target binary tree list exists in the plurality of preset binary tree lists, then the target binary tree list is used as the binary tree list corresponding to the current triangular primitive.
[0021] Optionally, in the above method, updating the binary tree linked list based on the newly added vertex includes:
[0022] Determine the vertex information corresponding to the newly added vertex, and add the vertex information corresponding to the newly added vertex to the vertex array;
[0023] Determine the triangle index data corresponding to the newly added vertex;
[0024] The triangle index data corresponding to the newly added vertex is added to the triangle index array, and the association between the vertex information corresponding to the newly added vertex and the triangle index data corresponding to the newly added vertex is established to update the binary tree linked list.
[0025] The above methods may also include:
[0026] If the current triangular primitive does not need to be refined, then determine whether the current triangular primitive needs to be coarsened.
[0027] If the current triangular primitive needs to be coarsened, then the current triangular primitive is subjected to vertex deletion, and the deleted vertex is taken as the target vertex.
[0028] Based on the target vertex, data is deleted from the binary tree linked list to obtain a binary tree linked list with data deletion, and the current triangular primitive is rendered based on the binary tree linked list with data deletion.
[0029] Optionally, in the above method, the step of deleting data from the binary tree linked list based on the target vertex includes:
[0030] Determine the vertex information corresponding to the target vertex in the vertex array;
[0031] Determine the triangle index data corresponding to the target vertex in the triangle index array;
[0032] Delete the vertex information corresponding to the target vertex in the vertex array, and delete the triangle index data corresponding to the target vertex in the triangle index array;
[0033] Among the vertices of the current triangular primitive, determine the index-associated vertex corresponding to the target vertex, wherein the index value of the index-associated vertex is greater than the index value of the target vertex;
[0034] In the triangle index array, determine the target index values corresponding to the index-associated vertices, and modify the target index values to delete data from the binary tree linked list.
[0035] Optionally, in the above method, rendering the current triangular primitive based on the updated binary tree linked list includes:
[0036] Configure the vertex index buffer according to the updated binary tree linked list, and render the current triangular primitives according to the vertex index buffer.
[0037] A three-dimensional primitive rendering device, comprising:
[0038] The determining unit is used to determine multiple triangular primitives corresponding to the three-dimensional primitives when rendering of the three-dimensional primitives is required;
[0039] A rendering unit is used to render each of the triangular primitives in sequence to render the three-dimensional primitives;
[0040] The rendering unit includes:
[0041] The first determining subunit is used to determine the binary tree linked list corresponding to the current triangular primitive, wherein the binary tree linked list contains a vertex array and a triangle index array;
[0042] The first judgment subunit is used to determine whether the current triangular primitive needs to be refined.
[0043] The subdivision subunit is used to subdivide the current triangular primitive into triangles based on a preset binary triangular splitting strategy if the current triangular primitive needs to be refined, thereby obtaining the new vertex corresponding to the current triangular primitive.
[0044] The first rendering subunit is used to update the binary tree linked list based on the newly added vertex, obtain the updated binary tree linked list, and render the current triangular primitives according to the updated binary tree linked list.
[0045] A storage medium comprising stored instructions, wherein, when the instructions are executed, the device in which the storage medium resides executes the three-dimensional primitive rendering method as described above.
[0046] An electronic device includes a memory and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors as described above in the three-dimensional primitive rendering method.
[0047] A three-dimensional primitive rendering method based on the above embodiments of the present invention includes: when rendering a three-dimensional primitive, determining multiple triangular primitives corresponding to the three-dimensional primitive, and rendering each triangular primitive sequentially to render the three-dimensional primitive. During the rendering process of each triangular primitive, determining the binary tree linked list corresponding to the current triangular primitive, and determining whether the current triangular primitive needs refinement; if the current triangular primitive needs refinement, then subdividing the current triangular primitive into triangles based on a preset binary triangular subdivision strategy to obtain newly added vertices corresponding to the current triangular primitive. Updating the binary tree linked list based on the newly added vertices to obtain an updated binary tree linked list, and rendering the current triangular primitive according to the updated binary tree linked list. By applying the method provided by the embodiments of the present invention, the vertex information of the triangular primitive is managed through the binary tree linked list. When the rendering detail level changes, i.e., when refinement or other processing of the triangular primitive is required, the relevant vertex information of the triangular primitive can be quickly updated by modifying the binary tree linked list, thus obtaining the primitive structure information of the triangular primitive at the target detail level, which can be used to render the triangular primitive according to the target detail level. There's no need to store individual detail levels of the model to switch rendering detail levels, saving significant storage space. Secondly, linked list operations are faster, improving rendering efficiency. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0049] Figure 1 A flowchart of a three-dimensional primitive rendering method provided in an embodiment of the present invention;
[0050] Figure 2 This is a schematic diagram of the primitive structure of a triangular primitive provided in an embodiment of the present invention;
[0051] Figure 3 An example diagram illustrating a three-dimensional primitive rendering process provided in an embodiment of the present invention;
[0052] Figure 4 This is a schematic diagram of the structure of a three-dimensional primitive rendering device provided in an embodiment of the present invention;
[0053] Figure 5 This is another structural schematic diagram of a three-dimensional primitive rendering device provided in an embodiment of the present invention;
[0054] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0057] This invention provides a method for rendering three-dimensional primitives. The method can be applied to a graphics rendering platform, and its execution entity can be the server of the graphics rendering platform. The method flowchart is shown below. Figure 1 As shown, it includes:
[0058] S101: When it is necessary to render a three-dimensional primitive, determine multiple triangular primitives corresponding to the three-dimensional primitive;
[0059] In the method provided by this invention, in the application scenario of primitive rendering, a basic 3D primitive model is established using point clouds in space. This model is composed of various triangular primitives. Triangular primitives can be constructed in ways such as TriangleList, TriangleStrip, or TriangleFan. Drawing triangular primitives is essentially guiding and indexing related vertices; this is the foundation of existing 3D primitive rendering and will not be described in detail here. In the method provided by this invention, triangular primitives can be drawn using the TriangleStrip method. The primitive structure of triangular primitives determines the level of detail in the model. If more detailed features of the model need to be shown during rendering, the primitive structure of the triangular primitives needs to be refined, that is, vertices are added to the triangular primitives to refine the primitive structure.
[0060] In the method provided by this invention, when it is necessary to render a certain 3D primitive, the corresponding triangular primitives can be determined. Specifically, these triangular primitives can be the primitive structures of each triangular primitive, i.e., detailed meshes. Each triangular primitive is a basic triangular primitive of the 3D primitive, and is a triangular primitive divided when constructing the 3D primitive model.
[0061] S102: Among the various triangular primitives, determine the triangular primitive that needs to be rendered.
[0062] In the method provided by this embodiment of the invention, each triangular primitive is rendered sequentially to render the three-dimensional primitive. Therefore, among each triangular primitive, the triangular primitive that needs to be rendered is determined.
[0063] S103: Determine the binary tree linked list corresponding to the current triangular primitive, wherein the binary tree linked list contains a vertex array and a triangle index array;
[0064] In the method provided by this embodiment of the invention, during the rendering process of each triangular primitive, a binary tree linked list corresponding to the current triangular primitive can be determined. This binary tree linked list is configured based on the binary triangular tree corresponding to the current primitive structure of the triangular primitive, and the binary triangular tree represents the association relationship of each vertex in its primitive structure. In the method provided by this embodiment of the invention, the triangular primitive is triangularly split based on the principle of binary triangulation to achieve refinement of the triangular primitive. Therefore, the split vertices will have a binary association relationship.
[0065] The binary tree linked list contains a vertex array that records vertex information, and a triangle index array that records the triangle index data of the vertices.
[0066] In the specific implementation, the current triangular primitive's primitive structure can be a basic triangle structure, meaning the triangular primitive has not undergone refinement and its primitive structure does not contain the vertices expanded by the refined triangular primitive; it only contains the vertices of the basic triangular structure. In this case, the binary tree linked list only contains the information of the head node built from the basic vertices of the triangular primitive. Alternatively, the current triangular primitive can be a refined triangular primitive. In this case, the primitive structure of the triangular primitive, in addition to the basic vertices, also includes the vertices expanded by the binary triangular partitioning. The vertex array in its corresponding binary tree linked list records not only the vertex information of the basic vertices but also the vertex information of the expanded vertices, and the triangle index array also records the triangle index data of each expanded vertex.
[0067] A binary tree linked list, also known as a binary linked list, is a storage structure where nodes are connected by memory pointers. It is an existing data storage structure and will not be described in detail here. In the method provided in this embodiment, vertices in a triangular primitive correspond to nodes in a binary triangular tree. A binary tree linked list is used to record each node, i.e., each vertex. A vertex array records the vertex information of each vertex. Then, a region is allocated in the triangle index array to store the corresponding triangle index data for each vertex. This triangle index data contains the index value of the triangle vertex corresponding to the vertex.
[0068] S104: Determine whether the current triangular primitive needs to be refined;
[0069] In the method provided by this invention, it can be determined whether the current triangular primitive needs refinement based on the current rendering model, that is, whether vertices need to be added to the primitive structure of the current triangular primitive to refine the detailed mesh of the triangular primitive. Specifically, the need for refinement can be determined by the change in the visible range caused by the camera's perspective. For example, when the camera is close to the model, the smaller the visible range, the fewer triangular primitives need to be rendered, and correspondingly, the more details need to be displayed. Therefore, the triangular primitives need to be refined in this case.
[0070] S105: If the current triangular primitive needs to be refined, then based on the preset binary triangular subdivision strategy, the current triangular primitive is subdivided into triangles to obtain the new vertices corresponding to the current triangular primitive.
[0071] In the method provided by this embodiment of the invention, if the current triangular primitive needs to be refined, a vertices are added to the current triangular primitive based on a binary triangular decomposition strategy to further subdivide the current triangular primitive into triangular meshes. The newly added vertices are then used as the new vertices corresponding to the triangular primitive.
[0072] It should be noted that in the specific implementation process, the number of newly added vertices can be multiple or only one, depending on the specific splitting strategy of the detailed requirement configuration. This does not affect the implementation function of the method provided in the embodiment of the present invention. When there are multiple newly added vertices corresponding to the triangular primitive, each newly added vertex can be processed subsequently.
[0073] S106: Update the binary tree linked list based on the newly added vertex to obtain the updated binary tree linked list, and render the current triangular primitive according to the updated binary tree linked list;
[0074] In the method provided by this invention, based on the association relationship of the newly added vertex in the binary triangulation tree corresponding to the triangular primitive, the relevant information of the newly added vertex is added to the binary tree linked list. This newly added vertex is then used as a refined vertex of the triangular primitive to update the binary tree linked list, resulting in an updated binary tree linked list. Subsequently, the current triangular primitive is rendered based on the vertex-related information recorded in the binary tree linked list. Specifically, displacement mapping or normal mapping can be used to render the triangular primitive.
[0075] S107: Determine whether to continue rendering triangular primitives;
[0076] In the method provided by this embodiment of the invention, after completing the rendering process of the current triangular primitive, it can be determined whether to continue rendering the triangular primitive. If there are still unrendered triangular primitives among the triangular primitives corresponding to the three-dimensional primitive, then the unrendered triangular primitives are rendered, and the process proceeds to step S102. If all the triangular primitives corresponding to the three-dimensional primitive have been rendered, the process proceeds to step S108.
[0077] S108: Complete the rendering process of the three-dimensional primitives.
[0078] In the method provided by the embodiments of the present invention, based on the process of steps S103 to S106, the rendering of the current triangular primitive can be realized, and then the rendering process of each triangular primitive corresponding to the three-dimensional primitive can be realized. After the rendering process of each triangular primitive is completed, the rendering process of the three-dimensional primitive ends.
[0079] Based on the method provided in this embodiment of the invention, when it is necessary to render a 3D primitive, multiple triangular primitives corresponding to the 3D primitive can be determined; each triangular primitive is rendered sequentially; during the rendering process of each triangular primitive, a binary tree linked list corresponding to the current triangular primitive is determined, which includes a vertex array for recording vertex information and a triangle index array for recording triangle index data of the vertices; it is determined whether the current triangular primitive needs to be refined; if so, the current triangular primitive is subdivided into triangles based on a preset binary triangular splitting strategy to obtain new vertices corresponding to the current triangular primitive; the binary tree linked list is updated based on the new vertices to obtain an updated binary tree linked list, and the current triangular primitive is rendered according to the updated binary tree linked list, thereby rendering the 3D primitive. Applying the method provided in this embodiment of the invention, under the refinement method based on binary triangulation, the vertex information of triangular primitives is managed through a binary tree linked list. When it is necessary to refine the triangular primitives to achieve rendering at a certain level of detail, the relevant vertex information of the triangular primitives can be quickly updated by modifying the binary tree linked list. Then, the triangular primitives are rendered according to the updated relevant vertex information to achieve the rendering effect of the target level of detail. In this process, there is no need to store the models of each level of detail for switching the rendering level of detail, which can save a lot of storage space. Secondly, the linked list operation has a fast processing speed and can quickly update the vertices in the primitive structure, which can improve rendering efficiency.
[0080] To better illustrate the method provided in the embodiments of the present invention, the binary triangular splitting strategy mentioned in the embodiments of the present invention will be briefly described below.
[0081] Figure 2 This illustrates a primitive structure for triangular primitives, such as... Figure 2 As shown, triangle V1V2V3 is a basic triangular primitive.
[0082] In the method provided by this invention, triangle V1V2V3 can be recursively split infinitely using the linear difference equation of triangle V1V2V3. Specifically, in a basic triangular primitive, a vertex is added, splitting it into two triangular structures. For each split triangular structure, a vertex is added, splitting it into two triangular structures, and so on, splitting the newly split triangular structures to achieve refinement of the triangular primitive. Figure 2 As shown, triangle V1V2V3 can be divided into triangle V1AV3 and triangle V3AV2 from vertex A. Furthermore, triangle V1AV3 can be divided into triangle V1AB and triangle BAV3 from vertex B. Similarly, vertices C, D, and E can be further divided into triangles based on the previously derived triangles. The division of each vertex can be simplified as follows:
[0083] A = (V1 + V2) * 0.5 (Formula 1)
[0084] B = (V3 + V1) * 0.5 (Formula 2)
[0085] C = (A + V1) * 0.5 (Formula 3)
[0086] D = (V1 + B) * 0.5 (Formula 4)
[0087] E = (A + B) * 0.5 (Formula 5)
[0088] It can be seen that vertices A and B both depend on the basic vertices V1, V2 and V3 of the triangular primitives, while vertices C, D and E all depend on the influence of vertices A and B. That is, in the process of splitting, the newly added vertex depends on the vertex added in the previous split, and each time two triangles are split, they can be associated with the currently added vertex.
[0089] It should be noted that, Figure 2 The structure shown is merely a simplified schematic diagram provided to better illustrate the method provided in the embodiments of the present invention, and does not limit the primitive structure of triangular primitives in actual applications. Furthermore, Figure 2 The complete primitive structure is not shown. Figure 2 The diagram only shows the structure of further subdividing one of the triangles after splitting it from vertex A. A similar triangle splitting can be performed on triangle V3AV2, which is split from vertex A.
[0090] based on Figure 2 The splitting structure shown can be recorded using a binary triangular tree to record the relationships between the vertices used to refine the triangles. Vertices V1, V2, and V3 are the basic vertices of the triangular primitive. The triangular primitive is initially split by connecting vertex A and vertex V3. Therefore, the newly added vertex A can be a child node of vertex V3, vertex B is a child node of vertex A, and the vertex used to split triangle V3AV2 is also a child node of vertex A, vertex C is a child node of vertex B, the vertex used to split triangle V3BA is also a child node of vertex B, vertices D and E are children nodes of vertex C, and so on. The binary triangular tree can describe the relationships between the vertices of the triangular primitive. Based on the triangular primitive, the binary triangular tree structure can store the information of each node in the tree using a corresponding binary tree linked list; that is, the information of related vertices is stored in a binary tree linked list.
[0091] Furthermore, in Figure 1Based on the method shown, this embodiment of the invention provides another method for rendering 3D primitives. In the method provided by this embodiment, the process of determining the binary tree linked list corresponding to the current triangular primitive mentioned in step S103 includes:
[0092] Determine whether a target binary tree list exists in a plurality of pre-stored preset binary tree lists, wherein the target binary tree list is a preset binary tree list associated with the current triangular primitive;
[0093] In the method provided by this invention, when a basic triangular primitive is refined, its corresponding binary tree linked list is created. The created binary tree linked list is stored for subsequent refinement or coarsening rendering processes to manage the addition and deletion of vertices. Therefore, multiple preset binary tree linked lists, which are previously created binary tree linked lists, are pre-stored in preset storage locations.
[0094] In the method provided by this embodiment of the invention, it is possible to search for the existence of a pre-stored binary tree linked list associated with the current triangular primitive, i.e., the target binary tree linked list, among multiple pre-stored preset binary tree linked lists. In other words, it determines whether a binary tree linked list has already been created for the current triangular primitive.
[0095] If the target binary tree list does not exist in any of the multiple preset binary tree lists, a new binary tree list is created, and the newly created binary tree list is used as the binary tree list corresponding to the current triangular primitive.
[0096] In the method provided by this embodiment of the invention, if there is no binary tree linked list associated with the triangular primitive, that is, the triangular primitive has not been refined and has no expanded vertices, then a new binary tree linked list is created with the base vertex of the current triangular primitive as the head node to store the vertex-related information of the triangular primitive, and the newly created binary tree linked list is used as the binary tree linked list corresponding to the current triangular primitive.
[0097] Based on the methods provided in the above embodiments, the methods provided in the embodiments of the present invention further include:
[0098] If the target binary tree list exists in the plurality of preset binary tree lists, then the target binary tree list is used as the binary tree list corresponding to the current triangular primitive.
[0099] In the method provided by the embodiments of the present invention, if a target binary tree list exists in each of the pre-stored preset binary tree lists, that is, the preset binary tree list associated with the current triangular primitive, then the target binary tree list is used as the binary tree list corresponding to the current triangular primitive.
[0100] exist Figure 1Based on the method shown, the method provided in this embodiment of the invention, the process of updating the binary tree linked list based on the newly added vertex mentioned in step S106, includes:
[0101] Determine the vertex information corresponding to the newly added vertex, and add the vertex information corresponding to the newly added vertex to the vertex array;
[0102] In the method provided by this invention, the vertex information of a newly added vertex can be determined based on the triangular subdivision results of the triangular primitives. The vertex information can be the identifier, coordinate value, or index value of the newly added vertex. In the vertex array, the vertex information corresponding to the newly added vertex is added to the branches of the vertices associated with it.
[0103] Determine the triangle index data corresponding to the newly added vertex;
[0104] In the method provided by this embodiment of the invention, the triangle index data corresponding to the newly added vertex is determined based on the index value of the vertex of the triangle associated with the newly added vertex in the triangular primitive. The triangle index data corresponding to the newly added vertex includes an index array of the two triangles corresponding to the newly added vertex.
[0105] The triangle index data corresponding to the newly added vertex is added to the triangle index array, and the association between the vertex information corresponding to the newly added vertex and the triangle index data corresponding to the newly added vertex is established to update the binary tree linked list.
[0106] In the method provided by this embodiment of the invention, the triangle index data of the newly added vertex is added to the triangle index array, and the vertex information of the newly added vertex in the vertex array is associated with the triangle index data of the newly added vertex in the triangle index array to complete the update of the binary tree linked list.
[0107] To better illustrate the method provided in the embodiments of the present invention, the data records of the binary tree linked list will be briefly described below.
[0108] In the method provided by this invention, a binary triangulation tree is recorded for each vertex of a triangular primitive. Each node (i.e., a vertex of the triangular primitive) corresponds to a certain space in the vertex array and triangle index array of the binary tree linked list. In the binary tree linked list, the information in the vertex array corresponds to the information in the triangle index array; specifically, the association can be established using the array index of the vertex. For example… Figure 2In the structure shown, vertex A has an array index of 100, while V1, V2, and V3 have array indices of 0, 1, and 2, respectively. The index array relationship of one triangle split from vertex A is (A, V1, V3), with corresponding index values of (100, 0, 2), and the index array relationship of another triangle is (A, V2, V3), with corresponding index values of (100, 1, 2). The triangle index data corresponding to vertex A contains these two sets of index values.
[0109] When adding a vertex to a binary tree linked list, a branch needs to be added to the parent vertex of the new vertex to record the new vertex. For example... Figure 2 The structure shown illustrates that, for example, when adding vertex C, a branch needs to be established after vertex B to record the information of vertex C. In the next level of subdivision, a branch is established after vertex C to record the data of vertex D and vertex E respectively.
[0110] In the method provided by this invention, vertex information and index information are separated. All information related to primitive vertices is stored in an array. This static array can be expanded into a dynamic array. If a new vertex is added, the vertex count `num` is incremented by 1, the vertex information is added to the end of the vertex array, and a memory block is allocated in the binary tree linked list to store the vertex array index. The index is also stored in array form. For the triangle index array, the static array is similarly converted to a dynamic array, and the index values are added to the array. For example, if vertex A is added, the index values of triangle indices (A, V1, V3) and (A, V2, V3) are stored in the triangle index array. Adding a new vertex expands the triangle index array by 6 positions. When deleting a vertex, if the currently deleted vertex has subordinate vertices that depend on it, these subordinate vertices also need to be deleted. The data for these vertices needs to be deleted from both the vertex array and the triangle index array. Furthermore, since the index may change after a vertex is deleted, the affected indexes need to be modified. For example, if a node (i.e. a vertex) is deleted, then find all vertices whose index value is greater than the deleted vertex, and subtract 1 from the index value of these vertices (assuming the index value increases in the order of the nodes in the binary triangular tree).
[0111] Furthermore, based on the methods provided in the above embodiments, the methods provided in the embodiments of the present invention further include:
[0112] If the current triangular primitive does not need to be refined, then determine whether the current triangular primitive needs to be coarsened.
[0113] In the method provided by the embodiments of the present invention, if the current triangular primitive does not need to be thinned, it is determined whether the triangular primitive needs to be coarsened, that is, whether the triangular primitive needs to have its vertices deleted.
[0114] If the current triangular primitive needs to be coarsened, then the current triangular primitive is subjected to vertex deletion, and the deleted vertex is taken as the target vertex.
[0115] In the method provided by this invention, if it is necessary to coarsen triangular primitives, the vertices that need to be deleted are determined in the primitive structure of the current triangular primitives. Specifically, based on the requirements of coarsening rendering, the current refinement level to be retained can be determined, and vertices outside this refinement level are deleted. In the specific implementation process, there can be multiple target vertices or only one. For example, it is possible to specify the deletion of the last vertex, then the vertex to be deleted is the target vertex. It is also possible to specify the deletion of vertices that are not the last vertex. When the vertex to be deleted is not the last vertex, the vertex to be deleted is the target vertex, and all its associated subordinate vertices are also target vertices, for example... Figure 2 As shown in the structure, when vertex B is specified for deletion, its associated vertices C, D, and E also need to be deleted. When there are multiple target vertices, subsequent operations can be performed for each target vertex.
[0116] Based on the target vertex, data is deleted from the binary tree linked list to obtain a binary tree linked list with data deletion, and the current triangular primitive is rendered based on the binary tree linked list with data deletion.
[0117] In the method provided by this invention, corresponding to deleting the node of the target vertex in the binary triangular tree, the relevant data of the target vertex is also deleted in the binary tree linked list, thus obtaining a binary tree linked list after data deletion. The triangular primitives can then be rendered based on this binary tree linked list. It can be understood that when a triangular primitive needs to be coarsened, it means that the triangular primitive can be coarsened, that is, there are expanded vertices in the triangular primitive, and its corresponding binary tree linked list also records the expanded vertices that can be deleted.
[0118] Based on the methods provided in the above embodiments, the method provided in this embodiment of the invention includes the process of deleting data from the binary tree linked list based on the target vertex, comprising:
[0119] Determine the vertex information corresponding to the target vertex in the vertex array;
[0120] Determine the triangle index data corresponding to the target vertex in the triangle index array;
[0121] Delete the vertex information corresponding to the target vertex in the vertex array, and delete the triangle index data corresponding to the target vertex in the triangle index array;
[0122] Among the vertices of the current triangular primitive, determine the index-associated vertex corresponding to the target vertex, wherein the index value of the index-associated vertex is greater than the index value of the target vertex;
[0123] In the triangle index array, determine the target index values corresponding to the index-associated vertices, and modify the target index values to delete data from the binary tree linked list.
[0124] In the method provided by this invention, the vertex array records the vertex information of each vertex of the triangular primitive. The vertex information corresponding to the target vertex can be determined from the vertex array, and the triangle index data corresponding to the target vertex can be determined from the triangle index array. This data is then deleted. Since the deletion of a vertex may cause changes to the indices of other vertices, it is necessary to select vertices whose index values are affected by the target vertex as index-associated nodes.
[0125] The vertices whose index values are affected by the target vertex refer to those with index values greater than the target vertex. This is because after the target vertex is deleted, its index value needs to be allocated to the next vertex with a different index. Therefore, the index values of vertices following the target vertex need to be modified. The target index value is obtained by using the index value of the vertex associated with the corresponding index recorded in the triangle index array, and modifying each target index value, such as by subtracting one from the target index value to obtain the new index value. Optionally, if the vertex array also records vertex index values, then the corresponding index values of the vertices associated with the target vertex also need to be modified in the vertex array.
[0126] It should be noted that in the actual implementation, the number of indexed associated nodes can be only one, multiple, or none at all. When there are no indexed associated nodes, the index value is not modified. If there are multiple indexed associated nodes, then for each indexed associated node, the corresponding index value is modified in the binary tree linked list.
[0127] To better illustrate the method provided in the embodiments of the present invention, Figure 1 Based on the method shown, the method provided in this embodiment of the invention, the process of rendering the current triangular primitive based on the updated binary tree linked list mentioned in step S106, includes:
[0128] Configure the vertex index buffer according to the updated binary tree linked list, and render the current triangular primitives according to the vertex index buffer.
[0129] In the method provided by this embodiment of the invention, a vertex index buffer is configured according to the vertex information recorded in the updated binary tree linked list. That is, the vertex information of each vertex and the corresponding triangle index data are added to the vertex index buffer so that the rendering engine can render the current triangular primitives based on the data in the vertex index buffer.
[0130] In the method provided by the embodiments of the present invention, the process of rendering the current triangular primitive based on the binary tree linked list after data deletion mentioned in the above embodiments is the same as the rendering process mentioned in step S106, which can be referred to the above description and will not be repeated here.
[0131] To better illustrate the method provided in the embodiments of the present invention, in conjunction with... Figure 3 The example diagram illustrates yet another method for rendering three-dimensional primitives provided by this embodiment of the invention. Figure 3 As shown, the rendering process of three-dimensional primitives provided in this embodiment of the invention includes:
[0132] S201: Basic 3D Primitive Rendering;
[0133] S202: Render a single triangular primitive in a 3D primitive;
[0134] S203: Determine whether the triangular primitive needs to be binary split; if the triangular primitive needs to be binary split, proceed to step S204; otherwise, proceed to step S212.
[0135] S204: Determine whether the triangular primitive is being split for the first time; if the triangular primitive is being split for the first time, proceed to step S205; otherwise, proceed to step S206.
[0136] S205: Create the head node of a binary tree linked list; that is, create a new binary tree linked list, and create the head node based on the basic vertex of the triangular primitive.
[0137] S206: Add a node to an existing binary tree linked list;
[0138] S207: Add the vertex corresponding to the node to the end of the rendering vertex array (equivalent to the vertex array mentioned in the above embodiments), and associate the vertex index with the node;
[0139] S208: Add the associated index to the rendering index array (equivalent to the triangle index array mentioned in the above embodiments) and associate the vertex index with the node;
[0140] S209: Complete the operation of the vertex index buffer;
[0141] S210: Render triangular primitives;
[0142] S211: Determine whether to continue rendering; if rendering needs to continue, determine the next triangular primitive to be rendered, return to step S202, and render the next triangular primitive; if rendering does not need to continue, end the rendering process of the 3D primitive.
[0143] S212: Determine whether it is necessary to delete the vertices split from the triangular primitive; if it is necessary to delete the split vertices, proceed to step S213; otherwise, proceed to step S210.
[0144] S213: Delete the node corresponding to the specified vertex in the binary tree linked list;
[0145] S214: Find the vertex index of the node and delete it from the rendered vertex array;
[0146] S215: Find the index of the node and delete all associated indices in the rendered index array;
[0147] S216: Recursively check if there are any nodes under the node to be deleted. If there are any nodes under the deleted node, delete that node and return to step S213 to continue deleting that node. If there are no nodes to be deleted, proceed to step S209.
[0148] Based on the method provided in this invention, the vertices expanded during the refinement of triangular primitives are managed through a binary tree linked list. By maintaining the binary tree linked list, the changes in the 3D primitive model from low-poly (the model is composed of triangular primitives with basic triangular structures and few vertices) to high-poly (the model is composed of refined triangular primitives with a large number of detailed vertices) or from high-poly to low-poly can be managed. The process of adding and deleting vertices is very convenient and fast, which can improve rendering efficiency and quickly change the rendering quality.
[0149] To better illustrate the method provided in the embodiments of the present invention, the following is a brief overall description of the actual application process of the three-dimensional primitive rendering method provided in the embodiments of the present invention.
[0150] During the rendering of primitives, when the camera approaches the model, the focal point of the camera's ray intersects on a triangular facet of the model (i.e., a triangular primitive). Because the camera's structure is similar to that of the human eye, its visible range is limited. The radius of the camera's visible range can be calculated using the following formula:
[0151] radius=tan(angle)*distance;
[0152] Where angle is the camera's field of view, and distance is the distance between the camera's ray and the triangular face.
[0153] Then, based on the intersection point v of the camera ray and the triangle face and the radius radius, all triangle faces within the visible range can be traversed. By traversing the vertex array, the vertices of the triangle faces can be determined. By changing the camera's perspective, it can be determined whether the triangle faces within the visible range need to be refined or coarsened. For example, the closer the camera is to the model, the smaller the visible range, the fewer triangle faces need to be rendered, and the more details need to be displayed on a single triangle face.
[0154] When the distance between the camera and the model changes, it can be considered that the rendering detail level changes. The triangular primitives that need to be rendered need to be either refined or coarsened, which in turn requires reconstructing the corresponding binary triangulation tree. Based on the camera's viewpoint, by traversing the vertex array, the indices and subscripts of all vertices of all triangular primitives within the camera's visible range can be obtained. Based on the existing vertices and indices, the corresponding binary triangulation tree of the triangular primitives can be reconstructed (e.g., by quickly splitting the root node and child nodes for refinement, or by deleting nodes for coarsening). The corresponding vertices are managed on the binary tree linked list, which enables the mapping between the vertex array, the index array, and the binary triangulation tree.
[0155] The method provided in this invention is a dynamic AutoLOD rendering scheme. It dynamically constructs a binary triangular tree of triangular primitives during the rendering process to reconstruct the vertex structure of triangular primitives at different levels of detail. Unlike traditional LOD algorithms, it eliminates the need to hierarchically split and store the entire model in memory during model loading, which consumes a large amount of memory. The method provided in this invention reduces memory consumption and enables rapid addition and deletion of vertices, quickly mapping them to vertex arrays and index arrays available for rendering, thus improving rendering performance.
[0156] and Figure 1 Corresponding to the 3D primitive rendering method shown, this embodiment of the invention also provides a 3D primitive rendering apparatus for rendering primitives. Figure 1 The specific implementation of the method shown is illustrated in the following diagram. Figure 4 As shown, it includes:
[0157] The determining unit 301 is used to determine multiple triangular primitives corresponding to the three-dimensional primitives when it is necessary to render the three-dimensional primitives;
[0158] The rendering unit 302 is used to render each of the triangular primitives in sequence to render the three-dimensional primitives;
[0159] The rendering unit 302 includes:
[0160] The first determining subunit 303 is used to determine the binary tree linked list corresponding to the current triangular primitive, wherein the binary tree linked list contains a vertex array and a triangle index array;
[0161] The first judgment subunit 304 is used to determine whether the current triangular primitive needs to be refined.
[0162] Subdivision subunit 305 is used to subdivide the current triangular primitive into triangles based on a preset binary triangular splitting strategy if the current triangular primitive needs to be refined, so as to obtain the new vertex corresponding to the current triangular primitive.
[0163] The first rendering subunit 306 is used to update the binary tree linked list based on the newly added vertex, obtain the updated binary tree linked list, and render the current triangular primitives according to the updated binary tree linked list.
[0164] Based on the apparatus provided in this embodiment of the invention, when it is necessary to render a 3D primitive, multiple triangular primitives corresponding to the 3D primitive can be determined; each triangular primitive is rendered sequentially; during the rendering process of each triangular primitive, a binary tree linked list corresponding to the current triangular primitive is determined, which includes a vertex array for recording vertex information and a triangle index array for recording triangle index data of the vertices; it is determined whether the current triangular primitive needs to be refined; if so, the current triangular primitive is subdivided into triangles based on a preset binary triangular splitting strategy to obtain new vertices corresponding to the current triangular primitive; the binary tree linked list is updated based on the new vertices to obtain an updated binary tree linked list, and the current triangular primitive is rendered according to the updated binary tree linked list, thereby rendering the 3D primitive. The apparatus provided in this invention, based on a binary triangulation-based refinement method, manages the vertex information of triangular primitives using a binary tree linked list. When refinement of the triangular primitives is required to achieve a specific level of detail in rendering, the relevant vertex information of the triangular primitives can be quickly updated by modifying the binary tree linked list. The triangular primitives are then rendered according to the updated vertex information, achieving the desired level of detail. During this process, there is no need to store individual detail level models for switching rendering levels, saving significant storage space. Furthermore, the linked list operation is fast, allowing for rapid updates of vertices in the primitive structure, thus improving rendering efficiency.
[0165] Based on the apparatus provided in the above embodiments, in the apparatus provided in the embodiments of the present invention, the first determining subunit 303 includes:
[0166] The second judgment subunit is used to determine whether a target binary tree list exists in a plurality of pre-stored preset binary tree lists, wherein the target binary tree list is a preset binary tree list associated with the current triangular primitive.
[0167] A new subunit is created to create a new binary tree list if the target binary tree list does not exist in the plurality of preset binary tree lists, and the newly created binary tree list is used as the binary tree list corresponding to the current triangular primitive.
[0168] Based on the apparatus provided in the above embodiments, the apparatus provided in the embodiments of the present invention further includes:
[0169] The second determining subunit is used to use the target binary tree list as the binary tree list corresponding to the current triangular primitive if the target binary tree list exists in the plurality of preset binary tree lists.
[0170] Based on the apparatus provided in the above embodiments, in the apparatus provided in the embodiments of the present invention, the first rendering subunit 306 includes:
[0171] The third determining subunit is used to determine the vertex information corresponding to the newly added vertex and add the vertex information corresponding to the newly added vertex to the vertex array; and determine the triangle index data corresponding to the newly added vertex.
[0172] A sub-unit is added to add the triangle index data corresponding to the newly added vertex to the triangle index array and establish the association between the vertex information corresponding to the newly added vertex and the triangle index data corresponding to the newly added vertex, so as to update the binary tree linked list.
[0173] exist Figure 4 Based on the device shown, this embodiment of the invention provides another three-dimensional primitive rendering device, the structural schematic of which is shown below. Figure 5 As shown, in the apparatus provided in this embodiment of the invention, the rendering unit 302 further includes:
[0174] The third judgment subunit 307 is used to determine whether the current triangular primitive needs to be coarsened if the current triangular primitive does not need to be refined.
[0175] The fourth determining subunit 308 is used to perform vertex deletion processing on the current triangular primitive if the current triangular primitive needs to be coarsened, and to take the deleted vertex as the target vertex.
[0176] The second rendering subunit 309 is used to delete data from the binary tree linked list based on the target vertex, obtain a binary tree linked list after data deletion, and render the current triangular primitive based on the binary tree linked list after data deletion.
[0177] Based on the apparatus provided in the above embodiments, in the apparatus provided in the embodiments of the present invention, the second rendering subunit 309 includes:
[0178] The fifth determining subunit is used to determine the vertex information corresponding to the target vertex in the vertex array; and to determine the triangle index data corresponding to the target vertex in the triangle index array.
[0179] The deletion sub-unit is used to delete the vertex information corresponding to the target vertex in the vertex array and delete the triangle index data corresponding to the target vertex in the triangle index array;
[0180] The sixth determining subunit is used to determine, among the vertices of the current triangular primitive, the index associated vertex corresponding to the target vertex, wherein the index value of the index associated vertex is greater than the index value of the target vertex;
[0181] The modification sub-unit is used to determine each target index value corresponding to the index-associated vertex in the triangle index array, and modify each target index value to delete data from the binary tree linked list.
[0182] Based on the apparatus provided in the above embodiments, in the apparatus provided in the embodiments of the present invention, the first rendering subunit 306 includes:
[0183] The configuration subunit is used to configure the vertex index buffer according to the updated binary tree linked list, and to render the current triangular primitives according to the vertex index buffer.
[0184] This invention also provides a storage medium, which includes stored instructions, wherein the execution of the instructions controls the device where the storage medium is located to execute the above-described three-dimensional primitive rendering method.
[0185] This invention also provides an electronic device, the structural schematic of which is shown below. Figure 6 As shown, it specifically includes a memory 401 and one or more instructions 402, wherein one or more instructions 402 are stored in the memory 401 and configured to be executed by one or more processors 403 to perform the following operations:
[0186] When it is necessary to render a 3D primitive, determine multiple triangular primitives corresponding to the 3D primitive;
[0187] Each of the triangular primitives is rendered sequentially to render the three-dimensional primitive;
[0188] The rendering process for each of the aforementioned triangular primitives includes:
[0189] Determine the binary tree linked list corresponding to the current triangular primitive, wherein the binary tree linked list contains a vertex array and a triangle index array;
[0190] Determine whether the current triangular primitive needs to be refined;
[0191] If the current triangular primitive needs to be refined, then based on the preset binary triangular subdivision strategy, the current triangular primitive is subdivided into triangles to obtain the new vertices corresponding to the current triangular primitive.
[0192] The binary tree linked list is updated based on the newly added vertex to obtain the updated binary tree linked list, and the current triangular primitive is rendered based on the updated binary tree linked list.
[0193] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0194] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0195] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for rendering three-dimensional primitives, characterized in that, include: When it is necessary to render a 3D primitive, determine multiple triangular primitives corresponding to the 3D primitive; Each of the triangular primitives is rendered sequentially to render the three-dimensional primitive; The rendering process for each of the aforementioned triangular primitives includes: Determine the binary tree linked list corresponding to the current triangular primitive. The binary tree linked list contains a vertex array and a triangle index array. Each current triangular primitive corresponds to a binary tree linked list. The binary tree linked list is configured based on the basic triangle structure of the current triangular primitive without refinement and contains only the information of the head node established with the basic vertices of the current triangular primitive. Determine whether the current triangular primitive needs to be refined; If the current triangular primitive needs to be refined, then based on the preset binary triangular subdivision strategy, the current triangular primitive is subdivided into triangles to obtain the new vertices corresponding to the current triangular primitive; wherein, each new vertex splits the corresponding triangular primitive into two smaller triangular primitives. The binary tree linked list is updated based on the newly added vertex to obtain the updated binary tree linked list, and the current triangular primitive is rendered based on the updated binary tree linked list. The step of updating the binary tree linked list based on the newly added vertex includes: Determine the vertex information corresponding to the newly added vertex, and add the vertex information corresponding to the newly added vertex to the vertex array; Determine the triangle index data corresponding to the newly added vertex; Add the triangle index data corresponding to the newly added vertex to the triangle index array, and establish the association between the vertex information corresponding to the newly added vertex and the triangle index data corresponding to the newly added vertex, so as to update the binary tree linked list; The step of rendering the current triangular primitive based on the updated binary tree linked list includes: Configure the vertex index buffer according to the updated binary tree linked list, and render the current triangular primitives according to the vertex index buffer.
2. The method according to claim 1, characterized in that, The step of determining the binary tree linked list corresponding to the current triangular primitive includes: Determine whether a target binary tree list exists in a plurality of pre-stored preset binary tree lists, wherein the target binary tree list is a preset binary tree list associated with the current triangular primitive; If the target binary tree list does not exist in any of the multiple preset binary tree lists, a new binary tree list is created, and the newly created binary tree list is used as the binary tree list corresponding to the current triangular primitive.
3. The method according to claim 2, characterized in that, Also includes: If the target binary tree list exists in the plurality of preset binary tree lists, then the target binary tree list is used as the binary tree list corresponding to the current triangular primitive.
4. The method according to claim 1, characterized in that, Also includes: If the current triangular primitive does not need to be refined, then determine whether the current triangular primitive needs to be coarsened. If the current triangular primitive needs to be coarsened, then the current triangular primitive is subjected to vertex deletion, and the deleted vertex is taken as the target vertex. Based on the target vertex, data is deleted from the binary tree linked list to obtain a binary tree linked list with data deletion, and the current triangular primitive is rendered based on the binary tree linked list with data deletion.
5. The method according to claim 4, characterized in that, The data deletion of the binary tree linked list based on the target vertex includes: Determine the vertex information corresponding to the target vertex in the vertex array; Determine the triangle index data corresponding to the target vertex in the triangle index array; Delete the vertex information corresponding to the target vertex in the vertex array, and delete the triangle index data corresponding to the target vertex in the triangle index array; Among the vertices of the current triangular primitive, determine the index-associated vertex corresponding to the target vertex, wherein the index value of the index-associated vertex is greater than the index value of the target vertex; In the triangle index array, determine the target index values corresponding to the index-associated vertices, and modify the target index values to delete data from the binary tree linked list.
6. A three-dimensional primitive rendering device, characterized in that, include: The determining unit is used to determine multiple triangular primitives corresponding to the three-dimensional primitives when rendering of the three-dimensional primitives is required; A rendering unit is used to render each of the triangular primitives in sequence to render the three-dimensional primitives; The rendering unit includes: The first determining subunit is used to determine the binary tree linked list corresponding to the current triangular primitive. The binary tree linked list contains a vertex array and a triangle index array. Each current triangular primitive corresponds to a binary tree linked list. The binary tree linked list is configured based on the unrefined basic triangle structure of the current triangular primitive and only contains the information of the head node established with the basic vertices of the current triangular primitive. The first judgment subunit is used to determine whether the current triangular primitive needs to be refined. The subdivision subunit is used to subdivide the current triangular primitive into triangles based on a preset binary triangular splitting strategy if the current triangular primitive needs to be refined, thereby obtaining the new vertex corresponding to the current triangular primitive; wherein each new vertex splits the corresponding triangular primitive into two smaller triangular primitives. The first rendering subunit is used to update the binary tree linked list based on the newly added vertex, obtain the updated binary tree linked list, and render the current triangular primitive according to the updated binary tree linked list. The step of updating the binary tree linked list based on the newly added vertex includes: Determine the vertex information corresponding to the newly added vertex, and add the vertex information corresponding to the newly added vertex to the vertex array; Determine the triangle index data corresponding to the newly added vertex; Add the triangle index data corresponding to the newly added vertex to the triangle index array, and establish the association between the vertex information corresponding to the newly added vertex and the triangle index data corresponding to the newly added vertex, so as to update the binary tree linked list; The step of rendering the current triangular primitive based on the updated binary tree linked list includes: Configure the vertex index buffer according to the updated binary tree linked list, and render the current triangular primitives according to the vertex index buffer.
7. A storage medium, characterized in that, The storage medium includes stored instructions, wherein when the instructions are executed, the device containing the storage medium is controlled to perform the three-dimensional primitive rendering method as described in any one of claims 1 to 5.
8. An electronic device, characterized in that, It includes a memory, and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors as described in any one of claims 1 to 5.