Three-dimensional model simplification method, device, computer equipment and computer storage medium
By simplifying the common sides of two-dimensional manifold mesh and non-two-dimensional manifold mesh in the three-dimensional model, the problem of broken surfaces in the simplification process of three-dimensional model is solved, and more efficient storage and processing speed is achieved.
Patent Information
- Application Number
- CN202111346210.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2041-11-15
AI Technical Summary
The existing three-dimensional model simplification method is prone to surface breaking problems when dealing with three-dimensional models without topological relationships or unclear topological relationships.
By obtaining the target information of the vertices on the triangular face sheet, determine the mesh type of the triangular face sheet, and simplify the common edges between the two-dimensional manifold mesh and the non-two-dimensional manifold mesh to generate the simplified triangular face sheet to avoid simplifying the edges of the non-two-dimensional manifold mesh.
It effectively avoids the problem of surface breaking of the simplified three-dimensional model, reduces computer storage space and speeds up processing speed.
Smart Images

Figure CN114241151B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a three-dimensional model simplification method, apparatus, computer equipment, and computer-readable storage medium. Background Art
[0002] With the development of image processing technology, 3D modeling has been widely applied in many fields. For example, substations in the power industry are often represented by 3D models. These models are often described using polygonal meshes, particularly triangular meshes. However, due to the high data density of 3D models, the triangular networks within these models typically have a large number of triangular faces. This large number of triangular faces poses a significant challenge to computer analysis, display, and storage. Therefore, complex 3D models with large numbers of triangular faces need to be simplified to reduce computer storage space and increase processing speed.
[0003] Existing 3D model simplification methods mainly include vertex clustering algorithms and edge collapse algorithms based on quadratic surface errors. However, when using edge collapse algorithms based on quadratic surface errors to simplify 3D models with no topological relationships or unclear topological relationships, the problem of broken surfaces may occur. Summary of the Invention
[0004] Based on this, it is necessary to provide a three-dimensional model simplification method, device, computer equipment and computer storage medium that can solve the problem of broken surfaces when simplifying three-dimensional models in response to the above technical problems.
[0005] A three-dimensional model simplification method, the method comprising:
[0006] Acquire target information of vertices on triangular facets in the initial three-dimensional model; the target information includes position information and attribute information of the vertices;
[0007] Traversing all triangular facets in the initial three-dimensional model, and determining a mesh type of the triangular facet according to target information of vertices on the triangular facet; the mesh type includes a two-dimensional manifold mesh and a non-two-dimensional manifold mesh;
[0008] determining common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, simplifying the edges to be simplified in the triangular patches of the two-dimensional manifold mesh to generate simplified triangular patches; the edges to be simplified include edges other than the common edges from the triangular patches of the two-dimensional manifold mesh;
[0009] A simplified three-dimensional model is constructed based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh.
[0010] In one embodiment, the position information includes geometric coordinate information; and determining the mesh type of the triangular facet according to the target information of the vertices on the triangular facet includes:
[0011] Extracting common points from the triangular facets according to geometric coordinate information of vertices on the triangular facets;
[0012] The mesh type of the triangular facet is determined according to the common point.
[0013] In one embodiment, determining common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, simplifying the edges to be simplified in the triangular patches of the two-dimensional manifold mesh, and generating simplified triangular patches includes:
[0014] Determining a common edge between a triangular face of the two-dimensional manifold mesh and a triangular face of the non-two-dimensional manifold mesh according to the common point;
[0015] removing edges other than the common edges from the triangular facets of the two-dimensional manifold mesh as the edges to be simplified;
[0016] The edges to be simplified in the triangular facets of the two-dimensional manifold mesh are collapsed, the topological relationship of each edge in the triangular facets of the two-dimensional manifold mesh is updated, and simplified triangular facets are generated based on the updated topological relationship of each edge.
[0017] In one embodiment, collapsing the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, updating the topological relationship of the edges in the triangular facets of the two-dimensional manifold mesh, and generating simplified triangular facets based on the updated topological relationship of the edges includes:
[0018] Calculating target energy values of each edge in the triangular patch of the two-dimensional manifold mesh according to position information and attribute information of vertices on the triangular patch of the two-dimensional manifold mesh to generate an energy value list;
[0019] Determining a minimum target energy value from the energy value list, collapsing the edge to be simplified corresponding to the minimum target energy value, and generating a new edge for replacing the edge to be simplified;
[0020] updating the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh based on the new edge, recalculating a new target energy value of each edge in the updated topological relationship, and generating a new energy value list based on the new target energy value of each edge;
[0021] Determining whether the new target energy value of each edge is greater than or equal to a preset energy value threshold;
[0022] If so, a simplified triangular facet is generated based on the updated topological relationship.
[0023] In one embodiment, after determining whether the new target energy value of each edge is greater than or equal to a preset energy value threshold, the method further includes:
[0024] If the new target energy value of each edge is less than the preset energy value threshold, the following operations are performed in a loop;
[0025] Determining a minimum target energy value from the new energy value list, collapsing the edge to be simplified corresponding to the minimum energy value, and generating a new edge for replacing the edge to be simplified;
[0026] Based on the new edges, the topological relationship of each edge in the triangular facet of the two-dimensional manifold mesh is updated, and the target energy value of each edge in the updated topological relationship is recalculated, and a new energy value list is generated based on the new target energy value of each edge; until the target energy value of each edge in the updated topological relationship is greater than or equal to the preset energy value threshold, a simplified triangular facet is generated based on the updated topological relationship of each edge.
[0027] In one embodiment, the attribute information further includes color information, texture information, and normal information of the vertex; and calculating the target energy value of each edge in the triangular facet of the two-dimensional manifold mesh based on the position information and attribute information of the vertices on the triangular facet of the two-dimensional manifold mesh and generating an energy value list includes:
[0028] Calculating a first energy value of each edge in the triangle according to geometric coordinate information of the vertices on the triangle of the two-dimensional manifold mesh; calculating a second energy value of each edge in the triangle according to color information of the vertices on the triangle of the two-dimensional manifold mesh; calculating a third energy value of each edge in the triangle according to texture information of the vertices on the triangle of the two-dimensional manifold mesh; and calculating a fourth energy value of each edge in the triangle according to normal information of the vertices on the triangle of the two-dimensional manifold mesh.
[0029] For each edge in the triangular patch, calculating a target energy value of the edge based on the first energy value, the second energy value, the third energy value, and the fourth energy value of the edge;
[0030] An energy value list is generated according to target energy values of each edge in a triangular patch of the two-dimensional manifold mesh.
[0031] In one embodiment, the attribute information includes texture information; and before simplifying the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, the method further includes:
[0032] Determining a texture boundary of a triangular face of the non-two-dimensional manifold mesh according to texture information of vertices on the triangular face;
[0033] Determining the position boundaries of the triangular facets of the non-two-dimensional manifold mesh according to the position information of the vertices on the triangular facets;
[0034] The texture boundary and the position boundary are removed from the edge to be simplified to generate a new edge to be simplified.
[0035] A three-dimensional model simplification device, comprising:
[0036] A target information acquisition module is used to acquire target information of vertices on triangular facets in the initial three-dimensional model; the target information includes position information and attribute information of the vertices;
[0037] A mesh type determination module, configured to traverse all triangular facets in the initial three-dimensional model and determine the mesh type of the triangular facets according to target information of vertices on the triangular facets; the mesh type includes a two-dimensional manifold mesh and a non-two-dimensional manifold mesh;
[0038] a mesh simplification module, configured to determine common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, simplify the edges to be simplified in the triangular patches of the two-dimensional manifold mesh, and generate simplified triangular patches; the edges to be simplified include edges other than the common edges from the triangular patches of the two-dimensional manifold mesh;
[0039] The simplified three-dimensional model construction module is used to construct a simplified three-dimensional model based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh.
[0040] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0041] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0042] The above-mentioned three-dimensional model simplification method, device, computer equipment and computer-readable storage medium include: obtaining target information of vertices on triangular facets in the initial three-dimensional model; the target information includes position information and attribute information of the vertices; traversing all triangular facets in the initial three-dimensional model, and determining the mesh type of the triangular facets according to the target information of the vertices on the triangular facets; the mesh type includes two-dimensional manifold mesh and non-two-dimensional manifold mesh; determining the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh, simplifying the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, and generating simplified triangular facets; the edges to be simplified include other edges except the common edges removed from the triangular facets of the two-dimensional manifold mesh; constructing a simplified three-dimensional model based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh. Since the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh do not have topological structure information, if the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh are simplified, the simplified common edges will not have any topological structure information, which will lead to the problem of broken surfaces in the simplified three-dimensional model. The present application divides all the triangular facets in the three-dimensional model into two-dimensional manifold meshes and non-two-dimensional manifold meshes according to the target information of the vertices on the triangular facets in the three-dimensional model, thereby determining the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh, and then determining the edges to be simplified in the triangular facets of the two-dimensional manifold mesh through the above common edges. In this way, the edges other than the above common edges in the triangular facets of the two-dimensional manifold mesh can be simplified in a targeted manner without simplifying the edges of the non-two-dimensional manifold mesh. Thus, the problem of broken surfaces in the simplified three-dimensional model is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A diagram showing an application environment of a three-dimensional model simplification method according to an embodiment;
[0044] Figure 2 Schematic diagram of a process of a three-dimensional model simplification method in one embodiment;
[0045] Figure 3 A schematic diagram of the structure of a two-dimensional manifold grid and a non-two-dimensional manifold grid in one embodiment;
[0046] Figure 4 Schematic diagram of a process of a three-dimensional model simplification method in one embodiment;
[0047] Figure 5 Schematic diagram of a process of a three-dimensional model simplification method in one embodiment;
[0048] Figure 6Schematic diagram of a process of a three-dimensional model simplification method in one embodiment;
[0049] Figure 7 Schematic diagram of a process of a three-dimensional model simplification method in one embodiment;
[0050] Figure 8 Schematic diagram of a process of a three-dimensional model simplification method in one embodiment;
[0051] Figure 9 Schematic diagram of a process of a three-dimensional model simplification method in one embodiment;
[0052] Figure 10 A schematic flow chart of a three-dimensional model simplification method according to a specific embodiment;
[0053] Figure 11 A structural block diagram of a three-dimensional model simplification device in one embodiment;
[0054] Figure 12 is a structural block diagram of a grid type determination module in one embodiment;
[0055] Figure 13 is a structural block diagram of a grid simplification module in one embodiment;
[0056] Figure 14 A structural block diagram of a three-dimensional model simplification device in one embodiment;
[0057] Figure 15 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0059] The 3D model simplification method provided in this application can be applied to Figure 1In the application environment shown. Wherein, the three-dimensional model 120 can be a non-manifold substation, and the server 140 first obtains the target information of the vertices on the triangular facets in the initial three-dimensional model 120; the target information includes the position information and attribute information of the vertex; then, the server 140 traverses all the triangular facets in the initial three-dimensional model 120, and determines the mesh type of the triangular facets according to the target information of the vertices on the triangular facets; the mesh type includes a two-dimensional manifold mesh and a non-two-dimensional manifold mesh; secondly, the server 140 determines the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh, simplifies the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, and generates simplified triangular facets; the edges to be simplified include other edges other than the common edges removed from the triangular facets of the two-dimensional manifold mesh; finally, the server 140 constructs a simplified three-dimensional model based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh. Wherein, the server 140 can be implemented by, but not limited to, various personal computers, laptops, smart phones, tablet computers, independent servers, or a server cluster consisting of multiple servers, and this application does not limit this.
[0060] In one embodiment, Figure 2 As shown, a three-dimensional model simplification method is provided, which is applied to Figure 1 Taking the terminal in FIG. 1 as an example, the method includes the following steps 220 to 280:
[0061] S220 , obtaining target information of vertices on triangular facets in the initial three-dimensional model; the target information includes position information and attribute information of the vertices.
[0062] A 3D model is a polygonal representation of an object, typically displayed on a computer or other video device. The displayed object can be real-world or imaginary; anything that exists in the physical world can be represented by a 3D model. 3D models are often created using specialized software such as 3D modeling tools, but other methods are also possible. As a collection of points and other information, a 3D model can be generated manually or using an algorithm, resulting in a virtual representation on a computer or computer file. 3D models are widely used wherever 3D graphics are used. In fact, their use predates the popularity of 3D graphics on personal computers. Currently, 3D models are used in a variety of fields. They are used in medicine to create precise models of organs; in the film industry for animated characters, objects, and realistic films; in the video game industry as assets for computer and video games; in science as precise models of chemical compounds; in architecture to illustrate proposed buildings or landscapes; in engineering to design new equipment, vehicles, structures, and other applications; and in recent decades, in the earth sciences, 3D geological models have been constructed. 3D models can be rendered from simple wireframes at varying levels of detail or shaded using various methods. However, many 3D models are covered with textures. The process of arranging textures onto 3D models is called texture mapping. A texture is simply an image, but it can add detail and a more realistic appearance to a model. For example, a 3D model of a person with textured skin and clothing appears more realistic than a simple monochrome or wireframe model. In addition to textures, other effects can be applied to 3D models to enhance realism. For example, surface normals can be adjusted to achieve lighting effects, and some surfaces can use bump mapping and other 3D rendering techniques. Textures include both the texture of an object's surface in the usual sense, even if the surface has uneven grooves, and colored patterns on smooth surfaces, also known as texture mapping. When textures are mapped onto a surface in a specific way, they can make the object appear more realistic. Texture mapping is a technique that assigns image data to a mesh. After processing the image obtained by photographing the object, the texture is mapped onto each mesh to form the final 3D model.
[0063] Among them, the three-dimensional model is usually composed of multiple grids, and the grid is composed of many point clouds of the object, and the three-dimensional model grid is formed by the point cloud. The point cloud includes three-dimensional coordinates, laser reflection intensity and color information, etc., and is eventually drawn into a grid. The grid is usually composed of triangular facets, quadrilateral facets or other simple convex polygonal facets, which can simplify the rendering process. However, the grid can also include objects composed of ordinary polygons with holes. In this application, the simplification is mainly aimed at three-dimensional models whose grids are triangular facets.
[0064] The target information of the vertices on the triangles in the three-dimensional model includes the position information and attribute information of the vertices. The position information can be the geometric coordinates of the vertices on the triangles in the three-dimensional model, and the geometric coordinates can represent the position information of each triangle in the mesh of the three-dimensional model. The attribute information can be the texture coordinates and color information of the vertices on the triangles in the three-dimensional model. The attribute information can also be the normal information of the triangles in the three-dimensional model. When drawing a texture mapping scene, not only the geometric coordinates but also the texture coordinates must be defined for each vertex. After various transformations, the geometric coordinates determine the position of the vertex in the mesh, while the texture coordinates determine which texel in the texture image is assigned to the vertex. Color information is the color of the vertices on the triangular facets in the three-dimensional model. Color information can be represented using RGB, where R represents red and has a value range of 0-255, G represents green and has a value range of 0-255, and B represents blue and has a value range of 0-255, for example: RGB (230, 128, 190). Color information can also be represented using HSL, where H represents hue and has a value range of 0-360, which is the base color of the color and represents the angle around the color wheel. S represents saturation and has a value range of 0%-100%, where 0 is no color and is displayed as gray, and 100% is full color. L represents brightness and has a value range of 0%-100%, where 0 is no light and is displayed as completely black, and 100% is full light and is displayed as completely white, for example: HSL (100, 23%, 50%). This application does not limit the method of representing color information. Normal information can be the normal of a triangular face in a three-dimensional model, where a normal refers to an imaginary line that is always perpendicular to a plane. The normal of a curve is a straight line perpendicular to the tangent of a point on the curve. The normal of a point on a surface refers to the straight line passing through this point and perpendicular to the tangent plane at that point.
[0065] Specifically, such as Figure 1 As shown, a computer device obtains target information of vertices on triangular facets in an initial 3D model. The target information includes position information and attribute information of each vertex on the triangular facets in the 3D model. The position information includes, but is not limited to, the geometric coordinates of each vertex on the triangular facets in the 3D model, and the attribute information includes, but is not limited to, the color information, color and texture information of each vertex on the triangular facets in the 3D model, and the normal information of the triangular facets in the 3D model. This application does not limit the position information and attribute information of each vertex on the triangular facets in the 3D model.
[0066] S240, traversing all triangular facets in the initial three-dimensional model, and determining the mesh type of the triangular facets according to target information of the vertices on the triangular facets; the mesh type includes a two-dimensional manifold mesh and a non-two-dimensional manifold mesh.
[0067] The target information of the vertices on the triangular facet includes the position information and attribute information of each vertex on the triangular facet in the three-dimensional model. The position information includes but is not limited to the geometric coordinates of each vertex on the triangular facet in the three-dimensional model, and the attribute information includes but is not limited to the color information of each vertex on the triangular facet in the three-dimensional model, the color information and texture information of each vertex, and the normal information of the triangular facet in the three-dimensional model. The mesh types of the triangular facet include two-dimensional manifold mesh and non-two-dimensional manifold mesh. Figure 3 is a schematic diagram of the structure of a two-dimensional manifold grid and a non-two-dimensional manifold grid, such as Figure 3 As shown in the figure, it is a three-dimensional model of a cube. In the above three-dimensional model, there are multiple quadrilaterals. The intersection line of quadrilaterals S1 and S2 is edge V1V2. The two-dimensional manifold mesh indicates that the edge V1V2 has at most two directed edges: V1→V2 and V2→V1. If there are additional faces sharing the edge, whether it is V1→V2 or V2→V1, it belongs to a non-two-dimensional manifold mesh. For example, Figure 3 As shown, the quadrilateral patch S3 shares the edge V1V2, but the edge V1V2 is already shared by the quadrilateral patch S1 and the quadrilateral patch S2. That is to say, the edge V1V2 already has two directed edges V1→V2 and V2→V1. Therefore, the edge V1V2 cannot be shared by the quadrilateral patch S3, and the quadrilateral patch S3 is a non-two-dimensional manifold mesh, while the quadrilateral patch S1 and the quadrilateral patch S2 are two-dimensional manifold meshes.
[0068] Specifically, such as Figure 1 As shown, the computer device traverses all triangular facets in the initial three-dimensional model and determines the mesh type of the triangular facets based on the target information of the vertices on the triangular facets; the mesh types include two-dimensional manifold meshes and non-two-dimensional manifold meshes. The computer device can use the geometric coordinate information of the vertices on the triangular facets to determine whether there are common edges between the triangular facets. If the computer device determines that two triangular facets only share one edge, then the triangular facet is a two-dimensional manifold mesh. If the computer device determines that more than two triangular facets share one edge, then the triangular facet is a non-two-dimensional manifold mesh.
[0069] S260. Determine the common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, simplify the edges to be simplified in the triangular patches of the two-dimensional manifold mesh, and generate simplified triangular patches; the edges to be simplified include other edges from the triangular patches of the two-dimensional manifold mesh except the common edges.
[0070] Among them, the common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh are common edges, for example, Figure 3As shown, edge V1V2 is a common edge between the two-dimensional manifold mesh S1 and the two-dimensional manifold mesh S2. At the same time, edge V1V2 coincides with edge V3V4 of the non-two-dimensional manifold mesh S3. Therefore, edge V1V2 is a common edge between the triangle patch of the two-dimensional manifold mesh and the triangle patch of the non-two-dimensional manifold mesh. The edges to be simplified include the edges other than the common edges removed from the triangle patch of the two-dimensional manifold mesh, for example, Figure 3 As shown, for a two-dimensional manifold mesh, all edges except the edge V1V2 are called edges to be simplified.
[0071] Specifically, by determining the common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, the edges to be simplified in the triangular patches of the two-dimensional manifold mesh are simplified. The above-mentioned simplification method includes but is not limited to a vertex clustering algorithm and an edge folding algorithm based on quadratic surface errors, etc., and the present application does not limit this. After simplifying the edges to be simplified in the triangular patches of the two-dimensional manifold mesh, simplified triangular patches are generated; wherein, the above-mentioned edges to be simplified include other edges except the common edges removed from the triangular patches of the two-dimensional manifold mesh.
[0072] S280: Construct a simplified three-dimensional model based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh.
[0073] Among them, there are common edges between the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh, and the above common edges are not simplified. Therefore, the triangular facets of the non-two-dimensional manifold mesh find the corresponding position in the simplified triangular facets based on the target information of the triangular facets, and the triangular facets of the non-two-dimensional manifold mesh are spliced into the simplified triangular facets. The above target information includes position information, and the position information can be the geometric coordinate information of each vertex of the triangular facet.
[0074] In the above-mentioned three-dimensional model simplification method, target information of vertices on triangular facets in the initial three-dimensional model is obtained; the target information includes position information and attribute information of the vertices; all triangular facets in the initial three-dimensional model are traversed, and the mesh type of the triangular facets is determined based on the target information of the vertices on the triangular facets; the mesh types include two-dimensional manifold mesh and non-two-dimensional manifold mesh; the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh are determined, and the edges to be simplified in the triangular facets of the two-dimensional manifold mesh are simplified to generate simplified triangular facets; the edges to be simplified include other edges other than the common edges from the triangular facets of the two-dimensional manifold mesh; based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh, a simplified three-dimensional model is constructed. Since the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh do not have topological structure information, if the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh are simplified, the simplified common edges will not have any topological structure information, which will cause the simplified three-dimensional model to have broken surfaces. This application divides all triangular facets in a three-dimensional model into two-dimensional manifold meshes and non-two-dimensional manifold meshes based on the target information of the vertices on the triangular facets in the three-dimensional model, thereby determining the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh, and then determining the edges to be simplified in the triangular facets of the two-dimensional manifold mesh through the above common edges. In this way, the edges other than the above common edges in the triangular facets of the two-dimensional manifold mesh can be simplified in a targeted manner without simplifying the edges of the non-two-dimensional manifold mesh. Thus, the problem of broken surfaces in the simplified three-dimensional model is avoided.
[0075] In one embodiment, Figure 4 As shown, the position information includes geometric coordinate information; determining the mesh type of the triangular facet according to the target information of the vertices on the triangular facet includes steps 242 to 244:
[0076] S242. Extract common points from the triangular facets according to the geometric coordinate information of the vertices on the triangular facets.
[0077] The geometric coordinate information of the vertex on the triangle is the position coordinate of the vertex on the coordinate axis, and the common point is the common point corresponding to the common edge between the triangle of the two-dimensional manifold mesh and the triangle of the non-two-dimensional manifold mesh. Figure 3 As shown, edge V1V2 is the common edge of the two-dimensional manifold mesh S1 and the two-dimensional manifold mesh S2. At the same time, edge V1V2 coincides with edge V3V4 of the non-two-dimensional manifold mesh S3. Therefore, edge V1V2 is the common edge between the triangle patch of the two-dimensional manifold mesh and the triangle patch of the non-two-dimensional manifold mesh, and the two endpoints corresponding to edge V1V2 are common points in the triangle patch.
[0078] S244. Determine the mesh type of the triangular face based on the common points.
[0079] Among them, the common edges between triangles can be determined based on the common points in the triangles, and the mesh type of the triangles can be determined by the common edges between the triangles. The mesh types of the above triangles include triangles of two-dimensional manifold meshes and non-two-dimensional manifold meshes. For example, Figure 3 As shown in the figure, it is a three-dimensional model of a cube. In the above three-dimensional model, there are multiple quadrilaterals. The intersection line of quadrilaterals S1 and S2 is edge V1V2. The two-dimensional manifold mesh indicates that the edge V1V2 has at most two directed edges: V1→V2 and V2→V1. If there are additional faces sharing the edge, whether it is V1→V2 or V2→V1, it belongs to a non-two-dimensional manifold mesh. For example, Figure 3 As shown, the quadrilateral patch S3 shares the edge V1V2, but the edge V1V2 is already shared by the quadrilateral patch S1 and the quadrilateral patch S2. That is to say, the edge V1V2 already has two directed edges V1→V2 and V2→V1. Therefore, the edge V1V2 cannot be shared by the quadrilateral patch S3, and the quadrilateral patch S3 is a non-two-dimensional manifold mesh, while the quadrilateral patch S1 and the quadrilateral patch S2 are two-dimensional manifold meshes.
[0080] In an embodiment of the present application, the position information includes geometric coordinate information; the mesh type of the triangular facet is determined based on the target information of the vertices on the triangular facet, including: extracting common points from the triangular facet based on the geometric coordinate information of the vertices on the triangular facet; determining the mesh type of the triangular facet based on the common points. By judging the mesh type of the triangular facet, the problem of broken surfaces that occurs when simplifying the three-dimensional model is effectively solved.
[0081] In one embodiment, Figure 5 As shown, determining the common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, simplifying the edges to be simplified in the triangular patches of the two-dimensional manifold mesh, and generating simplified triangular patches includes steps 262 to 266:
[0082] S262. Determine common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh based on the common points.
[0083] Specifically, the computer device determines the common edge between the triangular patch of the two-dimensional manifold mesh and the triangular patch of the non-two-dimensional manifold mesh based on the common point, wherein the geometric coordinate information of the vertex on the triangular patch is the position coordinate of the vertex on the coordinate axis, and the common point is the common point corresponding to the common edge between the triangular patch of the two-dimensional manifold mesh and the triangular patch of the non-two-dimensional manifold mesh. Figure 3As shown, edge V1V2 is a common edge between the two-dimensional manifold mesh S1 and the two-dimensional manifold mesh S2. At the same time, edge V1V2 coincides with edge V3V4 of the non-two-dimensional manifold mesh S3. Therefore, edge V1V2 is a common edge between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh.
[0084] S264. Remove edges other than common edges from the triangular facets of the two-dimensional manifold mesh as edges to be simplified.
[0085] Specifically, the computer device removes the edges other than the common edges from the triangular facets of the two-dimensional manifold mesh as the edges to be simplified, wherein the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh are the common edges, for example, Figure 3 As shown, edge V1V2 is a common edge between the two-dimensional manifold mesh S1 and the two-dimensional manifold mesh S2. At the same time, edge V1V2 coincides with edge V3V4 of the non-two-dimensional manifold mesh S3. Therefore, edge V1V2 is a common edge between the triangle patch of the two-dimensional manifold mesh and the triangle patch of the non-two-dimensional manifold mesh. The edges to be simplified include the edges other than the common edges removed from the triangle patch of the two-dimensional manifold mesh, for example, Figure 3 As shown, for a two-dimensional manifold mesh, all edges except the edge V1V2 are called edges to be simplified.
[0086] S266: Collapse the edges to be simplified in the triangular patch of the two-dimensional manifold mesh, update the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh, and generate simplified triangular patches based on the updated topological relationship of each edge.
[0087] Among them, such as Figure 3 As shown, edge V1V2 is a common edge between the two-dimensional manifold mesh S1 and the two-dimensional manifold mesh S2. At the same time, edge V1V2 coincides with edge V3V4 of the non-two-dimensional manifold mesh S3. Therefore, edge V1V2 is a common edge between the triangle patch of the two-dimensional manifold mesh and the triangle patch of the non-two-dimensional manifold mesh. The edges to be simplified include the edges other than the common edges removed from the triangle patch of the two-dimensional manifold mesh, for example, Figure 3 As shown, for a two-dimensional manifold mesh, all edges other than edges V1 and V2 are referred to as edges to be simplified. Specifically, by determining the common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, the edges to be simplified in the triangular patches of the two-dimensional manifold mesh are collapsed, and simplified triangular patches are generated after collapsing the edges to be simplified in the triangular patches of the two-dimensional manifold mesh; wherein the edges to be simplified include all edges other than the common edges removed from the triangular patches of the two-dimensional manifold mesh.
[0088] In an embodiment of the present application, the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh are determined, the edges to be simplified in the triangular facets of the two-dimensional manifold mesh are simplified, and simplified triangular facets are generated, including: determining the common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh based on the common points; removing the other edges except the common edges from the triangular facets of the two-dimensional manifold mesh as the edges to be simplified; collapsing the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, updating the topological relationship of each edge in the triangular facets of the two-dimensional manifold mesh, and generating simplified triangular facets based on the updated topological relationship of each edge. By collapsing the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, thereby updating the topological relationship of each edge in the triangular facets of the two-dimensional manifold mesh, and generating simplified triangular facets based on the updated topological relationship of each edge, the problem of broken surfaces that occurs when simplifying a three-dimensional model is effectively solved.
[0089] In one embodiment, Figure 6 As shown, the edges to be simplified in the triangular facets of the two-dimensional manifold mesh are collapsed, the topological relationship of each edge in the triangular facets of the two-dimensional manifold mesh is updated, and simplified triangular facets are generated based on the updated topological relationship of each edge, including steps 301 to 305:
[0090] S301 : Calculate target energy values of each edge in a triangular patch of a two-dimensional manifold mesh according to position information and attribute information of vertices on the triangular patch of the two-dimensional manifold mesh to generate an energy value list.
[0091] The position information of the vertices on the triangles of the two-dimensional manifold mesh can be the geometric coordinates of the vertices on the triangles in the three-dimensional model. The geometric coordinates can represent the position information of each triangle in the mesh of the three-dimensional model. The attribute information can be the texture coordinates and color information of the vertices on the triangles in the three-dimensional model. The attribute information can also be the normal information of the triangles in the three-dimensional model. When rendering a texture mapping scene, not only the geometric coordinates but also the texture coordinates must be defined for each vertex. After various transformations, the geometric coordinates determine the position of the vertex in the mesh, while the texture coordinates determine which texel in the texture image is assigned to the vertex. Color information is the color of the vertices on the triangular facets in the three-dimensional model. Color information can be represented using RGB, where R represents red and has a value range of 0-255, G represents green and has a value range of 0-255, and B represents blue and has a value range of 0-255, for example: RGB (230, 128, 190). Color information can also be represented using HSL, where H represents hue and has a value range of 0-360, which is the base color of the color and represents the angle around the color wheel. S represents saturation and has a value range of 0%-100%, where 0 is no color and is displayed as gray, and 100% is full color. L represents brightness and has a value range of 0%-100%, where 0 is no light and is displayed as completely black, and 100% is full light and is displayed as completely white, for example: HSL (100, 23%, 50%). This application does not limit the method of representing color information. Normal information can be the normal of a triangular face in a three-dimensional model, where a normal refers to an imaginary line that is always perpendicular to a plane. The normal of a curve is a straight line perpendicular to the tangent of a point on the curve. The normal of a point on a surface refers to the straight line passing through this point and perpendicular to the tangent plane at that point.
[0092] Furthermore, based on the position information and attribute information of the vertices on the triangles of the two-dimensional manifold mesh, a target energy value of each edge in the triangles of the two-dimensional manifold mesh is calculated to generate an energy value list. The target energy value of each edge in the triangles of the two-dimensional manifold mesh can be calculated based on the position information and attribute information of the vertices on the triangles of the two-dimensional manifold mesh. The target energy value can reflect the color information, texture information, normal information, and geometric coordinate information of each edge in the triangles of the two-dimensional manifold mesh.
[0093] S302: Determine the minimum target energy value from the energy value list, collapse the edge to be simplified corresponding to the minimum target energy value, and generate a new edge to replace the edge to be simplified.
[0094] The target energy value of each edge in the triangle of the two-dimensional manifold mesh is calculated based on the position information and attribute information of the vertices on the triangle of the two-dimensional manifold mesh to generate an energy value list. The target energy value of each edge in the triangle of the two-dimensional manifold mesh can be calculated based on the position information and attribute information of the vertices on the triangle of the two-dimensional manifold mesh. The target energy value can reflect the color information, texture information, normal information and geometric coordinate information of each edge in the triangle of the two-dimensional manifold mesh.
[0095] Specifically, the energy values in the energy value list are arranged in a certain order, such as arranging the energy values in ascending order, or arranging the energy values in descending order, which is not limited in this application. Further, a minimum target energy value is determined from the energy value list, and the edge to be simplified corresponding to the minimum target energy value is collapsed to generate a new edge to replace the edge to be simplified.
[0096] S303. Update the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh based on the new edge, recalculate the new target energy value of each edge in the updated topological relationship, and generate a new energy value list based on the new target energy value of each edge.
[0097] Among them, the minimum target energy value is determined from the energy value list, and the edge to be simplified corresponding to the minimum target energy value is collapsed to generate a new edge to replace the edge to be simplified. Based on the above new edges, the topological relationship of each edge in the triangular facet of the two-dimensional manifold mesh is updated, and the new target energy value of each edge in the updated topological relationship is recalculated, and a new energy value list is generated based on the new target energy value of each edge. The energy values in the above new energy value list are arranged in a certain order, such as the energy values are arranged in order from small to large, or the energy values are arranged in order from large to small, and this application does not limit this.
[0098] S304: Determine whether the new target energy value of each edge is greater than or equal to a preset energy value threshold.
[0099] Specifically, it is determined whether the new target energy value of each edge is greater than or equal to a preset energy value threshold. If so, the next step is performed. The preset energy value threshold is pre-set. A smaller preset energy value threshold means a greater number of simplifications of the triangular facets of the two-dimensional manifold mesh, and a larger preset energy value threshold means a smaller number of simplifications of the triangular facets of the two-dimensional manifold mesh.
[0100] S305: If yes, generate simplified triangular facets based on the updated topological relationship.
[0101] Specifically, if the new target energy value of each edge in the triangular patch of the two-dimensional manifold mesh is greater than or equal to a preset energy value threshold, a simplified triangular patch is generated based on the updated topological relationship.
[0102] In an embodiment of the present application, the edges to be simplified in the triangular patches of the two-dimensional manifold mesh are collapsed, the topological relationship of each edge in the triangular patches of the two-dimensional manifold mesh is updated, and a simplified triangular patch is generated based on the updated topological relationship of each edge, including: calculating the target energy value of each edge in the triangular patch of the two-dimensional manifold mesh according to the position information and attribute information of the vertices on the triangular patch of the two-dimensional manifold mesh to generate an energy value list; determining the minimum target energy value from the energy value list, collapsing the edges to be simplified corresponding to the minimum target energy value, and generating new edges for replacing the edges to be simplified; updating the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh based on the new edges, and recalculating the new target energy value of each edge in the updated topological relationship, and generating a new energy value list based on the new target energy value of each edge; judging whether the new target energy value of each edge is greater than or equal to a preset energy value threshold; if so, generating a simplified triangular patch based on the updated topological relationship. By using the position information and attribute information of the vertices on the triangular patches of the two-dimensional manifold mesh, the target energy value of each edge in the triangular patches of the two-dimensional manifold mesh is calculated to generate an energy value list. This can effectively take into account the position information and attribute information of each edge in the two-dimensional manifold mesh, thereby improving the accuracy of the simplification of the two-dimensional manifold mesh.
[0103] In one embodiment, Figure 7 As shown, after determining whether the new target energy value of each edge is greater than or equal to the preset energy value threshold, steps 306 to 307 are also included:
[0104] If the new target energy value of each edge is less than the preset energy value threshold, the following operations are performed in a loop.
[0105] S306 : Determine the minimum target energy value from the new energy value list, collapse the edge to be simplified corresponding to the minimum energy value, and generate a new edge to replace the edge to be simplified.
[0106] The target energy value for each edge in the two-dimensional manifold mesh's triangles is calculated based on the position and attribute information of the vertices on the two-dimensional manifold mesh's triangles to generate an energy value list. The target energy value for each edge in the two-dimensional manifold mesh's triangles can be calculated based on the position and attribute information of the vertices on the two-dimensional manifold mesh's triangles. The target energy value can reflect the color information, texture information, normal information, and geometric coordinate information of each edge in the two-dimensional manifold mesh's triangles.
[0107] Specifically, the energy values in the energy value list are arranged in a certain order, such as arranging the energy values from small to large, or arranging the energy values from large to small, which is not limited in this application. Further, the minimum target energy value is determined from the energy value list, the minimum target energy value is determined from the new energy value list, and the edge to be simplified corresponding to the minimum energy value is collapsed to generate a new edge to replace the edge to be simplified.
[0108] S307. Update the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh based on the new edge, recalculate the target energy value of each edge in the updated topological relationship, and generate a new energy value list based on the new target energy value of each edge; until the target energy value of each edge in the updated topological relationship is greater than or equal to the preset energy value threshold, and generate a simplified triangular patch based on the updated topological relationship of each edge.
[0109] The topological relationships of the edges in the triangular patch of the two-dimensional manifold mesh are updated based on the new edges. The target energy values of the edges in the updated topological relationships are calculated by reconstructing the topological relationships of the edges in the triangular patch. A new energy value list is generated based on the new target energy values of the edges. The energy values in the energy value list are arranged in a certain order, and the steps of: determining the minimum target energy value from the new energy value list, collapsing the edge to be simplified corresponding to the minimum energy value, generating a new edge to replace the edge to be simplified, updating the topological relationships of the edges in the triangular patch of the two-dimensional manifold mesh based on the new edges, recalculating the target energy values of the edges in the updated topological relationships, and generating a new energy value list based on the new target energy values of the edges are repeated until the target energy values of the edges in the updated topological relationships are greater than or equal to a preset energy value threshold, and a simplified triangular patch is generated based on the updated topological relationships of the edges.
[0110] In an embodiment of the present application, after determining whether the new target energy value of each edge is greater than or equal to the preset energy value threshold, it also includes: if the new target energy value of each edge is less than the preset energy value threshold, then looping the following operations; determining the minimum target energy value from the new energy value list, collapsing the edge to be simplified corresponding to the minimum energy value, and generating a new edge for replacing the edge to be simplified; updating the topological relationship of each edge in the triangular facet of the two-dimensional manifold mesh based on the new edge, and recalculating the target energy value of each edge in the updated topological relationship, and generating a new energy value list based on the new target energy value of each edge; until the target energy value of each edge in the updated topological relationship is greater than or equal to the preset energy value threshold, and a simplified triangular facet is generated based on the updated topological relationship of each edge, thereby improving the accuracy of simplification of the two-dimensional manifold mesh.
[0111] In one embodiment, Figure 8As shown, the attribute information also includes vertex color information, texture information, and normal information; according to the position information and attribute information of the vertices on the triangular facets of the two-dimensional manifold mesh, the target energy value of each edge in the triangular facets of the two-dimensional manifold mesh is calculated to generate an energy value list, including steps 312 to 316:
[0112] S312. Calculate the first energy value of each edge in the triangle according to the geometric coordinate information of the vertices on the triangle of the two-dimensional manifold mesh; calculate the second energy value of each edge in the triangle according to the color information of the vertices on the triangle of the two-dimensional manifold mesh; calculate the third energy value of each edge in the triangle according to the texture information of the vertices on the triangle of the two-dimensional manifold mesh; calculate the fourth energy value of each edge in the triangle according to the normal information of the vertices on the triangle of the two-dimensional manifold mesh.
[0113] Among them, the first energy value is the geometric energy value of each edge in the triangle, the second energy value is the color energy value of each edge in the triangle, the third energy value is the texture energy value of each edge in the triangle, and the fourth energy value is the normal energy value of each edge in the triangle. Specifically, according to the geometric coordinate information of the vertices on the triangle of the two-dimensional manifold mesh, the geometric coordinate information can be the geometric coordinates of each vertex in the triangle, the first energy value of each edge in the triangle is calculated, according to the color information of the vertices on the triangle of the two-dimensional manifold mesh, the color information can be the color coordinates of the vertices on the triangle, the second energy value of each edge in the triangle is calculated, according to the texture information of the vertices on the triangle of the two-dimensional manifold mesh, the texture information can be the texture coordinates of the vertices on the triangle, the third energy value of each edge in the triangle is calculated; according to the normal information of the vertices on the triangle of the two-dimensional manifold mesh, the normal information can be the normal coordinates of the vertices on the triangle, the fourth energy value of each edge in the triangle is calculated. That is to say, the first energy value reflects the geometric coordinate information of the vertices on the triangular patch of the two-dimensional manifold mesh, the second energy value reflects the color information of the vertices on the triangular patch of the two-dimensional manifold mesh, the third energy value reflects the texture information of the vertices on the triangular patch of the two-dimensional manifold mesh, and the fourth energy value reflects the normal information of the vertices on the triangular patch of the two-dimensional manifold mesh.
[0114] S314 . For each edge in the triangle patch, calculate a target energy value of the edge based on the first energy value, the second energy value, the third energy value, and the fourth energy value of the edge.
[0115] Among them, for each edge in the triangle, the target energy value of the edge is calculated based on the first energy value, second energy value, third energy value and fourth energy value of the edge. The first energy value of the edge reflects the geometric coordinate information of the vertex on the triangle of the two-dimensional manifold mesh, the second energy value reflects the color information of the vertex on the triangle of the two-dimensional manifold mesh, the third energy value reflects the texture information of the vertex on the triangle of the two-dimensional manifold mesh, and the fourth energy value reflects the normal information of the vertex on the triangle of the two-dimensional manifold mesh. Specifically, the target energy value of the edge is calculated by adding the first energy value, the second energy value, the third energy value and the fourth energy value of the edge.
[0116] S316 , generating an energy value list according to the target energy value of each edge in the triangular patch of the two-dimensional manifold mesh.
[0117] Among them, an energy value list is generated according to the target energy value of each edge in the triangular facet of the two-dimensional manifold mesh. The energy values in the above energy value list are arranged in a certain order, such as the energy values are arranged in order from small to large, or the energy values are arranged in order from large to small. This application does not limit this.
[0118] In an embodiment of the present application, the attribute information also includes color information, texture information, and normal information of the vertex; based on the position information and attribute information of the vertices on the triangular patch of the two-dimensional manifold mesh, the target energy value of each edge in the triangular patch of the two-dimensional manifold mesh is calculated to generate an energy value list, including: calculating the first energy value of each edge in the triangular patch based on the geometric coordinate information of the vertices on the triangular patch of the two-dimensional manifold mesh; calculating the second energy value of each edge in the triangular patch based on the color information of the vertices on the triangular patch of the two-dimensional manifold mesh; calculating the second energy value of each edge in the triangular patch based on .... The third energy value of each edge in the triangle is calculated based on the texture information of the vertices on the triangle of the two-dimensional manifold mesh; the fourth energy value of each edge in the triangle is calculated according to the normal information of the vertices on the triangle of the two-dimensional manifold mesh; for each edge in the triangle, the target energy value of the edge is calculated based on the first energy value, second energy value, third energy value and fourth energy value of the edge; an energy value list is generated according to the target energy value of each edge in the triangle of the two-dimensional manifold mesh, and the energy value list is obtained by calculating the color information, texture information and normal information of the vertex, which can effectively improve the accuracy of simplification of the two-dimensional manifold mesh.
[0119] In one embodiment, Figure 9 As shown, the attribute information includes texture information; before simplifying the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, steps 322 to 326 are also included:
[0120] S322: Determine the texture boundary of the triangular facets of the non-two-dimensional manifold mesh according to the texture information of the vertices on the triangular facets.
[0121] Among them, the texture information can be the texture coordinates of each vertex in the triangle of the two-dimensional manifold mesh. The texture boundary of the triangle of the non-two-dimensional manifold mesh can be determined based on the texture coordinates of each vertex in the triangle of the two-dimensional manifold mesh. For example, for the points where the texture coordinates of each vertex in the triangle of the two-dimensional manifold mesh are (0, 0), (0, 1), (1, 0) and (1, 1), the above points can be marked to determine the texture boundary of the triangle of the non-two-dimensional manifold mesh.
[0122] S324. Determine the position boundaries of the triangular facets of the non-two-dimensional manifold mesh according to the position information of the vertices on the triangular facets.
[0123] Among them, the position information can be the geometric coordinates of each vertex in the triangular patch of the two-dimensional manifold mesh. According to the geometric coordinates of each vertex in the triangular patch of the two-dimensional manifold mesh, the position boundary of the triangular patch of the non-two-dimensional manifold mesh can be determined. For example, for the points whose geometric coordinates of each vertex in the triangular patch of the two-dimensional manifold mesh are (32, 2), (54, 38), (23, 4) and (44, 67), the above points can be marked to determine the position boundary of the triangular patch of the non-two-dimensional manifold mesh.
[0124] S326 , removing texture boundaries and position boundaries from the edge to be simplified to generate a new edge to be simplified.
[0125] Specifically, edges corresponding to texture boundaries and edges corresponding to position boundaries are removed from the edges to be simplified, thereby generating new edges to be simplified. The new edges to be simplified do not include texture boundaries and position boundaries.
[0126] In an embodiment of the present application, the attribute information includes texture information; before simplifying the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, the method further includes: determining the texture boundaries of the triangular facets of the non-two-dimensional manifold mesh based on the texture information of the vertices on the triangular facets; determining the position boundaries of the triangular facets of the non-two-dimensional manifold mesh based on the position information of the vertices on the triangular facets; and removing the texture boundaries and position boundaries from the edges to be simplified to generate new edges to be simplified. By determining the texture boundaries and position boundaries of the triangular facets of the two-dimensional manifold mesh, the problems of boundary deformation and color stretching during the network simplification process can be effectively solved.
[0127] In a specific embodiment, Figure 10 As shown, a three-dimensional model simplification method includes steps 401 to 4:
[0128] S401, obtaining target information of vertices on triangular facets in the initial three-dimensional model; the target information includes position information and attribute information of the vertices;
[0129] S402, traversing all triangular facets in the initial three-dimensional model, extracting common points from the triangular facets based on the geometric coordinate information of the vertices on the triangular facets; determining the mesh type of the triangular facets based on the common points; the mesh type includes a two-dimensional manifold mesh and a non-two-dimensional manifold mesh;
[0130] S403, determining common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh based on the common points;
[0131] S404: Determine the texture boundary of the triangle of the non-two-dimensional manifold mesh based on the texture information of the vertices on the triangle; determine the position boundary of the triangle of the non-two-dimensional manifold mesh based on the position information of the vertices on the triangle; and remove the texture boundary and the position boundary from the edge to be simplified to generate a new edge to be simplified.
[0132] S405, calculating a first energy value of each edge in the triangle according to geometric coordinate information of vertices on the triangle of the two-dimensional manifold mesh; calculating a second energy value of each edge in the triangle according to color information of the vertices on the triangle of the two-dimensional manifold mesh; calculating a third energy value of each edge in the triangle according to texture information of the vertices on the triangle of the two-dimensional manifold mesh; and calculating a fourth energy value of each edge in the triangle according to normal information of the vertices on the triangle of the two-dimensional manifold mesh.
[0133] S406. For each edge in the triangular patch, calculate a target energy value of the edge based on the first energy value, the second energy value, the third energy value, and the fourth energy value of the edge; and generate an energy value list according to the target energy value of each edge in the triangular patch of the two-dimensional manifold mesh.
[0134] S407: Determine the minimum target energy value from the energy value list, collapse the edge to be simplified corresponding to the minimum target energy value, and generate a new edge to replace the edge to be simplified;
[0135] S408, updating the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh based on the new edge, recalculating a new target energy value of each edge in the updated topological relationship, and generating a new energy value list based on the new target energy value of each edge;
[0136] S409, determining whether the new target energy value of each edge is greater than or equal to a preset energy value threshold;
[0137] S410: If yes, generate simplified triangular facets based on the updated topological relationship and execute step 414;
[0138] S411: If the new target energy value of each edge is less than the preset energy value threshold, then loop through steps 412 to 413;
[0139] S412: Determine the minimum target energy value from the new energy value list, collapse the edge to be simplified corresponding to the minimum energy value, and generate a new edge to replace the edge to be simplified;
[0140] S413: updating the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh based on the new edge, recalculating the target energy value of each edge in the updated topological relationship, and generating a new energy value list based on the new target energy value of each edge; executing step 414 until the target energy value of each edge in the updated topological relationship is greater than or equal to a preset energy value threshold, and a simplified triangular patch is generated based on the updated topological relationship of each edge;
[0141] S414, obtaining triangular patches of the non-two-dimensional manifold mesh; based on the position information of the triangular patches of the non-two-dimensional manifold mesh, splicing the triangular patches of the non-two-dimensional manifold mesh with the simplified triangular patches to generate a simplified three-dimensional model.
[0142] It should be understood that, although the various steps in the above-mentioned flow chart are shown in sequence according to the instructions of the arrows, these steps are not necessarily performed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned flow chart may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0143] In one embodiment, Figure 11 As shown, a three-dimensional model simplification device 500 is provided, comprising: a target information acquisition module 520, a mesh type determination module 540, a mesh simplification module 560 and a three-dimensional model construction module 580, wherein:
[0144] The target information acquisition module 520 is used to obtain target information of vertices on the triangular facets in the initial three-dimensional model; the target information includes the position information and attribute information of the vertices;
[0145] A mesh type determination module 540 is configured to traverse all triangular facets in the initial three-dimensional model and determine the mesh type of the triangular facets based on target information of the vertices on the triangular facets; the mesh types include two-dimensional manifold meshes and non-two-dimensional manifold meshes;
[0146] A mesh simplification module 560 is configured to determine common edges between triangular patches of a two-dimensional manifold mesh and triangular patches of a non-two-dimensional manifold mesh, and to simplify the edges to be simplified in the triangular patches of the two-dimensional manifold mesh to generate simplified triangular patches; the edges to be simplified include edges of the triangular patches of the two-dimensional manifold mesh excluding the common edges;
[0147] The three-dimensional model construction module 580 is used to construct a simplified three-dimensional model based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh.
[0148] In one embodiment, Figure 12 As shown, the grid type determination module 540 includes a common point extraction unit 542 and a grid type determination unit 544, wherein:
[0149] A common point extraction unit 542 is used to extract common points from the triangular facets based on the geometric coordinate information of the vertices on the triangular facets;
[0150] The mesh type determining unit 544 is configured to determine the mesh type of the triangular patch according to the common points.
[0151] In one embodiment, Figure 13 As shown, the mesh simplification module 560 includes a common edge determination unit 462, a to-be-simplified edge determination unit 564, and a to-be-simplified edge collapse unit 566, wherein:
[0152] a common edge determining unit 562 for determining common edges between triangular patches of a two-dimensional manifold mesh and triangular patches of a non-two-dimensional manifold mesh based on common points;
[0153] A to-be-simplified edge determination unit 564 is configured to remove edges other than common edges from the triangular facets of the two-dimensional manifold mesh as to-be-simplified edges;
[0154] The edge collapse unit 566 is used to collapse the edges to be simplified in the triangular patch of the two-dimensional manifold mesh, update the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh, and generate simplified triangular patches based on the updated topological relationship of each edge.
[0155] In one embodiment, the edge collapse unit 566 is further configured to calculate the target energy value of each edge in the triangular face of the two-dimensional manifold mesh according to the position information and attribute information of the vertices on the triangular face of the two-dimensional manifold mesh to generate an energy value list;
[0156] Determine the minimum target energy value from the energy value list, collapse the edge to be simplified corresponding to the minimum target energy value, and generate a new edge to replace the edge to be simplified;
[0157] Based on the new edges, the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh is updated, and the new target energy value of each edge in the updated topological relationship is recalculated, and a new energy value list is generated based on the new target energy value of each edge;
[0158] Determine whether the new target energy value of each edge is greater than or equal to the preset energy value threshold;
[0159] If so, a simplified triangular patch is generated based on the updated topological relationship.
[0160] In one embodiment, the edge to be simplified collapse unit 566 is further configured to loop through the following operations if the new target energy value of each edge is less than a preset energy value threshold;
[0161] Determine the minimum target energy value from the new energy value list, collapse the edge to be simplified corresponding to the minimum energy value, and generate a new edge to replace the edge to be simplified;
[0162] The topological relationship of each edge in the triangular facet of the two-dimensional manifold mesh is updated based on the new edge, and the target energy value of each edge in the updated topological relationship is recalculated, and a new energy value list is generated based on the new target energy value of each edge; until the target energy value of each edge in the updated topological relationship is greater than or equal to the preset energy value threshold, a simplified triangular facet is generated based on the updated topological relationship of each edge.
[0163] In one embodiment, the edge collapse unit 566 is further configured to calculate a first energy value of each edge in a triangle patch according to geometric coordinate information of vertices on the triangle patch of the two-dimensional manifold mesh; calculate a second energy value of each edge in the triangle patch according to color information of the vertices on the triangle patch of the two-dimensional manifold mesh; calculate a third energy value of each edge in the triangle patch according to texture information of the vertices on the triangle patch of the two-dimensional manifold mesh; and calculate a fourth energy value of each edge in the triangle patch according to normal information of the vertices on the triangle patch of the two-dimensional manifold mesh.
[0164] For each edge in the triangle patch, calculate a target energy value of the edge based on the first energy value, the second energy value, the third energy value, and the fourth energy value of the edge;
[0165] Generates a list of energy values based on target energy values for each edge in a triangle patch of a 2D manifold mesh.
[0166] In one embodiment, Figure 14 As shown, the 3D model simplification apparatus 500 further includes a texture boundary determination module 620, a position boundary determination module 640, and a to-be-simplified edge generation module 660, wherein:
[0167] A texture boundary determination module 620 is configured to determine the texture boundary of a triangular facet of a non-two-dimensional manifold mesh based on texture information of vertices on the triangular facet;
[0168] A position boundary determination module 640 is used to determine the position boundary of the triangular facets of the non-two-dimensional manifold mesh based on the position information of the vertices on the triangular facets;
[0169] The edge-to-be-simplified generation module 660 is configured to remove texture boundaries and position boundaries from the edge-to-be-simplified to generate a new edge-to-be-simplified.
[0170] The specific definition of the 3D model simplification device can be found in the definition of the 3D model simplification method above and will not be repeated here. The various modules in the above-mentioned 3D model simplification device can be implemented in whole or in part through software, hardware, or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each of the above modules.
[0171] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 15 As shown. The computer device includes a processor, a memory and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store edge-side data acquisition data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a three-dimensional model simplification method is implemented.
[0172] Those skilled in the art will understand that Figure 15 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0173] The present application also provides a computer-readable storage medium, one or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, cause the processors to perform the steps of the three-dimensional model simplification method.
[0174] A computer program product comprising instructions, when executed on a computer, causes the computer to perform a three-dimensional model simplification method.
[0175] Any reference to memory, storage, database or other media used in the embodiments of the present application may include non-volatile and / or volatile memory. Suitable non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0176] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0177] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A three-dimensional model simplification method, characterized in that: The method comprises: Acquire target information of vertices on triangular facets in the initial three-dimensional model; the target information includes position information and attribute information of the vertices; Traversing all triangular facets in the initial three-dimensional model, and determining a mesh type of the triangular facet according to target information of vertices on the triangular facet; the mesh type includes a two-dimensional manifold mesh and a non-two-dimensional manifold mesh; determining common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, simplifying the edges to be simplified in the triangular patches of the two-dimensional manifold mesh to generate simplified triangular patches; the edges to be simplified include edges other than the common edges from the triangular patches of the two-dimensional manifold mesh; A simplified three-dimensional model is constructed based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh.
2. The method according to claim 1, characterized in that The position information includes geometric coordinate information; and determining the mesh type of the triangular facet according to the target information of the vertices on the triangular facet includes: Extracting common points from the triangular facets according to geometric coordinate information of vertices on the triangular facets; The mesh type of the triangular facet is determined according to the common point.
3. The method according to claim 2, characterized in that The determining of common edges between the triangular facets of the two-dimensional manifold mesh and the triangular facets of the non-two-dimensional manifold mesh, simplifying the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, and generating simplified triangular facets includes: Determining a common edge between a triangular face of the two-dimensional manifold mesh and a triangular face of the non-two-dimensional manifold mesh according to the common point; removing edges other than the common edges from the triangular facets of the two-dimensional manifold mesh as the edges to be simplified; The edges to be simplified in the triangular facets of the two-dimensional manifold mesh are collapsed, the topological relationship of each edge in the triangular facets of the two-dimensional manifold mesh is updated, and simplified triangular facets are generated based on the updated topological relationship of each edge.
4. The method according to claim 3, characterized in that The collapsing the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, updating the topological relationship of the edges in the triangular facets of the two-dimensional manifold mesh, and generating simplified triangular facets based on the updated topological relationship of the edges, comprises: Calculating target energy values of each edge in the triangular patch of the two-dimensional manifold mesh according to position information and attribute information of vertices on the triangular patch of the two-dimensional manifold mesh to generate an energy value list; Determining a minimum target energy value from the energy value list, collapsing the edge to be simplified corresponding to the minimum target energy value, and generating a new edge for replacing the edge to be simplified; updating the topological relationship of each edge in the triangular patch of the two-dimensional manifold mesh based on the new edge, recalculating a new target energy value of each edge in the updated topological relationship, and generating a new energy value list based on the new target energy value of each edge; Determining whether the new target energy value of each edge is greater than or equal to a preset energy value threshold; If so, a simplified triangular facet is generated based on the updated topological relationship.
5. The method according to claim 4, characterized in that After determining whether the new target energy value of each edge is greater than or equal to a preset energy value threshold, the method further includes: If the new target energy value of each edge is less than the preset energy value threshold, the following operations are performed in a loop; Determining a minimum target energy value from the new energy value list, collapsing the edge to be simplified corresponding to the minimum target energy value, and generating a new edge for replacing the edge to be simplified; Based on the new edges, the topological relationship of each edge in the triangular facet of the two-dimensional manifold mesh is updated, and the target energy value of each edge in the updated topological relationship is recalculated, and a new energy value list is generated based on the new target energy value of each edge; until the target energy value of each edge in the updated topological relationship is greater than or equal to the preset energy value threshold, a simplified triangular facet is generated based on the updated topological relationship of each edge.
6. The method according to claim 4, characterized in that The attribute information further includes color information, texture information, and normal information of the vertex; and calculating the target energy value of each edge in the triangular facet of the two-dimensional manifold mesh based on the position information and attribute information of the vertices on the triangular facet of the two-dimensional manifold mesh to generate an energy value list, including: Calculating a first energy value of each edge in the triangle according to geometric coordinate information of the vertices on the triangle of the two-dimensional manifold mesh; calculating a second energy value of each edge in the triangle according to color information of the vertices on the triangle of the two-dimensional manifold mesh; calculating a third energy value of each edge in the triangle according to texture information of the vertices on the triangle of the two-dimensional manifold mesh; and calculating a fourth energy value of each edge in the triangle according to normal information of the vertices on the triangle of the two-dimensional manifold mesh. For each edge in the triangular patch, calculating a target energy value of the edge based on the first energy value, the second energy value, the third energy value, and the fourth energy value of the edge; An energy value list is generated according to target energy values of each edge in a triangular patch of the two-dimensional manifold mesh.
7. The method according to claim 1, characterized in that The attribute information includes texture information; and before simplifying the edges to be simplified in the triangular facets of the two-dimensional manifold mesh, the method further includes: Determining a texture boundary of a triangular face of the non-two-dimensional manifold mesh according to texture information of vertices on the triangular face; Determining the position boundaries of the triangular facets of the non-two-dimensional manifold mesh according to the position information of the vertices on the triangular facets; The texture boundary and the position boundary are removed from the edge to be simplified to generate a new edge to be simplified.
8. A three-dimensional model simplification device, characterized in that: The device comprises: A target information acquisition module is used to acquire target information of vertices on triangular facets in the initial three-dimensional model; the target information includes position information and attribute information of the vertices; A mesh type determination module, configured to traverse all triangular facets in the initial three-dimensional model and determine the mesh type of the triangular facets according to target information of vertices on the triangular facets; the mesh type includes a two-dimensional manifold mesh and a non-two-dimensional manifold mesh; a mesh simplification module, configured to determine common edges between the triangular patches of the two-dimensional manifold mesh and the triangular patches of the non-two-dimensional manifold mesh, simplify the edges to be simplified in the triangular patches of the two-dimensional manifold mesh, and generate simplified triangular patches; the edges to be simplified include edges other than the common edges from the triangular patches of the two-dimensional manifold mesh; A three-dimensional model construction module is used to construct a simplified three-dimensional model based on the simplified triangular facets and the triangular facets of the non-two-dimensional manifold mesh.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Transformer substation modeling method and device, computer equipment and storage medium
CN110544298A
Three-dimensional model simplifying method based on visual feature measurement
CN1866299A