Vertex index value updating method and device, electronic equipment and storage medium

CN115546454BActive Publication Date: 2026-10-09NEUSOFT CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211125069.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-15
Publication Date
2026-10-09
Estimated Expiration
2042-09-15

AI Technical Summary

Technical Problem

而复杂的三维模型在其处理过程中会消耗大量的系统资源,而在三维模型的实际应用过程中,通常对模型处理速度有一定要求,因此需要对三维模型进行简化处理,而现有的网格简化算法虽然能对三维模型的网格进行简化,但是网格化简后,三维模型中的顶点数量未变,存在大量网格简化后无意义的顶点,这些无意义的顶点可能会对顶点索引值更新产生影响,影响三维模型处理速度

Benefits of technology

[0037]In the above technical solution, a label vector is generated based on the coordinates of each vertex in the vertex set. This label vector includes the label elements of each vertex. A plane vector is generated based on each plane in the face set. This plane vector includes the vertex index values ​​of each vertex. Then, the position masks of each vertex in the plane vector are obtained to obtain a position mask matrix, which includes the position masks of each vertex. For each target vertex, the number of vertices with zero label elements among the vertices preceding the target vertex in the plane vector is used as an update element. The target vertex is defined as a vertex with non-zero label elements. Finally, the update index values ​​of each target vertex are updated based on the corresponding position masks in the position mask matrix, the plane vector, and the update elements of each target vertex. This technical solution updates the index values ​​of vertices with non-zero label elements in the 3D model based on the number of vertices with zero label elements, avoiding the influence of meaningless vertices on vertex index value updates. This improves the speed of vertex index value updates and, to some extent, increases the processing speed of the 3D model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115546454B_ABST
    Figure CN115546454B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a vertex index value updating method and device, electronic equipment and storage medium, and relates to the technical field of three-dimensional graphics. The method comprises: generating a label vector according to the coordinates of each vertex in a vertex set, and generating a plane vector according to each plane in a plane set; then obtaining a position mask matrix by obtaining the position mask of each vertex in the plane vector, the position mask matrix comprising the position mask of each vertex; and for each target vertex in each vertex, obtaining the number of vertices with a label element of zero among the vertices before the target vertex in the plane vector as an update element; and updating the update index value of each target vertex according to the corresponding position mask of each target vertex in the position mask matrix, the plane vector and the update element of each target vertex. The influence of meaningless vertices can be avoided, the speed of updating the vertex index value is improved, and the processing speed of the three-dimensional model is improved to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of three-dimensional graphics technology, and more specifically, to a method, apparatus, electronic device, and storage medium for updating vertex index values. Background Technology

[0002] With the continuous development of computer technology and the increasing popularity of augmented reality, virtual reality, and mixed reality, the application scope of 3D models is becoming wider and wider, and their structures are becoming more and more complex. Processing complex 3D models consumes a large amount of system resources. In practical applications, there are usually certain requirements for model processing speed, thus necessitating simplification. While existing mesh simplification algorithms can simplify the mesh of 3D models, the number of vertices in the 3D model remains unchanged after mesh simplification, resulting in a large number of meaningless vertices. These meaningless vertices may affect vertex index updates, impacting the processing speed of 3D models. Summary of the Invention

[0003] The purpose of this disclosure is to provide a method, apparatus, electronic device, and storage medium for updating vertex index values.

[0004] To achieve the above objectives, a first aspect of this disclosure provides a method for updating vertex index values, comprising:

[0005] A label vector is generated based on the coordinates of each vertex in the vertex set, and the label vector includes the label elements of each vertex;

[0006] A plane vector is generated based on each plane in the face set, and the plane vector includes the vertex index value of each vertex;

[0007] Obtain the position mask of each vertex in the plane vector to obtain a position mask matrix, wherein the position mask matrix includes the position mask of each vertex;

[0008] For each target vertex among the vertices, obtain the number of vertices in the plane vector that are located before the target vertex and whose label element is zero, and use this number as the update element. The target vertex is the vertex whose label element is not zero.

[0009] The update index value of each target vertex is updated based on the position mask corresponding to each target vertex in the position mask matrix, the plane vector, and the update element of each target vertex.

[0010] Optionally, generating a label vector based on the coordinates of each vertex in the vertex set includes:

[0011] For any vertex among the vertices, when all elements in the coordinates of the vertex are zero, the label element of the vertex is set to zero; when at least one element in the coordinates of the vertex is not zero, the label element of the vertex is set to one, so as to obtain the label element of each vertex.

[0012] The label vector is generated based on the label elements of each vertex.

[0013] Optionally, the step of generating a plane vector based on each plane in the face set, wherein the plane vector includes the vertex index value of each vertex, includes:

[0014] Get the index value of each vertex in each plane of the face set;

[0015] The plane vector is obtained by merging the index values ​​of each vertex of all planes in the face set.

[0016] Optionally, obtaining the position mask of each vertex in the plane vector to obtain the position mask matrix includes:

[0017] For any vertex among the vertices, subtract the current index value of the vertex from each element of the plane vector, and perform a NOT operation on the difference obtained by subtracting the current index value from each element to obtain the position mask vector corresponding to the vertex. The position mask vector includes the position mask of the vertex in the plane vector.

[0018] The position mask matrix is ​​constructed based on the position mask vectors of each vertex.

[0019] Optionally, updating the update index value of each vertex based on the position mask corresponding to each target vertex in the position mask matrix, the plane vector, and the update element of each target vertex includes:

[0020] For any target vertex among the target vertices, the dot product of the position mask vector corresponding to the target vertex in the position mask matrix and the plane vector is performed to obtain the target vector;

[0021] Subtract the updated element of the target vertex from the non-zero elements in the target vector to obtain the updated index value of the target vertex;

[0022] The current index value of the target vertex in the plane vector is updated to the updated index value to obtain the updated plane vector.

[0023] Optionally, the method further includes:

[0024] The vertex index values ​​in the updated plane vector are converted into an updated set of planes according to the plane to which the vertex belongs, and the vertices of each plane in the set of planes have updated vertex index values.

[0025] Optionally, the method further includes:

[0026] Delete vertices from the vertex set whose coordinates are all zero.

[0027] A second aspect of this disclosure provides a means for updating vertex index values, comprising:

[0028] The first generation module is used to generate a label vector based on the coordinates of each vertex in the vertex set, wherein the label vector includes the label elements of each vertex;

[0029] The second generation module is used to generate a plane vector based on each plane in the face set, wherein the plane vector includes the vertex index value of each vertex;

[0030] The first acquisition module is used to acquire the position mask of each vertex in the plane vector to obtain a position mask matrix, wherein the position mask matrix includes the position mask of each vertex;

[0031] The second acquisition module is used to acquire, for each target vertex among the vertices in the plane vector, the number of vertices whose label element is zero among the vertices located before the target vertex, as an update element, wherein the target vertex is a vertex whose label element is not zero;

[0032] The update module is used to update the update index value of each target vertex according to the position mask corresponding to each target vertex in the position mask matrix, the plane vector, and the update element of each target vertex.

[0033] A third aspect of this disclosure provides an electronic device comprising:

[0034] A memory on which computer programs are stored;

[0035] A processor for executing the computer program in the memory to implement the steps of the method for updating vertex index values ​​according to any one of the first aspects.

[0036] A fourth aspect of this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for updating vertex index values ​​according to any one of the first aspects.

[0037] In the above technical solution, a label vector is generated based on the coordinates of each vertex in the vertex set. This label vector includes the label elements of each vertex. A plane vector is generated based on each plane in the face set. This plane vector includes the vertex index values ​​of each vertex. Then, the position masks of each vertex in the plane vector are obtained to obtain a position mask matrix, which includes the position masks of each vertex. For each target vertex, the number of vertices with zero label elements among the vertices preceding the target vertex in the plane vector is used as an update element. The target vertex is defined as a vertex with non-zero label elements. Finally, the update index values ​​of each target vertex are updated based on the corresponding position masks in the position mask matrix, the plane vector, and the update elements of each target vertex. This technical solution updates the index values ​​of vertices with non-zero label elements in the 3D model based on the number of vertices with zero label elements, avoiding the influence of meaningless vertices on vertex index value updates. This improves the speed of vertex index value updates and, to some extent, increases the processing speed of the 3D model.

[0038] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0039] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings:

[0040] Figure 1 This is a flowchart illustrating a vertex index value update method according to an exemplary embodiment of the present disclosure.

[0041] Figure 2 This is a flowchart illustrating another method for updating vertex index values ​​according to an exemplary embodiment of the present disclosure.

[0042] Figure 3 This is a flowchart illustrating another method for updating vertex index values ​​according to an exemplary embodiment of the present disclosure.

[0043] Figure 4 This is a flowchart illustrating another method for updating vertex index values ​​according to an exemplary embodiment of the present disclosure.

[0044] Figure 5 This is a flowchart illustrating yet another method for updating vertex index values ​​according to an exemplary embodiment of the present disclosure.

[0045] Figure 6 This is a block diagram illustrating a vertex index value updating device according to an exemplary embodiment.

[0046] Figure 7 This is a block diagram of an electronic device for updating vertex index values ​​according to an exemplary embodiment.

[0047] Figure 8 This is a block diagram of an electronic device illustrating another method for updating vertex index values ​​according to an exemplary embodiment. Detailed Implementation

[0048] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.

[0049] It is understood that in this disclosure, "multiple" refers to two or more, and other quantifiers are similar. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. The singular forms "a," "," and "the" are also intended to include the plural forms unless the context clearly indicates otherwise.

[0050] It is further understood that although operations are described in a specific order in the accompanying drawings in the embodiments of this disclosure, this should not be construed as requiring these operations to be performed in the specific order or serial order shown, or requiring all of the shown operations to be performed to obtain the desired result. In certain environments, multitasking and parallel processing may be advantageous.

[0051] It should be noted that all actions involving the acquisition of signals, information, or data in this disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the location is situated, and with authorization from the owner of the relevant device.

[0052] To improve the processing speed of 3D models, we need to simplify them. The Quadratic Error Metrics (QEM) edge collapse algorithm is one of the most common algorithms for simplifying 3D models. The core idea of ​​the QEM algorithm is to calculate the cost of each edge on the mesh of the 3D model, place these edges in a min-heap, and in each iteration, remove the edge with the smallest cost from the heap. Then, recalculate the cost of other edges directly connected to the vertex of this edge, and update the min-heap, the vertex (x, y, z) coordinates, and the vertex indices in the face (v1, v2, v3), where v1, v2, and v3 represent the three vertices of the face. This process is repeated until a certain simplification threshold is reached, such as when the number of faces reaches a certain number, thus completing the simplification of the 3D model. Meanwhile, the applicant discovered that during the simplification of the 3D model using the edge collapse algorithm, because the algorithm removes edges from the 3D model in each iteration, the two vertices corresponding to the removed edge are not removed. Of the two vertices on the removed edge, one vertex's coordinates remain unchanged, while the other vertex's coordinates are updated to (0, 0, 0). Therefore, after simplifying the 3D model using the edge collapse algorithm, the number of vertices in the vertex set of the 3D model remains unchanged, and there are a large number of meaningless vertices with coordinates (0, 0, 0), which consume resources to some extent and affect the processing speed of the 3D model. Therefore, to avoid the impact of these meaningless vertices with coordinates (0, 0, 0) on vertex index updates, this solution proposes a vertex index value update method.

[0053] Figure 1 This is a flowchart illustrating a vertex index value update method according to an exemplary embodiment of the present disclosure, such as... Figure 1 As shown, the method for updating the vertex index value may include the following steps.

[0054] In step S101, a label vector is generated based on the coordinates of each vertex in the vertex set. The label vector includes the label elements of each vertex.

[0055] Since there are a large number of vertices in a 3D model, a vertex set is constructed based on all vertices and their coordinates. Label elements are generated based on the coordinates of each vertex, and these label elements are then used to construct a label vector. For example, vertex coordinates are 3D coordinates, which can be represented as (x, y, z). Assuming the vertex set of the 3D model is {(0,1,1),(0,1,2),(0,0,0),(2,0,1),(0,0,0),……}, the vertices whose coordinates are all zero (i.e., the vertices with coordinates (0,0,0)) are labeled with a 0, and the vertices whose coordinates are not all zero are labeled with a 1. Thus, a label vector is generated based on the label elements of each vertex. For example, the label vector corresponding to the vertex set {(0,1,1),(0,1,2),(0,0,0),(2,0,1),(0,0,0),……} is [1,1,0,1,0,……].

[0056] In step S102, a plane vector is generated based on each plane in the face set. The plane vector includes the vertex index value of each vertex.

[0057] A 3D model contains a large number of vertices. Two vertices can form an edge, and three vertices can form a plane. Therefore, a 3D model contains a large number of planes, resulting in a set of faces. This set of faces includes the indices of the vertices that form each plane. For example, the face set {[v... f1 1,v f1 2,v f1 3],[v f2 1,v f2 2,v f2 3],…,[v fn 1,v fn 2,v fn 3]}, where v f1 1,v f1 2,v f1 3,v f2 1,v f2 2,v f2 3,…,v fn 1,v fn 2,v fn 3 represents the vertex index value. The plane vector is obtained by merging the vertex index values ​​from each face set, denoted as [v]. f1 1,v f1 2,v f1 3,v f2 1,v f2 2,vf23,…,v fn 1,v fn 2,vfn [3] It can be understood that the vertex index value of each vertex included in the face set is the vertex index value of all vertices in the vertex set mentioned above.

[0058] In step S103, the position mask of each vertex in the plane vector is obtained to obtain the position mask matrix, which includes the position mask of each vertex.

[0059] Understandably, because there are numerous vertices and planes in a 3D model, and three vertices form a plane, multiple planes may share the same vertex. For example, plane A consists of vertices a, b, and c; plane B consists of vertices a, b, and d; plane C consists of vertices a, c, and d; and plane D consists of vertices b, c, and d. Therefore, the vertex index v mentioned above... f1 1,v f1 2,v f1 3,v f2 1,v f2 2,v f2 3,…,v fn 1,v fn 2,v fn In step 3, multiple identical vertex index values ​​may exist. By calculating the position mask of a vertex in a plane vector, it can be determined whether a vertex exists in a certain plane.

[0060] In step S104, for each target vertex among all vertices, the number of vertices with zero label elements among the vertices located before the target vertex in the plane vector is obtained as the update element, and the target vertex is a vertex with non-zero label elements.

[0061] Understandably, vertices with a label element of zero, i.e., vertices with coordinates (0,0,0), are meaningless vertices. Target vertices are those with a non-zero label element, i.e., vertices whose coordinates are not all zero; these are the vertices whose index values ​​need to be updated. Since there are multiple target vertices among all vertices, we can traverse these multiple vertices. For each target vertex, the update element is the number of vertices with a label element of zero preceding it in the plane vector; this is the number that needs to be updated to the vertex index value of that target vertex. For example, in the aforementioned plane vector, the vertex index value v... f1 3 is the index of the third vertex in the planar vector, assuming v f1 The vertex corresponding to 3 (referred to as vertex v) f1 3) The coordinates are not all 0, v f1 The two vertex indices v before 3 f1 1,v f1 The two vertices corresponding to 2 (referred to as vertices v) f1 1 and vertex vf1 2) If the coordinates of vertex v are (0,0,0), then the vertex v f1 3 is a target vertex, since vertex v f1 Vertex v before 3 f1 1 and vertex v f1 If the coordinates are (0,0,0), then the vertex v can be determined. f1 The update element for 3 is 2. An update element of 2 indicates that this index value update requires changing v. f1 Subtracting 2 from 3, the resulting value is taken as vertex v. f1 3. New vertex index values.

[0062] In step S105, the update index value of each target vertex is updated according to the position mask, plane vector, and update element of each target vertex in the position mask matrix.

[0063] For example, it can be understood that each target vertex can obtain a corresponding position mask, resulting in multiple position masks for all target vertices. These multiple position masks constitute a position mask matrix. The position mask for each target vertex represents its vertex index value within the plane vector. Since multiple planes may share a vertex, a target vertex may have multiple positions within the plane vector. Therefore, based on the position masks corresponding to each target vertex in the position mask matrix and the update elements for each target vertex, the vertex index values ​​belonging to each target vertex in the plane vector can be updated.

[0064] The vertex index value update method provided in this disclosure can be applied to electronic devices, such as computers, servers, and mobile terminals. The server can be a single server or a server cluster consisting of multiple servers.

[0065] In the above technical solution, a label vector is generated based on the coordinates of each vertex in the vertex set. This label vector includes the label elements of each vertex. A plane vector is generated based on each plane in the face set. This plane vector includes the vertex index values ​​of each vertex. Then, the position masks of each vertex in the plane vector are obtained to obtain a position mask matrix, which includes the position masks of each vertex. For each target vertex, the number of vertices with zero label elements among the vertices preceding the target vertex in the plane vector is used as an update element. The target vertex is defined as a vertex with non-zero label elements. Finally, the update index values ​​of each target vertex are updated based on the corresponding position masks in the position mask matrix, the plane vector, and the update elements of each target vertex. This technical solution updates the index values ​​of vertices with non-zero label elements in the 3D model based on the number of vertices with zero label elements, avoiding the influence of meaningless vertices on vertex index value updates. This improves the speed of vertex index value updates and, to some extent, increases the processing speed of the 3D model.

[0066] Optionally, Figure 2 This is a flowchart illustrating another method for updating vertex index values ​​according to an exemplary embodiment of the present disclosure, such as... Figure 2 As shown, step S101 may also include the following steps.

[0067] In step S1011, for any vertex among all vertices, when all elements in the coordinates of the vertex are zero, the label element of the vertex is set to zero; when at least one element in the coordinates of the vertex is not zero, the label element of the vertex is set to one, so as to obtain the label elements of each vertex.

[0068] In step S1012, a label vector is generated based on the label elements of each vertex.

[0069] It is understandable that after the edge collapse algorithm is applied to the 3D model, a large number of meaningless vertices with coordinates (0,0,0) will be generated. Therefore, the elements in the vertex coordinates can be converted to Boolean type to obtain the vertex label elements. For example, the vertex coordinate (0,0,0) will have a label element of 0 after conversion to Boolean type, and the vertex coordinates other than (0,0,0) will have a label element of 1 after conversion to Boolean type. For example, the vertex coordinate (0,0,1) will have a label element of 1 after conversion to Boolean type, and the vertex coordinate (3,2,1) will also have a label element of 1 after conversion to Boolean type. After converting all vertex coordinates in the 3D model to Boolean type, a label vector consisting of 0s and 1s can be obtained. The order of the label elements of each vertex in the label vector can be the same as the order of the vertex values ​​in the planar vector mentioned above, based on the planar set [vf1 1,v f1 2,v f1 3,v f2 1,v f2 2,v f2 3,…,v fn 1,v fn 2,v fn The first 6 vertices v in 3] f1 1,v f1 2,v f1 3,v f2 1,v f2 2,v f2 For example, in 3, "v" f1 1,v f1 2,v f1 3,v f2 1,v f2 2,v f2 "3" represents the vertex index of these 6 vertices. Let's assume vertex v f1 1,v f1 2,v f1 3,v f2 1,v f2 2,v f2 The label elements of 3 are "0,0,1,0,0,1", which corresponds to the sorting in the aforementioned plane set. The label vector can be [0,0,1,0,0,1...], and this label vector can represent the position of vertex v. f1 There are two vertices with a tag element of 0 before 3, at vertex v f2 There are 4 vertices with label elements of 0 before 3, which can be used to determine the update element mentioned above.

[0070] Optionally, Figure 3 This is a flowchart illustrating another method for updating vertex index values ​​according to an exemplary embodiment of the present disclosure, such as... Figure 3 As shown, step S102 may also include the following steps.

[0071] In step S1021, the index value of each vertex in each plane of the face set is obtained.

[0072] In step S1022, the index values ​​of each vertex of all planes in the face set are merged to obtain a plane vector.

[0073] For example, there exists a set of faces {[v f1 1,v f1 2,v f1 3],[v f2 1,v f2 2,v f2 3],…,[v fn 1,vfn 2,v fn 3]}, we can obtain the planar vector {v f1 1,v f1 2,v f1 3,v f2 1,v f2 2,v f2 3,…,v fn 1,v fn 2,v fn 3}, where v f1 1,v f1 2,v f1 3 is the index value of the vertex. For example, when the face set is {(1,2,3),(1,4,5),(2,3,5)……}, the plane vector can be {1,2,3,1,4,5,2,3,5……}.

[0074] Optionally, Figure 4 This is a flowchart illustrating another method for updating vertex index values ​​according to an exemplary embodiment of the present disclosure, such as... Figure 4 As shown, step S103 may include the following steps.

[0075] In step S1031, for any vertex among all vertices, subtract the current index value of the vertex from each element in the plane vector, and perform a NOT operation on the difference obtained by subtracting the current index value from each element to obtain the position mask vector corresponding to the vertex. The position mask vector includes the position mask of the vertex in the plane vector.

[0076] In step S1032, a position mask matrix is ​​constructed based on the position mask vectors of each vertex.

[0077] For example, in a planar vector {1,2,3,1,4,5,2,3,5…}, where “1,2,3,1,4,5,2,3,5…” are the indices of each vertex, assuming the current index of vertex A that needs updating is 5, subtracting the current index of vertex A (5) from each element of this planar vector yields the vector {-4,-3,-2,-4,-1,0,-3,-2,0…}. Performing a NOT operation on this vector gives the vector {0,0,0,0,0,1,0,0,1…}, which is the position mask of vertex A. The vector {0,0,1,0,0,1……} can be called the position mask vector of vertex A. The part with 1 represents the existence of vertex A, and the part with 0 represents the non-existence of vertex A. That is, whether vertex A exists in the plane vector. Thus, the vector {0,0,0,0,0,1,0,0,1……} can represent whether vertex A exists in the plane vector and the position of vertex A's vertex index value. Similarly, the same operation can be performed on other target vertices in the plane vector to obtain the position mask vectors of each target vertex, and thus obtain the position mask matrix composed of the position mask vectors of each vertex.

[0078] Optionally, Figure 5 This is a flowchart illustrating yet another vertex index value update method according to an exemplary embodiment of the present disclosure, such as... Figure 5 As shown, step S105 may include the following steps.

[0079] In step S1051, for any target vertex among all target vertices, the position mask vector corresponding to the target vertex in the position mask matrix is ​​multiplied by the plane vector to obtain the target vector.

[0080] In this context, target vertices are those with non-zero label elements. Each target vertex corresponds to a position mask vector. Since the elements in the position mask vector are either 0 or 1, as mentioned above, a 1 in the position mask vector represents the position in the plane vector corresponding to that 1 element, which is the vertex index value of the target vertex. A 0 in the position mask vector represents the position in the plane vector corresponding to that 0 element, which is not the vertex index value of the target vertex. Therefore, by performing a dot product between the position mask vector of the target vertex and the plane vector, the positions in the plane vector belonging to the target vertex retain their current vertex index values, while the vertex index values ​​of the positions in the plane vector not belonging to the target vertex become 0. Thus, in the resulting target vector, the positions belonging to the target vertex have their vertex index values, and the elements at other positions are 0.

[0081] In step S1052, the updated element of the target vertex is subtracted from the non-zero element in the target vector to obtain the updated index value of the target vertex.

[0082] In step S1053, the current index value of the target vertex in the plane vector is updated to the updated index value to obtain the updated plane vector.

[0083] For example, suppose vertex A's current vertex index is 5, and the position mask vector of vertex A in the position mask matrix is ​​{0,0,0,0,0,1,0,0,1……}, and the plane vector is {1,4,3,1,4,5,4,3,5……}. Then, performing a dot product between the vector {0,0,0,0,0,1,0,0,1……} and {1,4,3,1,4,5,4,3,5……} yields the target vector {0,0,0,0,0,5,0,0,5……}. Therefore, the target vector for vertex A only contains the positions belonging to vertex A. The element to be updated is the index value of vertex A, which is 5. All other elements are 0. Assuming that the updated element of vertex A obtained in step S104 is 3, then the updated index value of vertex A is 5-3=2. Therefore, the plane vector after updating the vertex index value of vertex A is {1,4,3,1,4,2,4,3,2……}. Similarly, the above method can be applied to other target vertices to update the vertex index value of each target vertex in the plane vector. After the vertex index value of each target vertex is updated, the update is completed and the updated plane vector is obtained.

[0084] Optionally, the method for updating the vertex index value may further include: converting the vertex index value in the updated plane vector into an updated set of planes according to the plane to which the vertex belongs, wherein the vertices of each plane in the set of planes have updated vertex index values.

[0085] After updating the vertex index values ​​of each target vertex, the final updated plane vector is split according to the plane to which each vertex belongs, thus converting it back into the structure of a plane set and obtaining the updated plane set.

[0086] Optionally, the method for updating the vertex index value may also include: deleting vertices in the vertex set whose vertex coordinates are all zero.

[0087] Understandably, after obtaining the updated planar vectors, the current update is complete. Vertices with all zeros in their coordinates (i.e., vertices with coordinates (0,0,0)) can be deleted from the 3D model. After the next edge removal operation in the edge collapse algorithm, the vertex index update method described above can be executed again to update the vertex index values ​​of the remaining vertices in the 3D model.

[0088] In the above technical solution, a label vector is formed based on the elements in the vertex coordinates. Vertices whose vertex coordinates are all zero are marked. Based on the position of the vertex in the plane vector, a position mask of each target vertex in the plane vector is constructed and a position mask matrix is ​​formed. By updating the update elements of each target vertex, the index values ​​of the vertices after the 3D model is simplified are updated, and meaningless vertices are deleted, reducing the waste of 3D model resources and improving the processing speed of 3D model to a certain extent.

[0089] Figure 6 This is a block diagram illustrating a vertex index value updating device according to an exemplary embodiment. Figure 6 As shown, the vertex index value updating device 600 includes:

[0090] The first generation module 601 is used to generate a label vector based on the coordinates of each vertex in the vertex set. The label vector includes the label elements of each vertex.

[0091] The second generation module 602 is used to generate a plane vector based on each plane in the face set, the plane vector including the vertex index value of each vertex.

[0092] The first acquisition module 603 is used to acquire the position mask of each vertex in the plane vector to obtain a position mask matrix, which includes the position mask of each vertex.

[0093] The second acquisition module 604 is used to acquire, for each target vertex among all vertices, the number of vertices with zero label elements among the vertices located before the target vertex in the plane vector, as the update element, wherein the target vertex is a vertex with a non-zero label element.

[0094] The update module 605 is used to update the update index value of each target vertex based on the position mask, plane vector, and update element of each target vertex in the position mask matrix.

[0095] Optionally, the first generation module 601 can also be used for:

[0096] For any vertex among all vertices, if all elements in the vertex's coordinates are zero, set the vertex's label element to zero; if at least one element in the vertex's coordinates is not zero, set the vertex's label element to one, so as to obtain the label elements of each vertex.

[0097] Generate a label vector based on the label elements of each vertex.

[0098] Optionally, the second generation module 602 can also be used for:

[0099] Get the index value of each vertex in each plane of the face set;

[0100] The index values ​​of each vertex of all planes in the face set are merged to obtain a plane vector.

[0101] Optionally, the first acquisition module 603 can also be used for:

[0102] For any vertex among all vertices, subtract the current index value of the vertex from each element of the plane vector, and perform a NOT operation on the difference obtained by subtracting the current index value from each element to obtain the position mask vector corresponding to the vertex. The position mask vector includes the position mask of the vertex in the plane vector.

[0103] A position mask matrix is ​​constructed based on the position mask vectors of each vertex.

[0104] Optionally, this update module 605 can also be used for:

[0105] For any target vertex among all target vertices, the dot product of the position mask vector corresponding to that target vertex in the position mask matrix and the plane vector is performed to obtain the target vector;

[0106] Subtract the updated element of the target vertex from the non-zero elements in the target vector to obtain the updated index value of the target vertex.

[0107] In the planar vector, update the current index value of the target vertex with the updated index value to obtain the updated planar vector.

[0108] Optionally, the update module 605 can also be used to: convert the vertex index values ​​in the updated plane vector into an updated set of planes according to the plane to which the vertex belongs, wherein the vertices of each plane in the set of planes have updated vertex index values.

[0109] Optionally, the vertex index value updating device 600 may further include:

[0110] The vertex deletion module is used to delete vertices in the vertex set whose coordinates are all zero.

[0111] In the above technical solution, a label vector is generated based on the coordinates of each vertex in the vertex set. This label vector includes the label elements of each vertex. A plane vector is generated based on each plane in the face set. This plane vector includes the vertex index values ​​of each vertex. Then, the position masks of each vertex in the plane vector are obtained to obtain a position mask matrix, which includes the position masks of each vertex. For each target vertex, the number of vertices with zero label elements among the vertices preceding the target vertex in the plane vector is used as an update element. The target vertex is defined as a vertex with non-zero label elements. Finally, the update index values ​​of each target vertex are updated based on the corresponding position masks in the position mask matrix, the plane vector, and the update elements of each target vertex. This technical solution updates the index values ​​of vertices with non-zero label elements in the 3D model based on the number of vertices with zero label elements, avoiding the influence of meaningless vertices on vertex index value updates. This improves the speed of vertex index value updates and, to some extent, increases the processing speed of the 3D model.

[0112] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0113] Figure 7 This is a block diagram illustrating an electronic device 700 according to an exemplary embodiment. Figure 7 As shown, the electronic device 700 may include a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705.

[0114] The processor 701 controls the overall operation of the electronic device 700 to complete all or part of the steps in the vertex index value update method described above. The memory 702 stores various types of data to support the operation of the electronic device 700. This data may include, for example, instructions for any application or method operating on the electronic device 700, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. Multimedia component 703 may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 702 or transmitted via communication component 705. The audio component also includes at least one speaker for outputting audio signals. I / O interface 704 provides an interface between processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 705 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.

[0115] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the vertex index value update method described above.

[0116] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the vertex index value update method described above. For example, the computer-readable storage medium may be the memory 702 including the program instructions described above, which may be executed by the processor 701 of the electronic device 700 to complete the vertex index value update method described above.

[0117] Figure 8 This is a block diagram illustrating another electronic device 800 according to an exemplary embodiment. For example, the electronic device 800 may be provided as a server. (Refer to...) Figure 8 The electronic device 800 includes a processor 822, which may be one or more, and a memory 832 for storing computer programs executable by the processor 822. The computer program stored in the memory 832 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processor 822 may be configured to execute the computer program to perform the vertex index value update method described above.

[0118] Additionally, the electronic device 800 may also include a power supply component 826 and a communication component 850. The power supply component 826 can be configured to perform power management of the electronic device 800, and the communication component 850 can be configured to enable communication of the electronic device 800, such as wired or wireless communication. Furthermore, the electronic device 800 may also include an input / output (I / O) interface 858. The electronic device 800 can operate on an operating system, such as Windows Server, stored in memory 832. TM Mac OSX TM Unix TM Linux TM etc.

[0119] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the vertex index value update method described above. For example, the non-transitory computer-readable storage medium may be the memory 832 including the program instructions described above, which may be executed by the processor 822 of the electronic device 800 to complete the vertex index value update method described above.

[0120] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the vertex index value update method described above when executed by the programmable device.

[0121] The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings. However, the present disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0122] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0123] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A method for updating vertex index values, characterized in that, Applied to scenarios involving simplification of 3D model meshes, the method includes: A label vector is generated based on the coordinates of each vertex in the vertex set, and the label vector includes the label elements of each vertex; the vertex set is the set of vertices of the 3D model after being simplified by the edge collapse algorithm; A plane vector is generated based on each plane in the face set, and the plane vector includes the vertex index value of each vertex; Obtain the position mask of each vertex in the plane vector to obtain a position mask matrix, wherein the position mask matrix includes the position mask of each vertex; For each target vertex among the vertices, obtain the number of vertices in the plane vector that are located before the target vertex and whose label element is zero, and use this number as the update element. The target vertex is the vertex whose label element is not zero. Update the update index value of each target vertex according to the position mask corresponding to each target vertex in the position mask matrix, the plane vector, and the update element of each target vertex; The step of generating a label vector based on the coordinates of each vertex in the vertex set includes: For any vertex among the vertices, when all elements in the coordinates of the vertex are zero, the label element of the vertex is set to zero; when at least one element in the coordinates of the vertex is not zero, the label element of the vertex is set to one, so as to obtain the label element of each vertex. Generate the label vector based on the label elements of each vertex; The step of obtaining the position mask of each vertex in the plane vector to obtain the position mask matrix includes: For any vertex among the vertices, subtract the current index value of the vertex from each element of the plane vector, and perform a NOT operation on the difference obtained by subtracting the current index value from each element to obtain the position mask vector corresponding to the vertex. The position mask vector includes the position mask of the vertex in the plane vector. The position mask matrix is ​​constructed based on the position mask vectors of each vertex; The step of updating the update index value of each vertex according to the position mask corresponding to each target vertex in the position mask matrix, the plane vector, and the update element of each target vertex includes: For any target vertex among the target vertices, the dot product of the position mask vector corresponding to the target vertex in the position mask matrix and the plane vector is performed to obtain the target vector; Subtract the updated element of the target vertex from the non-zero elements in the target vector to obtain the updated index value of the target vertex; The current index value of the target vertex in the plane vector is updated to the updated index value to obtain the updated plane vector.

2. The method according to claim 1, characterized in that, The step of generating a plane vector based on each plane in the face set, wherein the plane vector includes the vertex index value of each vertex, including: Get the index value of each vertex in each plane of the face set; The plane vector is obtained by merging the index values ​​of each vertex of all planes in the face set.

3. The method according to claim 1, characterized in that, The method further includes: The vertex index values ​​in the updated plane vector are converted into an updated set of planes according to the plane to which the vertex belongs, and the vertices of each plane in the set of planes have updated vertex index values.

4. The method according to claim 1, characterized in that, The method further includes: Delete vertices from the vertex set whose coordinates are all zero.

5. A device for updating vertex index values, characterized in that, The device, applied to 3D model mesh simplification scenarios, includes: The first generation module is used to generate a label vector based on the coordinates of each vertex in the vertex set. The label vector includes the label elements of each vertex. The vertex set is the set of vertices of the 3D model after being simplified by the edge collapse algorithm. The second generation module is used to generate a plane vector based on each plane in the face set, wherein the plane vector includes the vertex index value of each vertex; The first acquisition module is used to acquire the position mask of each vertex in the plane vector to obtain a position mask matrix, wherein the position mask matrix includes the position mask of each vertex; The second acquisition module is used to acquire, for each target vertex among the vertices in the plane vector, the number of vertices whose label element is zero among the vertices located before the target vertex, as an update element, wherein the target vertex is a vertex whose label element is not zero; The update module is used to update the update index value of each target vertex according to the position mask corresponding to each target vertex in the position mask matrix, the plane vector, and the update element of each target vertex. The first generation module can also be used for: For any vertex among all vertices, if all elements in the vertex's coordinates are zero, set the vertex's label element to zero; if at least one element in the vertex's coordinates is not zero, set the vertex's label element to one, so as to obtain the label elements of each vertex. Generate a label vector based on the label elements of each vertex; The first acquisition module can also be used for: For any vertex among all vertices, subtract the current index value of the vertex from each element of the plane vector, and perform a NOT operation on the difference obtained by subtracting the current index value from each element to obtain the position mask vector corresponding to the vertex. The position mask vector includes the position mask of the vertex in the plane vector. Construct a position mask matrix based on the position mask vectors of each vertex; The update module can also be used for: For any target vertex among all target vertices, the dot product of the position mask vector corresponding to that target vertex in the position mask matrix and the plane vector is performed to obtain the target vector; Subtract the updated element of the target vertex from the non-zero elements in the target vector to obtain the updated index value of the target vertex. In the planar vector, update the current index value of the target vertex with the updated index value to obtain the updated planar vector.

6. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method for updating vertex index values ​​according to any one of claims 1-4.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method for updating the vertex index value as described in any one of claims 1-4.

Citation Information

Patent Citations

  • 3D model processing method and device, computer equipment and storage medium

    CN109872402A

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

    CN114429534A