Three-dimensional model simplification method and device, computer equipment and storage medium
By voxelizing, feature vertex determination and normal refinement of the three-dimensional model, combined with grid reconstruction or vertex merging, the problems of loss of details and waste of resources in the simplification process of the three-dimensional model are solved, and efficient simplification of the three-dimensional model is achieved.
Patent Information
- Application Number
- CN202510285995.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, there are problems of loss of detailed features and limited simplification in the process of simplification of three-dimensional models, resulting in wasted computing resources.
By voxelizing the original three-dimensional model, the feature vertices and region division are determined, normal refinement is performed, and grid reconstruction or vertex merging is performed to generate a simplified three-dimensional model.
While retaining the detailed characteristics of the three-dimensional model, it realizes effective simplification of the model and reduces the demand for computing resources.
Smart Images

Figure CN120339501A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a three-dimensional model simplification method, apparatus, computer device, and storage medium. Background Art
[0002] With the development of computer technology, it is currently possible to virtualize objects in the real world to generate virtual three-dimensional objects. For example, by using related devices to photograph and scan objects in the real world to obtain three-dimensional data of the objects, and then generating a three-dimensional model corresponding to the objects through the three-dimensional data. However, the three-dimensional models obtained in this way may have problems such as large amounts of data and mesh topology errors. Therefore, it is necessary to simplify the three-dimensional models to obtain simplified three-dimensional models in order to save computing resources.
[0003] In related technologies, by analyzing the three-dimensional model to be simplified, identifying and distinguishing core structural features from non-core features, and then according to the lightweight criterion, performing reduction measures on the non-core features. However, such an approach may result in the loss of detail features in the finally generated simplified three-dimensional model compared with the three-dimensional model to be simplified, and the degree of simplification of the three-dimensional model to be simplified is limited. Summary of the Invention
[0004] Embodiments of this application provide a three-dimensional model simplification method, apparatus, computer device, and storage medium, which can simplify the original three-dimensional model, and the detail features of the three-dimensional model can be retained in the simplified target three-dimensional model.
[0005] To achieve the above object, on the one hand, an embodiment of this application provides a three-dimensional model simplification method, including:
[0006] Obtain an original three-dimensional model, and perform voxelization processing on the original three-dimensional model to obtain a voxelized three-dimensional model;
[0007] Determine a first three-dimensional model including a plurality of vertices according to the voxelized three-dimensional model;
[0008] Perform region division on the first three-dimensional model to obtain a plurality of local regions, and determine characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region;
[0009] Construct a second three-dimensional model according to the characteristic vertices and the vertices in the first three-dimensional model, and perform normal refinement processing on the normal of each triangular face in the second three-dimensional model to obtain a target second three-dimensional model;
[0010] Perform mesh reconstruction processing on the target second three-dimensional model or perform vertex merging processing on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model.
[0011] To achieve the above object, on the one hand, an embodiment of the present application provides a three-dimensional model simplification device, including:
[0012] An acquisition module, configured to acquire an original three-dimensional model and perform voxelization processing on the original three-dimensional model to obtain a voxelized three-dimensional model;
[0013] A determination module, configured to determine a first three-dimensional model including a plurality of vertices according to the voxelized three-dimensional model;
[0014] A division module, configured to divide the first three-dimensional model into a plurality of local regions, and determine characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region;
[0015] A composition module, configured to form a second three-dimensional model according to the characteristic vertices and the vertices in the first three-dimensional model, and perform normal refinement processing on the normal of each triangular face in the second three-dimensional model to obtain a target second three-dimensional model;
[0016] A simplification module, configured to perform mesh reconstruction processing on the target second three-dimensional model or perform vertex merging processing on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model.
[0017] In some embodiments, the division module is configured to:
[0018] Subtract the vertex position of each vertex in each local region from the expected position of the characteristic vertex corresponding to each local region to obtain a position deviation result corresponding to each vertex in each local region;
[0019] Multiply the position deviation result corresponding to each vertex in each local region by the vertex normal direction corresponding to each vertex in each local region to obtain a first calculation result;
[0020] Add the squared values of the first calculation results corresponding to each vertex in each local region to obtain a second calculation result;
[0021] Adjust the expected position to reduce the second calculation result, and when the second calculation result is the smallest, generate the characteristic vertices corresponding to each local region at the expected position corresponding to the smallest second calculation result.
[0022] In some embodiments, the composition module is configured to:
[0023] Perform initialization processing on the normal of each triangular face in the second three-dimensional model to obtain an initialized normal of each triangular face;
[0024] Determine the spatial distance weight and normal proximity weight between adjacent triangular faces in the second 3D model;
[0025] Perform weighted average refinement on the initialized normal vectors of each triangular face in the adjacent triangular faces according to the spatial distance weight and the normal proximity weight to obtain the target second 3D model.
[0026] In some embodiments, a composition module is configured to:
[0027] Determine target feature vertices located in the convex region of the first 3D model among the feature vertices;
[0028] Construct a second 3D model based on the target feature vertices and the vertices in the first 3D model.
[0029] In some embodiments, the simplification module includes a first simplification sub-module and a second simplification sub-module. The first simplification sub-module is configured to:
[0030] Determine the target image quality gap between the original 3D model and the target second 3D model under multiple preset viewpoints;
[0031] Determine the unit normal vector corresponding to each vertex in the target second 3D model, and determine the curvature along the adjacent vertices according to the unit normal vector corresponding to each vertex;
[0032] Determine the area and plane matrix corresponding to each triangular face associated with each vertex;
[0033] Determine the quadratic error measurement matrix corresponding to each vertex according to the target image quality gap, the curvature, the area, and the plane matrix;
[0034] Perform vertex merging processing on the vertices in the target second 3D model according to the quadratic error measurement matrix to generate a simplified target 3D model.
[0035] In some embodiments, the first simplification sub-module is configured to:
[0036] Obtain the first image of the original 3D model at each preset viewpoint and the second image of the target second 3D model at each preset viewpoint;
[0037] Determine the image quality gap between the first image and the second image corresponding to each preset viewpoint;
[0038] Determine the target image quality gap between the original 3D model and the target second 3D model according to the image quality gap corresponding to each preset viewpoint.
[0039] In some embodiments, the first simplification sub-module is configured to:
[0040] Determine the associated vertices corresponding to each vertex in the associated triangular faces in the target second three-dimensional model;
[0041] Determine the direction vectors between each vertex and each associated vertex, and determine the normal vectors of the triangular faces associated with each vertex according to the direction vectors;
[0042] Determine the unit normal vectors corresponding to each vertex according to the normal vectors of the triangular faces associated with each vertex.
[0043] In some embodiments, the first simplification sub-module is configured to:
[0044] Multiply the unit normal vector corresponding to each vertex by the direction vector between each vertex and each associated vertex and then multiply by two to obtain a multiplication result;
[0045] Divide the multiplication result by the norm corresponding to the direction vector to obtain the curvature along the adjacent vertices determined by the unit normal vector corresponding to each vertex.
[0046] In some embodiments, the second simplification sub-module is configured to:
[0047] Obtain the contour surfaces corresponding to the target second three-dimensional model under multiple viewpoints;
[0048] Generate a plurality of voxels in three-dimensional space, and determine the target vertices corresponding to the plurality of voxels on the contour surface;
[0049] Construct an outer shell three-dimensional model corresponding to the target second three-dimensional model according to the target vertices;
[0050] Perform mesh reconstruction processing on the outer shell three-dimensional model to obtain a simplified target three-dimensional model.
[0051] In some embodiments, the second simplification sub-module is configured to:
[0052] Perform octree partitioning according to the target vertices corresponding to the plurality of voxels on the contour surface to obtain a plurality of updated voxels;
[0053] Determine the target vertices corresponding to the plurality of updated voxels on the contour surface, and return to perform octree partitioning according to the target vertices corresponding to the plurality of voxels on the contour surface until a preset partitioning number is reached, to obtain the target vertices corresponding to the plurality of voxels on the contour surface.
[0054] In some embodiments, the second simplification sub-module is configured to:
[0055] Reconstruct multiple triangular meshes on the three-dimensional model of the housing to obtain a three-dimensional model to be selected;
[0056] Determine the similarity corresponding to multiple viewing directions in a preset image space between the three-dimensional model to be selected and the original three-dimensional model;
[0057] When the similarity does not meet the preset condition, adjust multiple triangular meshes of the three-dimensional model to be selected to obtain an updated three-dimensional model to be selected until the similarity corresponding to multiple viewing directions in the preset image space between the updated three-dimensional model to be selected and the original three-dimensional model meets the preset condition, then obtain a simplified target three-dimensional model.
[0058] To achieve the above object, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the three-dimensional model simplification method provided by the embodiment of the present application.
[0059] To achieve the above object, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor implements the three-dimensional model simplification method provided by the embodiment of the present application when executing the computer program.
[0060] In the embodiment of the present application, by obtaining an original three-dimensional model and performing voxelization processing on the original three-dimensional model to obtain a voxelized three-dimensional model; determining a first three-dimensional model including multiple vertices according to the voxelized three-dimensional model; dividing the first three-dimensional model into multiple local regions, and determining characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region; forming a second three-dimensional model according to the characteristic vertices and the vertices in the first three-dimensional model, and performing normal refinement processing on the normal of each triangular face in the second three-dimensional model to obtain a target second three-dimensional model; performing mesh reconstruction processing on the target second three-dimensional model or performing vertex merging processing on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model.
[0061] Therefore, first voxelize the original 3D model, and then construct a first 3D model composed of triangular faces formed by multiple vertices from the voxelized 3D model to realize the reconstruction of the original 3D model. Then, divide the first 3D model into multiple local regions, and determine the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region. The characteristic vertices are used to enhance the details of some key regions. Then, form a second 3D model based on the characteristic vertices and the vertices in the first 3D model, and perform normal refinement processing on the normal of each triangular face in the second 3D model to obtain the target second 3D model. Through the normal refinement processing, the microscopic geometric structure of the object surface can be described more accurately, and the enhancement of detail features can be realized. Finally, perform mesh reconstruction processing on the target second 3D model or perform vertex merging processing on the vertices in the target second 3D model to generate a simplified target 3D model, thereby realizing the simplification of the original 3D model. Compared with the technical solution in the related art of identifying and distinguishing core structural features and non-core features, and then performing reduction measures on the non-core features according to the lightweight criterion, the target 3D model obtained by the solution in this application not only contains the detail features of some regions of the original 3D model, but also can simplify the original 3D model to the degree required for simplification.
[0062] Other features and advantages of this application will be described in the subsequent specification, and, in part, will become obvious from the specification, or will be understood by implementing this application. The objectives and other advantages of this application can be achieved and obtained through the structures specifically pointed out in the specification, claims, and drawings. Brief Description of the Drawings
[0063] In order to more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of this application. For those skilled in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0064] Figure 1 It is a schematic diagram of the system framework corresponding to the 3D model simplification method provided by the embodiment of this application;
[0065] Figure 2 It is a schematic diagram of the scenario of the 3D model simplification method provided by the embodiment of this application;
[0066] Figure 3 It is a schematic flowchart of the 3D model simplification method provided by the embodiment of this application;
[0067] Figure 4 It is a schematic flowchart of the simplification of the target second 3D model provided by the embodiment of this application;
[0068] Figure 5 It is a schematic diagram of the first image provided by an embodiment of the present application;
[0069] Figure 6 It is a schematic diagram of vertex merging provided by an embodiment of the present application;
[0070] Figure 7 It is a schematic flow diagram of simplifying a target second three-dimensional model provided by an embodiment of the present application;
[0071] Figure 8 It is a schematic diagram of the target three-dimensional model provided by an embodiment of the present application;
[0072] Figure 9 It is another schematic flow diagram of a three-dimensional model simplification method provided by an embodiment of the present application;
[0073] Figure 10 It is a schematic structural diagram of a three-dimensional model simplification device provided by an embodiment of the present application;
[0074] Figure 11 It is a schematic structural diagram of a computer device provided by an embodiment of the present application. Detailed Implementation Manner
[0075] In order to enable those skilled in the art of the present technology to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present application.
[0076] It should be noted that in the specific implementation manner of the present application, when it comes to data related to three-dimensional models, when the above embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards.
[0077] It should be noted that in some processes described in the specification, claims, and the above-mentioned drawings, there are multiple steps that appear in a specific order. However, it should be clearly understood that these steps may not be executed in the order in which they appear in this article or may be executed in parallel. The step numbers are only used to distinguish different steps, and the numbers themselves do not represent any execution order. In addition, descriptions such as "first", "second", or "target" in this article are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence.
[0078] This application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer computer devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This application can also be practiced in a distributed computing environment, where tasks are executed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0079] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described. The nouns and terms involved in the embodiments of the present application are applicable to the following explanations:
[0080] Normal: A normal is a vector. For a plane in three-dimensional space, the normal vector is perpendicular to the plane. Its direction is determined by the right-hand rule. For example, for a surface composed of triangular patches, if the order of the triangle vertices (assuming counterclockwise) is used to determine, bend the thumb of the right hand along this order, then the direction pointed by the thumb is the normal direction of the plane.
[0081] Normal Refinement: It refers to a more refined processing operation on the normal of the model surface. Usually, based on the existing normal data, various algorithms and techniques are used to improve the accuracy and detail level of the normal.
[0082] Vertex: In a three-dimensional model, a triangular face is a planar geometric shape determined by three vertices. The vertices of a triangular face refer to the three points that make up the triangular patch. These vertices have their respective coordinates in three-dimensional space.
[0083] Triangle Face: A triangle face in a three-dimensional model is a planar geometric figure determined by three non-collinear vertices in three-dimensional space. It is the most basic polygon unit in three-dimensional modeling.
[0084] Voxelization is a process of converting a geometric object (such as a three-dimensional model) into a voxel representation. A voxel is a volume element in three-dimensional space, similar to a pixel in a two-dimensional image.
[0085] An isosurface is a surface formed by all points with the same scalar value in a three-dimensional spatial data field.
[0086] The above is an explanation of the relevant terminological concepts regarding 3D models in this application. If other concepts are involved, they will be described later.
[0087] First, describe the technical problems existing in the related art:
[0088] With the development of computer technology, it is currently possible to virtualize objects in the real world, thereby generating virtual 3D objects. For example, by using relevant devices to photograph and scan an object in the real world to obtain the 3D data of the object, and then generating the corresponding 3D model of the object based on the 3D data. However, the 3D models obtained in this way will have problems such as large amounts of data and mesh topology errors. Therefore, it is necessary to simplify the 3D model to obtain a simplified 3D model in order to save computing resources.
[0089] In the related art, by analyzing the 3D model to be simplified, identifying and distinguishing the core structural features from the non-core features, and then according to the lightweight criterion, performing reduction measures on the non-core features. However, such an approach may result in the loss of detailed features in the finally generated simplified 3D model compared to the 3D model to be simplified, and the degree of simplification of the 3D model to be simplified is limited.
[0090] Therefore, there are technical problems in the related art that the 3D model to be simplified cannot be effectively simplified, and the simplified 3D model has details lost.
[0091] For example, the original 3D model is a building, which contains windows, curtains, and glass. After being simplified by the related technology, the simplified 3D model has lost the features of windows, curtains, and glass.
[0092] In order to solve the above problems, embodiments of the present application voxelize the original three-dimensional model, and then construct a first three-dimensional model composed of triangular faces formed by multiple vertices through the voxelized three-dimensional model to realize the reconstruction of the original three-dimensional model. Then, the first three-dimensional model is divided into multiple local regions, and the characteristic vertices corresponding to each local region are determined according to the vertex positions and vertex normal directions of each local region. The characteristic vertices are used to enhance the details of some key regions. Then, a second three-dimensional model is formed by the characteristic vertices and the vertices in the first three-dimensional model, and the normal vectors of each triangular face in the second three-dimensional model are refined to obtain the target second three-dimensional model. Through the normal vector refinement process, the microscopic geometric structure of the object surface can be described more accurately, and the enhancement of detail features can be realized. Finally, mesh reconstruction processing is performed on the target second three-dimensional model or vertex merging processing is performed on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model, thereby realizing the simplification of the original three-dimensional model. Compared with the technical solution in the related art that identifies and distinguishes core structural features and non-core features, and then performs reduction measures on non-core features according to the lightweight criterion, the target three-dimensional model obtained by the solution in the present application not only contains the detail features of some regions of the original three-dimensional model, but also can simplify the original three-dimensional model to the degree that needs to be simplified.
[0093] Specifically, the content of the three-dimensional model simplification method, device, computer device, and storage medium provided by the embodiments of the present application will be described in detail below.
[0094] Please refer to Figure 1 , Figure 1 which is a schematic diagram of the system framework corresponding to the three-dimensional model simplification method provided by the embodiments of the present application. The three-dimensional model simplification method provided by the embodiments of the present application can be applied to this system framework.
[0095] It includes a terminal 140, the Internet 130, a gateway 120, a server 110, etc.
[0096] The terminal 140 or the server 110 can be a device that executes the three-dimensional model simplification method.
[0097] The terminal 140 includes, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. Embodiments of the present application can be applied to various scenarios, including but not limited to three-dimensional reconstruction, virtual city building group generation, etc. In addition, it can be a single device or a collection of multiple devices combined. For example, multiple desktop computers are connected to each other through a local area network and share a monitor, etc. to work together, jointly constituting a terminal 140. The terminal 140 can communicate with the Internet 130 in a wired or wireless manner to exchange data.
[0098] Server 110 refers to a computer system that can provide certain services to terminal 140. Compared with ordinary terminal 140, server 110 has higher requirements in terms of stability, security, performance, etc. Server 110 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0099] The gateway 120 is also called an internetwork connector and a protocol converter. The gateway realizes network interconnection at the transport layer and is a computer system or device that acts as a converter. Between two systems that use different communication protocols, data formats or languages, and even have completely different architectures, the gateway is a translator. At the same time, the gateway can also provide filtering and security functions. The message sent by terminal 140 to server 110 needs to be sent to the corresponding server 110 through gateway 120. The message sent by server 110 to terminal 140 also needs to be sent to the corresponding terminal 140 through gateway 120.
[0100] The three-dimensional model simplification method in the embodiments of this application can be applied to various scenarios, such as three-dimensional reconstruction, virtual city building complex generation and other scenarios. This does not limit the scenarios to which the three-dimensional model simplification method in this application is applied.
[0101] Please refer to Figure 2 , Figure 2 which is a schematic diagram of the scenario of the three-dimensional model simplification method provided by the embodiments of this application.
[0102] Among them, the original three-dimensional model can be a three-dimensional model generated by shooting an object in the real world with a device to obtain shooting data, such as a three-dimensional model generated from point cloud data. The original three-dimensional model is similar to the object in the real world. For example, if the object in the real world is a building, then the shape of the original three-dimensional model is similar to the shape of the building.
[0103] However, the original three-dimensional model has a large amount of data. For example, it has a large number of vertices and multiple triangular faces formed by multiple vertices. This will occupy a large amount of storage space of the computer device, and when the computer device renders the original three-dimensional model, it requires a lot of computing power. If it is necessary to render a city building complex composed of multiple original three-dimensional models, the computing pressure on the computer device is very large.
[0104] Therefore, it is necessary to simplify the original three-dimensional model to obtain a simplified three-dimensional model with fewer vertices and fewer triangular faces. In the present application, the original three-dimensional model can be obtained first, and the original three-dimensional model can be voxelized to obtain a voxelized three-dimensional model. Then, a first three-dimensional model composed of triangular faces formed by multiple vertices can be constructed through the voxelized three-dimensional model to realize the reconstruction of the original three-dimensional model. Then, the first three-dimensional model is divided into multiple local regions, and the characteristic vertices corresponding to each local region are determined according to the vertex positions and vertex normal directions of each local region. The characteristic vertices are used to enhance the details of some key regions. Then, a second three-dimensional model is formed by the characteristic vertices and the vertices in the first three-dimensional model, and the normal of each triangular face in the second three-dimensional model is refined to obtain the target second three-dimensional model. Through the normal refinement process, the microscopic geometric structure of the object surface can be described more accurately, and the enhancement of detail features can be realized. Finally, a mesh reconstruction process is performed on the target second three-dimensional model or a vertex merging process is performed on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model. The target three-dimensional model obtained by the solution in the present application contains the detail features of some regions of the original three-dimensional model, and at the same time, the original three-dimensional model can be simplified to the required degree.
[0105] Specifically, as Figure 2 shown, where the original three-dimensional model is a building, and the detail areas such as the windows and doors in it are retained in the target three-dimensional model, and the target three-dimensional model is simplified relative to the original three-dimensional model. Therefore, the target three-dimensional model has fewer triangular faces and vertices, and thus will occupy less computing resources.
[0106] To understand the three-dimensional model simplification method provided by the embodiments of the present application in more detail, please refer to Figure 3 , Figure 3 which is a schematic flow chart of the three-dimensional model simplification method provided by the embodiments of the present application. The three-dimensional model simplification method may include the following steps:
[0107] Step 210, obtain the original three-dimensional model, and perform voxelization processing on the original three-dimensional model to obtain a voxelized three-dimensional model;
[0108] Step 220, determine a first three-dimensional model including triangular faces formed by multiple vertices according to the voxelized three-dimensional model;
[0109] Step 230, divide the first three-dimensional model into multiple local regions, and determine the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region;
[0110] Step 240: Construct a second 3D model based on the feature vertices and the vertices in the first 3D model, and perform normal refinement processing on the normal of each triangular face in the second 3D model to obtain the target second 3D model;
[0111] Step 250: Perform mesh reconstruction processing on the target second 3D model or perform vertex merging processing on the vertices in the target second 3D model to generate a simplified target 3D model.
[0112] The following will describe Steps 210 to 250 in detail.
[0113] In Step 210, obtain the original 3D model and perform voxelization processing on the original 3D model to obtain a voxelized 3D model.
[0114] Among them, the original 3D model is a model with a large amount of data, such as having a large number of vertices and triangular faces. The mesh formed by the triangular faces in the original 3D model may have topological errors, resulting in the inability to reflect the detailed features of the object in the real physical world. Therefore, it is necessary to repair the mesh of the original 3D model. First, perform voxelization processing on the original 3D model to obtain a voxelized 3D model.
[0115] Among them, the input original 3D model can be voxelized in a preset space environment. First, the size of the voxel needs to be considered. An overly large voxel may cause the inability to capture the information of some parts of the original 3D model, resulting in the loss of more details. An overly small voxel may cause a large number of triangular faces to form a mesh in the end, which requires a large amount of computing resources. In this application, assuming the given isosurface value is d, then the side length of the voxel is Setting the voxel size in this way can not only ensure capturing the information of some parts of the original 3D model but also ensure that the final mesh formed by triangular faces will not be excessive.
[0116] In Step 220, determine a first 3D model containing multiple vertices based on the voxelized 3D model.
[0117] Among them, the voxelized 3D model is composed of several small cubes (voxels), and each voxel vertex has a specific scalar value. The algorithm processes these voxels one by one and judges their relationship with the given isosurface.
[0118] For each voxel, by comparing the scalar values of its 8 voxel vertices with the given isosurface value, it is determined whether the voxel intersects with the isosurface. If some of the voxel vertex scalar values are greater than the isosurface value and some are less than the isosurface value, then the voxel intersects with the isosurface; if all the voxel vertex scalar values are greater than or all less than the isosurface value, then the voxel is completely outside or inside the isosurface and does not intersect with the isosurface.
[0119] Based on the relative positions of the 8 voxel vertices of a voxel with respect to the isosurface, the state (above or below the isosurface) of each voxel vertex is represented by a binary number. The state combinations of the 8 voxel vertices are combined to form an 8-bit binary number, which is then converted to a decimal number. This decimal number is the index of the voxel.
[0120] Using the pre-constructed lookup table, the triangular face construction method of the isosurface in the voxel is obtained according to the index of the voxel. The lookup table stores the triangular face information corresponding to different voxel states, including the vertex connection order of the triangular faces, etc.
[0121] For the voxels that intersect the isosurface, their edges have intersection points with the isosurface. By means of linear interpolation, according to the scalar values and positions of the two voxel vertices of the edge, as well as the isosurface value, the intersection positions of the isosurface and the edge are calculated. The intersection points at these intersection positions can be considered as the vertices that make up the triangular faces.
[0122] Based on the triangular face construction method obtained from the lookup table and the calculated intersection positions, the intersection points (vertices) are connected to form triangular faces, and these triangular faces constitute the part of the isosurface in the voxel.
[0123] By processing each voxel in the above manner, a plurality of triangular faces are obtained, and these triangular faces constitute the first three-dimensional model.
[0124] In step 230, the first three-dimensional model is divided into multiple local regions, and the characteristic vertices corresponding to each local region are determined according to the vertex positions and vertex normal directions of each local region.
[0125] Among them, the first three-dimensional model can be divided into multiple local regions. For example, these local regions usually adopt geometric shapes with a disk topology structure to provide more degrees of freedom to capture more edge features. Then, the characteristic vertices corresponding to each local region are determined according to the vertex positions and vertex normal directions of each local region, and the characteristic vertices are located within the local region.
[0126] In some embodiments, determining the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region includes:
[0127] (1.1) Subtract the vertex position of each vertex in each local region from the expected position of the characteristic vertex corresponding to each local region to obtain the position deviation result corresponding to each vertex in each local region;
[0128] (1.2) Multiply the position deviation result corresponding to each vertex in each local region by the vertex normal direction corresponding to each vertex in each local region to obtain the first calculation result;
[0129] (1.3) Add the squared values of the first calculation results corresponding to each vertex in each local region to obtain a second calculation result;
[0130] (1.4) Adjust the expected position to reduce the second calculation result, and when the second calculation result is minimized, generate the characteristic vertices corresponding to each local region at the expected position corresponding to the minimum second calculation result.
[0131] Among them, the specific calculation method of the second calculation result is as follows:
[0132] Among them, x is the expected position of the characteristic vertex corresponding to each local region, and p i is the vertex position of each vertex in each local region, is the vertex normal direction corresponding to each vertex in each local region, and i is the representation of the vertex in each local region. Among them, x - p i this term is the first calculation result, and argmin represents taking the minimum value.
[0133] By adjusting the expected position to reduce the second calculation result, and when the second calculation result is minimized, generate the characteristic vertices corresponding to each local region at the expected position corresponding to the minimum second calculation result.
[0134] The advantage of doing this is that the characteristic vertices of each local region in the first 3D model can be determined, and then triangular faces can be constructed through the characteristic vertices, thereby enhancing some detailed features, so that the 3D model obtained based on the triangular faces later can retain the detailed features in the original 3D model. For example, if the original 3D model is a building and the detailed feature is a window, then the 3D model obtained based on the triangular faces constructed by the characteristic vertices later can retain the detailed feature of the window.
[0135] In step 240, a second 3D model is formed according to the characteristic vertices and the vertices in the first 3D model, and the normal vectors of each triangular face in the second 3D model are refined to obtain the target second 3D model.
[0136] Among them, the characteristic vertices and the vertices in the first 3D model can be regarded as the vertices for constructing triangular faces. Multiple triangular faces can be constructed through the characteristic vertices and the vertices in the first 3D model, and then a second 3D model is generated through the multiple triangular faces. Then, the normal vectors of each triangular face in the second 3D model are refined to obtain the target second 3D model.
[0137] In some embodiments, forming a second 3D model according to the characteristic vertices and the vertices in the first 3D model includes:
[0138] (1.1) Determine the target characteristic vertices located in the convex regions in the first 3D model among the characteristic vertices;
[0139] (1.2)Construct a second three-dimensional model based on the target feature vertices and the vertices in the first three-dimensional model.
[0140] Among the feature vertices corresponding to each of the above-mentioned regions, not every vertex can be applied to construct the second three-dimensional model. For example, some feature vertices may be placed in inappropriate positions, resulting in intersections in the mesh generated by the triangular faces, leading to topological errors in the generation of the second three-dimensional model. To solve this problem, each voxel can be subdivided into convex polyhedra, and the feature vertices located inside the corresponding convex polyhedron can be retained as the target feature vertices. The first three-dimensional model can be understood as being composed of voxels, and the convex polyhedron can be understood as corresponding to the protruding regions in the first three-dimensional model.
[0141] For the first three-dimensional model, a feature map can also be extracted from the mesh formed by its triangular faces. The feature map consists of a set of feature curves, and each curve in this set of feature curves is a series of mesh edges with a dihedral angle less than 0°. If a feature curve consists of a number of mesh edges exceeding a set threshold, it is marked as valid. The valid feature curves are considered to contain "true" sharp features that need to be restored. Then, for each isosurface patch, if the generated feature vertices are located on the valid feature curves, these vertices are determined as the target feature vertices.
[0142] The target feature vertices and the vertices in the first three-dimensional model can be considered as the vertices for constructing triangular faces. Finally, multiple triangular faces can be constructed through the target feature vertices and the vertices in the first three-dimensional model, and then the second three-dimensional model can be generated through the multiple triangular faces.
[0143] The advantage of doing this is that the mesh formed by the triangular faces in the generated second three-dimensional model will not show self-intersection phenomena, ensuring the correct mesh topology of the second three-dimensional model.
[0144] In some embodiments, normal refinement processing is performed on the normal vectors of each triangular face in the second three-dimensional model to obtain the target second three-dimensional model, including:
[0145] (2.1) Perform initialization processing on the normal vectors of each triangular face in the second three-dimensional model to obtain the initialized normal vectors of each triangular face;
[0146] (2.2) Determine the spatial distance weight and the normal proximity weight between adjacent triangular faces in the second three-dimensional model;
[0147] (2.3) Perform weighted average refinement processing on the initialized normal vectors of each triangular face in the adjacent triangular faces according to the spatial distance weight and the normal proximity weight to obtain the target second three-dimensional model.
[0148] Among them, for a 3D model, the original normal vectors may not fully represent the details of the 3D model. Through normal vector refinement, the detail expressiveness of the model can be enhanced without increasing the geometric complexity of the 3D model (such as increasing the number of triangular faces).
[0149] The normal vectors of each triangular face in the second 3D model can be initialized to obtain the initialized normal vectors of each triangular face. Taking a certain triangular face as an example, first calculate the vectors of two sides of the triangular face, then calculate the normal vector of the triangular face through vector cross product, and finally normalize the normal vector to obtain the initialized normal vector of the triangular face.
[0150] Then the normal vectors can be refined. For example, first determine the spatial distance weight and normal vector proximity weight between adjacent triangular faces in the second 3D model. The specific calculation method of the spatial distance weight is as follows:
[0151] where α f,f′ is the spatial distance weight between adjacent triangular faces in the second 3D model, α is a non - negative function, C h and C g are the centroids corresponding to two adjacent triangular faces respectively, f and f′ are two adjacent triangular faces, and e is the natural constant. When the distance between adjacent triangular faces increases, the value of the spatial distance weight will rapidly decrease. The adjacent triangular faces in the second 3D model are two triangular faces sharing a vertex.
[0152] The calculation method of the normal vector proximity weight is as follows:
[0153] β f,f′ =e -β(1-cosθ) where β f,f′ is the normal vector proximity weight between adjacent triangular faces in the second 3D model, β is a non - negative function, and cosθ is the angle between the normal vectors of two adjacent triangular faces. When the difference between the two normal vectors is large, the value of the normal vector proximity weight will decrease.
[0154] And smaller spatial distance weight and normal vector proximity weight will inhibit the interaction between two adjacent triangular faces, so that there will be no topological error phenomenon between two adjacent triangular faces.
[0155] Finally, according to the spatial distance weight and normal vector proximity weight, weighted average refinement processing is performed on the initialized normal vectors of each triangular face in the adjacent triangular faces to obtain the target second 3D model. For example, according to the calculated spatial distance weight and normal vector proximity weight, weighted average is performed on the normal vectors of adjacent triangular faces to obtain the refined normal vector corresponding to the common vertex of the adjacent triangular faces.
[0156] As can be seen from the above, in the present application, the details of the second three-dimensional model can be enhanced by refining the normal vectors of the vertices in the second three-dimensional model, while ensuring the correct topological structure of the mesh formed by the triangular faces of the second three-dimensional model, and obtaining the target second three-dimensional model with richer detail features. Compared with the original three-dimensional model, the target second three-dimensional model retains the detail features in the original three-dimensional model, and at the same time, the target second three-dimensional model has watertightness and a correct mesh topological structure. Therefore, based on the target second three-dimensional model for simplification, more effective simplification can be achieved, and it can be ensured that the detail features corresponding to the original three-dimensional model are retained during the simplification process.
[0157] In step 250, a mesh reconstruction process is performed on the target second three-dimensional model or a vertex merging process is performed on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model.
[0158] Among them, during the process of simplifying the target second three-dimensional model, corresponding simplification methods can be selected according to different degrees of simplification required. For example, if the original three-dimensional model is a 100% accuracy three-dimensional model and it needs to be simplified to 80% accuracy, then a vertex merging process can be performed on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model. If it needs to be simplified to 30% accuracy, a mesh reconstruction process can be performed on the target second three-dimensional model to generate a simplified target three-dimensional model. It can be set that 50% accuracy is a watershed. When simplifying to more than 50% accuracy (including 50% accuracy), a vertex merging process can be performed on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model. When simplifying to less than 50% accuracy, a mesh reconstruction process can be performed on the target second three-dimensional model to generate a simplified target three-dimensional model.
[0159] Please refer to Figure 4 , Figure 4 which is a schematic flow diagram of simplifying the target second three-dimensional model provided by an embodiment of the present application. In some embodiments, performing a vertex merging process on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model includes:
[0160] Step 310: Determine the target image quality gap between the original three-dimensional model and the target second three-dimensional model under multiple preset viewpoints;
[0161] Step 320: Determine the unit normal vector corresponding to each vertex in the target second three-dimensional model, and determine the curvature along the adjacent vertices according to the unit normal vector corresponding to each vertex;
[0162] Step 330: Determine the area and plane matrix corresponding to each triangular face associated with each vertex;
[0163] Step 340: Determine the quadratic error measurement matrix corresponding to each vertex based on the target image quality gap, curvature, area, and plane matrix;
[0164] Step 350: Perform vertex merging processing on the vertices in the target second three-dimensional model according to the quadratic error measurement matrix to generate a simplified target three-dimensional model.
[0165] The following will describe steps 310 to 350 in detail.
[0166] In step 310, determine the target image quality gap between the original three-dimensional model and the target second three-dimensional model at multiple preset viewpoints.
[0167] Among them, the target second three-dimensional model can be understood as being reconstructed and there will be certain subtle differences compared to the original three-dimensional model. The target image quality gap between the two can be obtained at multiple preset viewpoints.
[0168] In some embodiments, determining the target image quality gap between the original three-dimensional model and the target second three-dimensional model at multiple preset viewpoints includes:
[0169] (1.1) Obtain the first image of the original three-dimensional model at each preset viewpoint and the second image of the target second three-dimensional model at each preset viewpoint;
[0170] (1.2) Determine the image quality gap between the corresponding first image and second image at each preset viewpoint;
[0171] (1.3) Determine the target image quality gap between the original three-dimensional model and the target second three-dimensional model according to the image quality gap corresponding to each preset viewpoint.
[0172] Among them, please refer to Figure 5 , Figure 5 which is a schematic diagram of the first image provided by the embodiment of the present application. At each of the multiple preset viewpoints of the original three-dimensional model, a first image can be obtained, as Figure 5 shown, which includes the first images at 6 preset viewpoints.
[0173] Similarly, at multiple preset viewpoints, the second image of the target second three-dimensional model at each preset viewpoint can be obtained.
[0174] Then determine the image quality gap between the corresponding first image and second image at each preset viewpoint. The specific calculation method is as follows:
[0175] Among them, For the image quality gap between the first image and the second image corresponding to each preset viewpoint, SSIM (Structural Similarity) is the structural similarity, FSIM (Feature Similarity) is the feature similarity, and M image is the first image, and M' image is the second image.
[0176] Then, based on the image quality gap corresponding to each preset viewpoint, the target image quality gap between the original 3D model and the target second 3D model is determined. The specific calculation method is as follows:
[0177] where T viewponit is the target image quality gap, N is the total number of preset viewpoints, i is the viewpoint number, and P is the Minkowski index, which can be specifically set to 3.
[0178] As can be seen from the above, by obtaining the image quality gap between the first image and the second image under multiple preset viewpoints, and obtaining the target image quality gap through the image quality gaps corresponding to multiple preset viewpoints, the gap between the original 3D model and the target second 3D model can be measured more accurately.
[0179] In step 320, the unit normal vector corresponding to each vertex is determined in the target second 3D model, and the curvature along the adjacent vertex is determined based on the unit normal vector corresponding to each vertex.
[0180] Among them, the unit normal vector corresponding to each vertex can be determined first in the target second 3D model, and then the curvature along the adjacent vertex can be determined through the unit normal vector corresponding to each vertex.
[0181] Determining the unit normal vector corresponding to each vertex in the target second 3D model includes:
[0182] (1.1) Determine the associated vertices corresponding to each vertex in the associated triangular faces in the target second 3D model;
[0183] (1.2) Determine the direction vector between each vertex and each associated vertex, and determine the normal vector of the triangular face associated with each vertex based on the direction vector;
[0184] (1.3) Determine the unit normal vector corresponding to each vertex based on the normal vector of the triangular face associated with each vertex.
[0185] First, determine the associated vertices corresponding to each vertex in the associated triangular faces in the target second 3D model. For example, if a vertex is in two triangular faces, then these two triangular faces are the triangular faces associated with the vertex, and the vertices in the associated triangular faces are the associated vertices of the vertex.
[0186] Next, determine the direction vector between each vertex and each associated vertex, and determine the normal vector of the triangular face associated with each vertex based on the direction vector. For example, the specific calculation method is as follows:
[0187] where n i is the normal vector of the triangular face associated with each vertex, and the three vertices of the triangular face are v i-1 , v, v i , then the direction vector between vertex v and associated vertices v i-1 and v i is v i-1 -v and v i -v.
[0188] Then, determine the unit normal vector corresponding to each vertex based on the normal vector of the triangular face associated with each vertex. For example, the specific calculation method is as follows:
[0189] where, n v is the unit normal vector corresponding to each vertex, k represents that vertex v has k associated triangular faces, and i represents the i-th associated triangular face.
[0190] In some embodiments, determining the curvature along the adjacent vertex according to the unit normal vector corresponding to each vertex includes:
[0191] (2.1) Multiply the unit normal vector corresponding to each vertex by the direction vector between each vertex and each associated vertex and then multiply by two to obtain a multiplication result;
[0192] (2.2) Divide the multiplication result by the norm corresponding to the direction vector to obtain the curvature along the adjacent vertex determined by the unit normal vector corresponding to each vertex.
[0193] Among them, the specific calculation method is as follows:
[0194] where C i is the curvature along the adjacent vertex of each vertex.
[0195] In step 330, determine the area and plane matrix corresponding to each triangular face associated with each vertex.
[0196] Specifically, assuming that vertex v is associated with k triangular faces, the area and plane matrix of each of these k triangular faces can be determined.
[0197] Among them, assuming that a triangular face is represented as matrix p, the transposed matrix corresponding to matrix p is p T , and their respective matrix representations are:
[0198] The plane matrix corresponding to the triangular face is as follows:
[0199] where i represents the i-th triangular face associated with vertex v.
[0200] In step 340, the quadratic error measurement matrix corresponding to each vertex is determined based on the target image quality gap, curvature, area, and plane matrix.
[0201] Finally, the quadratic error measurement matrix corresponding to each vertex is determined based on the target image quality gap, curvature, area, and plane matrix. The specific calculation method is as follows:
[0202] where S i represents the area of the i-th associated triangular face.
[0203] In step 350, vertex merging processing is performed on the vertices in the target second three-dimensional model according to the quadratic error measurement matrix to generate a simplified target three-dimensional model.
[0204] Among them, the quadratic error measurement matrix is mainly used for subsequent mesh simplification of the target second three-dimensional model. The target second three-dimensional model is composed of multiple triangular faces. For each vertex, the quadratic error measurement matrix associates a quadratic error measurement value. When considering removing a vertex, it calculates the degree of geometric change of the surrounding patches due to the vertex removal. This degree of change is approximately represented by a quadratic function, and the plane corresponding to its minimum value can be regarded as the optimal filling plane for the "hole" generated after removing the vertex. That is to say, in the process of simplifying the target second three-dimensional model, the quadratic error measurement matrix can help determine which vertices have less impact on the shape of the model, so as to preferentially remove these vertices while trying to maintain the overall appearance of the target second three-dimensional model.
[0205] At the same time, in the quadratic error measurement matrix, the curvature defines the key local features of the target second three-dimensional model. Among them, a larger curvature value represents key features such as sharp edges, which ensures that the edge folding operation focuses on regions with smaller curvature, thereby retaining the key features of the target second three-dimensional model. Area weighting is added to the quadratic error measurement matrix. When the curvature values are the same, this priority sorting helps to retain vertices with larger areas. Therefore, this greatly improves the retention rate of boundary features in the process of simplifying the target second three-dimensional model, thereby obtaining a target three-dimensional model with higher fidelity.
[0206] Please refer to Figure 6 , Figure 6It is a schematic diagram of vertex merging provided by an embodiment of the present application. Among them, assuming that there are vertex v1 and vertex v2 in a certain area of the target second three-dimensional model on the left, the quadratic error measurement matrix can guide the collapse direction of the merged vertex, so as to obtain the merged vertex v3. After the vertices v1 and v2 are merged, the mesh formed by the triangular faces in this area is changed, and at the same time the number of triangular faces is also reduced, thus realizing the simplification of the triangular faces in this area. Similarly, when applied to the entire target second three-dimensional model, the simplification of the entire target second three-dimensional model can be realized.
[0207] It can be seen from step 310 to step 350 that in the embodiment of the present application, the quadratic error measurement matrix corresponding to each vertex can be determined according to the target image quality gap, curvature, area and plane matrix, so as to more accurately guide the merging of vertices in the target second three-dimensional model. Thus, more accurate simplification of the target second three-dimensional model is realized, avoiding changing the shape of the target second three-dimensional model due to unnecessary simplification, making the shape of the simplified target three-dimensional model the same as the shape of the target second three-dimensional model. Since the shape of the target second three-dimensional model is the same as the shape of the original three-dimensional model, the shape of the target three-dimensional model is the same as the shape of the original three-dimensional model, realizing the simplification of the original three-dimensional model while retaining the detailed features in the original three-dimensional model.
[0208] Please refer to Figure 7 , Figure 7 It is a schematic flowchart of simplifying the target second three-dimensional model provided by an embodiment of the present application. In some embodiments, grid reconstruction processing is performed on the target second three-dimensional model to generate a simplified target three-dimensional model, including:
[0209] Step 410, obtain the contour surfaces corresponding to the target second three-dimensional model under multiple viewpoints;
[0210] Step 420, generate a plurality of voxels in three-dimensional space and determine the target vertices corresponding to the plurality of voxels on the contour surface;
[0211] Step 430, construct an outer shell three-dimensional model corresponding to the target second three-dimensional model according to the target vertices;
[0212] Step 440, perform grid reconstruction processing on the outer shell three-dimensional model to obtain a simplified target three-dimensional model.
[0213] The following will describe steps 410 to 440 in detail.
[0214] In step 410, the contour surfaces corresponding to the target second three-dimensional model under multiple viewpoints are obtained.
[0215] Among them, multiple virtual cameras can be used to photograph the target second three-dimensional model, so as to obtain the contour surfaces corresponding to the target second three-dimensional model from multiple viewpoints. Subsequently, the outer shell three-dimensional model corresponding to the target second three-dimensional model can be obtained according to the contour surface. The expression of the outer shell three-dimensional model can be:
[0216] where N is the number of viewpoints, C k represents the spatial position of the virtual camera, VC k represents the visual cone formed by the viewpoint and the contour line, and VH represents the approximate visualization shell of the object obtained by intersecting the visual cones of N viewpoints.
[0217] In step 420, multiple voxels are generated in the three-dimensional space, and the target vertices corresponding to the multiple voxels located on the contour surface are determined.
[0218] Among them, considering the N viewpoints located around the target second three-dimensional model, {I k ; S k ; k = 1,..., N} is defined to represent the images I k captured from these viewpoints and the contour S k . {C k ; M k ; k = 1,..., N} is defined to represent the center C k of the camera and the projection matrix M k . The visual hull of the target second three-dimensional model is reconstructed using a voxel-based method, which mainly involves determining the state of each voxel.
[0219] Assume that the voxel is V, which includes eight vertices labeled as Pi (i = 0,..., 7). The state of the vertex Pi observed from the Kth camera is calculated using the following formula:
[0220] where, if the vertex of the voxel is outside the target second three-dimensional model, S k (P i ) is 0, and if the vertex of the voxel is inside the target second three-dimensional model, S k (P i ) is 1.
[0221] After determining the state of each vertex in the viewpoint K, the overall state S k (V) of the voxel is established. Subsequently, the relationship S(V) between the voxel and the target second three-dimensional model is evaluated based on the voxel states at all viewpoints. In this case, S(V) is equal to 1 for the vertices inside the target second three-dimensional model, equal to -1 for the vertices outside the target second three-dimensional model, and equal to 0 for the vertices on the surface of the target second three-dimensional model, that is, located on the contour surface. The overall state S k(V) The calculation method is as follows:
[0222]
[0223] The calculation method of the relationship S(V) between the voxel and the target second three-dimensional model is as follows:
[0224]
[0225] Among them, if the voxel is located on the contour surface (i.e., S(V)=0), it is divided into eight parts. Then, recursive operations are performed on each subdivided voxel until the decomposition reaches a predetermined threshold. Thus, a plurality of target vertices are determined on the contour surface.
[0226] In some embodiments, generating a plurality of voxels in three-dimensional space and determining the target vertices corresponding to the plurality of voxels located on the contour surface includes:
[0227] (1.1) Perform octree partitioning according to the target vertices corresponding to the plurality of voxels located on the contour surface to obtain a plurality of updated voxels;
[0228] (1.2) Determine the target vertices corresponding to the plurality of updated voxels located on the contour surface, and return to perform octree partitioning according to the target vertices corresponding to the plurality of voxels located on the contour surface until the preset number of partitioning times is reached, so as to obtain the target vertices corresponding to the plurality of voxels located on the contour surface.
[0229] Among them, the target vertices corresponding to the plurality of voxels located on the contour surface can continue to be octree partitioned to obtain eight updated voxels, then determine the target vertices corresponding to the eight updated voxels located on the contour surface, and then return to perform octree partitioning according to the target vertices corresponding to the plurality of voxels located on the contour surface until the preset number of partitioning times is reached, so as to obtain the target vertices corresponding to the plurality of voxels located on the contour surface.
[0230] The advantage of doing this is that more target vertices can be determined on the contour surface, so that a shell three-dimensional model similar to the target second three-dimensional model can be constructed more accurately subsequently. Thus, more detailed features are retained.
[0231] In step 430, construct a shell three-dimensional model corresponding to the target second three-dimensional model according to the target vertices.
[0232] Among them, after obtaining the target vertices, a plurality of triangular faces can be constructed according to the target vertices, and the plurality of triangles form a mesh topology, thereby generating a shell three-dimensional model corresponding to the target second three-dimensional model.
[0233] In step 440, perform mesh reconstruction processing on the shell three-dimensional model to obtain a simplified target three-dimensional model.
[0234] In this application, the three-dimensional model of the housing can be subjected to multiple mesh reconstructions, so as to realize the carving of the three-dimensional model of the housing, and thus obtain a simplified target three-dimensional model.
[0235] In some embodiments, the mesh reconstruction process of the three-dimensional model of the housing is carried out according to multiple target vertices to obtain a simplified target three-dimensional model, including:
[0236] (1.1) Reconstruct multiple triangular meshes on the three-dimensional model of the housing to obtain a three-dimensional model to be selected;
[0237] (1.2) Determine the similarity corresponding to multiple viewing directions in the preset image space between the three-dimensional model to be selected and the original three-dimensional model;
[0238] (1.3) When the similarity does not meet the preset condition, adjust multiple triangular meshes of the three-dimensional model to be selected to obtain an updated three-dimensional model to be selected until the similarity corresponding to multiple viewing directions in the preset image space between the updated three-dimensional model to be selected and the original three-dimensional model meets the preset condition, then a simplified target three-dimensional model is obtained.
[0239] Among them, in the process of reconstructing multiple triangular meshes on the three-dimensional model of the housing, a visual metric method can be adopted to guide the reconstruction of the triangular meshes to obtain a three-dimensional model to be selected.
[0240] Then determine the similarity corresponding to multiple viewing directions in the preset image space between the three-dimensional model to be selected and the original three-dimensional model. Given a viewing direction d, the triangular meshes of the three-dimensional model of the housing can be rendered into the preset image space and define In, and the visual similarity is quantified by the average pixel-level distance. The specific calculation method of the visual metric is:
[0241] d n (M c ,M,d)=‖I n (M c ,d)-I n (M,d)‖ / N. Where N is the number of pixels, M c is the three-dimensional model to be selected for carving the three-dimensional model of the housing, and M is the original three-dimensional model.
[0242] Furthermore, the visual metrics of all viewing directions can be obtained, and the similarity corresponding to multiple viewing directions between the three-dimensional model to be selected and the original three-dimensional model is determined according to the visual metrics in multiple viewing directions. The similarity calculation method is:
[0243] Among them, τ n can obtain an approximate value through Monte Carlo sampling.
[0244] When the similarity does not meet the preset condition, multiple triangular meshes of the three-dimensional model to be selected are adjusted to obtain an updated three-dimensional model to be selected until the similarities corresponding to multiple viewing directions of the updated three-dimensional model to be selected and the original three-dimensional model in the preset image space meet the preset condition, and then the simplified target three-dimensional model is obtained. Among them, the greedy algorithm can be used to sculpt the mesh to optimize the similarity between the input model M and the sculpted model Mc, so as to continuously improve the similarity until the preset condition is reached, such as the similarity reaching more than 95%.
[0245] Please refer to Figure 8 , Figure 8 which is a schematic diagram of the target three-dimensional model provided by the embodiment of the present application. Among them, the outer shell three-dimensional model is constructed based on the target second three-dimensional model. It can be seen that the contour of the outer shell three-dimensional model is consistent with the contour of the original three-dimensional model. Then, mesh reconstruction processing is performed on the outer shell three-dimensional model to obtain the target three-dimensional model. The contour of the target three-dimensional model is consistent with the contour of the original three-dimensional model, and at the same time, the target three-dimensional model retains some detailed features of the original three-dimensional model, such as the window sill area.
[0246] As can be seen from the above, in the embodiment of the present application, the original three-dimensional model is obtained, and the voxelized three-dimensional model is obtained by voxelizing the original three-dimensional model; the first three-dimensional model composed of multiple vertices is determined according to the voxelized three-dimensional model; the first three-dimensional model is divided into multiple local regions, and the characteristic vertices corresponding to each local region are determined according to the vertex positions and vertex normal directions of each local region; the second three-dimensional model is formed by the characteristic vertices and the vertices in the first three-dimensional model, and the normal of each triangular face in the second three-dimensional model is refined to obtain the target second three-dimensional model; mesh reconstruction processing is performed on the target second three-dimensional model or vertex merging processing is performed on the vertices in the target second three-dimensional model to generate the simplified target three-dimensional model.
[0247] Therefore, first voxelize the original 3D model, and then construct a first 3D model composed of triangular faces formed by multiple vertices from the voxelized 3D model to realize the reconstruction of the original 3D model. Then, divide the first 3D model into multiple local regions, and determine the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region. The characteristic vertices are used to enhance the details of some key regions. Then, construct a second 3D model based on the characteristic vertices and the vertices in the first 3D model, and perform normal refinement processing on the normal of each triangular face in the second 3D model to obtain the target second 3D model. Through the normal refinement processing, the microscopic geometric structure of the object surface can be described more accurately, and the enhancement of detail features can be realized. Finally, perform mesh reconstruction processing on the target second 3D model or perform vertex merging processing on the vertices in the target second 3D model to generate a simplified target 3D model, thereby realizing the simplification of the original 3D model. Compared with the technical solution in the related art that identifies and distinguishes the core structural features and non-core features, and then performs reduction measures on the non-core features according to the lightweight criterion, the target 3D model obtained by the solution in this application contains the detail features of some regions of the original 3D model, and at the same time, the original 3D model can be simplified to the required degree.
[0248] Please refer to Figure 9 , Figure 9 which is another flowchart of the 3D model simplification method provided by the embodiment of this application. The 3D model simplification method may include the following steps:
[0249] Step 501: Obtain the original 3D model, and perform voxelization processing on the original 3D model to obtain a voxelized 3D model;
[0250] Step 502: Determine a first 3D model including multiple vertices according to the voxelized 3D model;
[0251] Step 503: Subtract the vertex position of each vertex in each local region from the expected position of the characteristic vertex corresponding to each local region to obtain the position deviation result corresponding to each vertex in each local region;
[0252] Step 504: Multiply the position deviation result corresponding to each vertex in each local region by the vertex normal direction corresponding to each vertex in each local region to obtain a first calculation result;
[0253] Step 505: Add up the first calculation results corresponding to each vertex in each local region to obtain a second calculation result;
[0254] Step 506: Adjust the expected position to reduce the second calculation result, and when the second calculation result is the smallest, generate the characteristic vertex corresponding to each local region at the expected position corresponding to the smallest second calculation result;
[0255] Step 507: Construct a second 3D model based on the feature vertices and the vertices in the first 3D model, and perform normal refinement processing on the normal vectors of each triangular face in the second 3D model to obtain the target second 3D model;
[0256] Step 508: Determine the target image quality gap between the original 3D model and the target second 3D model under multiple preset viewpoints;
[0257] Step 509: Determine the unit normal vector corresponding to each vertex in the target second 3D model, and determine the curvature along the adjacent vertices according to the unit normal vector corresponding to each vertex;
[0258] Step 510: Determine the area and plane matrix corresponding to each triangular face associated with each vertex;
[0259] Step 511: Determine the quadratic error measurement matrix corresponding to each vertex according to the target image quality gap, curvature, area, and plane matrix;
[0260] Step 512: Perform vertex merging processing on the vertices in the target second 3D model according to the quadratic error measurement matrix to generate a simplified target 3D model.
[0261] Step 513: Obtain the contour surfaces corresponding to the target second 3D model under multiple viewpoints;
[0262] Step 514: Generate multiple voxels in 3D space and determine the target vertices corresponding to the multiple voxels on the contour surface;
[0263] Step 515: Construct an outer shell 3D model corresponding to the target second 3D model according to the target vertices;
[0264] Step 516: Perform mesh reconstruction processing on the outer shell 3D model to obtain a simplified target 3D model.
[0265] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the detailed description of the above 3D model simplification method, which will not be elaborated here.
[0266] Please refer to Figure 10 , Figure 10 which is the structural schematic diagram of the 3D model simplification device provided by the embodiments of the present application. This 3D model simplification device can be used to execute the above 3D model simplification method.
[0267] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the functions of that module or unit.
[0268] The three-dimensional model simplification device 600 includes:
[0269] An acquisition module 610, configured to acquire an original three-dimensional model and perform voxelization processing on the original three-dimensional model to obtain a voxelized three-dimensional model;
[0270] A determination module 620, configured to determine a first three-dimensional model including a plurality of vertices according to the voxelized three-dimensional model;
[0271] A division module 630, configured to divide the first three-dimensional model into a plurality of local regions, and determine characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region;
[0272] A composition module 640, configured to form a second three-dimensional model according to the characteristic vertices and the vertices in the first three-dimensional model, and perform normal refinement processing on the normal of each triangular face in the second three-dimensional model to obtain a target second three-dimensional model;
[0273] A simplification module 650, configured to perform mesh reconstruction processing on the target second three-dimensional model or perform vertex merging processing on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model.
[0274] In some embodiments, the division module 630 is configured to:
[0275] Subtract the vertex position of each vertex in each local region from the expected position of the characteristic vertices corresponding to each local region to obtain a position deviation result corresponding to each vertex in each local region;
[0276] Multiply the position deviation result corresponding to each vertex in each local region by the vertex normal direction corresponding to each vertex in each local region to obtain a first calculation result;
[0277] Add the squared values of the first calculation results corresponding to each vertex in each local region to obtain a second calculation result;
[0278] Adjust the expected position to reduce the second calculation result, and when the second calculation result is the smallest, generate the characteristic vertices corresponding to each local region at the expected position corresponding to the smallest second calculation result.
[0279] In some embodiments, the composition module 640 is configured to:
[0280] Initialize the normal vectors of each triangular face in the second 3D model to obtain the initialized normal vectors of each triangular face;
[0281] Determine the spatial distance weights and normal proximity weights between adjacent triangular faces in the second 3D model;
[0282] Perform weighted average refinement on the initialized normal vectors of each triangular face in the adjacent triangular faces according to the spatial distance weights and normal proximity weights to obtain the target second 3D model.
[0283] In some embodiments, the composition module 640 is configured to:
[0284] Determine the target feature vertices located in the convex regions in the first 3D model among the feature vertices;
[0285] Construct the second 3D model according to the target feature vertices and the vertices in the first 3D model.
[0286] In some embodiments, the simplification module 650 includes a first simplification sub-module and a second simplification sub-module. The first simplification sub-module is configured to:
[0287] Determine the target image quality gap between the original 3D model and the target second 3D model under multiple preset viewpoints;
[0288] Determine the unit normal vector corresponding to each vertex in the target second 3D model, and determine the curvature along the adjacent vertices according to the unit normal vector corresponding to each vertex;
[0289] Determine the area and plane matrix corresponding to each triangular face associated with each vertex;
[0290] Determine the quadratic error measurement matrix corresponding to each vertex according to the target image quality gap, curvature, area, and plane matrix;
[0291] Perform vertex merging processing on the vertices in the target second 3D model according to the quadratic error measurement matrix to generate the simplified target 3D model.
[0292] In some embodiments, the first simplification sub-module is configured to:
[0293] Obtain the first image of the original 3D model under each preset viewpoint and the second image of the target second 3D model under each preset viewpoint;
[0294] Determine the image quality gap between the corresponding first image and second image under each preset viewpoint;
[0295] Determine the target image quality gap between the original three-dimensional model and the target second three-dimensional model according to the corresponding image quality gaps under each preset viewpoint.
[0296] In some embodiments, the first simplification sub-module is used for:
[0297] Determine the associated vertices corresponding to each vertex in the associated triangular faces in the target second three-dimensional model;
[0298] Determine the direction vectors between each vertex and each associated vertex, and determine the normal vectors of the triangular faces associated with each vertex according to the direction vectors;
[0299] Determine the unit normal vectors corresponding to each vertex according to the normal vectors of the triangular faces associated with each vertex.
[0300] In some embodiments, the first simplification sub-module is used for:
[0301] Multiply the unit normal vector corresponding to each vertex by the direction vector between each vertex and each associated vertex and then multiply by two to obtain a multiplication result;
[0302] Divide the multiplication result by the norm corresponding to the direction vector to obtain the unit normal vector corresponding to each vertex and determine the curvature along the adjacent vertex.
[0303] In some embodiments, the second simplification sub-module is used for:
[0304] Obtain the contour surfaces corresponding to the target second three-dimensional model under multiple viewpoints;
[0305] Generate multiple voxels in three-dimensional space and determine the target vertices corresponding to the multiple voxels on the contour surface;
[0306] Construct the shell three-dimensional model corresponding to the target second three-dimensional model according to the target vertices;
[0307] Perform mesh reconstruction processing on the shell three-dimensional model to obtain the simplified target three-dimensional model.
[0308] In some embodiments, the second simplification sub-module is used for:
[0309] Perform octree partitioning according to the target vertices corresponding to the multiple voxels on the contour surface to obtain multiple updated voxels;
[0310] Determine the target vertices corresponding to the multiple updated voxels on the contour surface, and return to perform octree partitioning according to the target vertices corresponding to the multiple voxels on the contour surface until the preset partitioning times are reached, to obtain the target vertices corresponding to the multiple voxels on the contour surface.
[0311] In some embodiments, the second simplification sub-module is configured to:
[0312] Reconstruct a plurality of triangular meshes on the three-dimensional model of the housing to obtain a three-dimensional model to be selected;
[0313] Determine the similarities corresponding to a plurality of viewing directions in a preset image space between the three-dimensional model to be selected and the original three-dimensional model;
[0314] When the similarity does not meet the preset condition, adjust a plurality of triangular meshes of the three-dimensional model to be selected to obtain an updated three-dimensional model to be selected until the similarities corresponding to a plurality of viewing directions in the preset image space between the updated three-dimensional model to be selected and the original three-dimensional model meet the preset condition, thereby obtaining a simplified target three-dimensional model.
[0315] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For parts not detailed in a certain embodiment, reference may be made to the detailed description of the above three-dimensional model simplification method, which will not be elaborated here.
[0316] In the embodiments of the present application, the acquisition module 610 acquires the original three-dimensional model and performs voxelization processing on the original three-dimensional model to obtain a voxelized three-dimensional model; the determination module 620 determines a first three-dimensional model including a plurality of vertices according to the voxelized three-dimensional model; the division module 630 divides the first three-dimensional model into a plurality of local regions and determines characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region; the composition module 640 forms a second three-dimensional model according to the characteristic vertices and the vertices in the first three-dimensional model and performs normal refinement processing on the normal of each triangular face in the second three-dimensional model to obtain a target second three-dimensional model; the simplification module 650 performs mesh reconstruction processing on the target second three-dimensional model or performs vertex merging processing on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model.
[0317] Therefore, first, the original three-dimensional model is voxelized, and then a first three-dimensional model composed of triangular faces formed by multiple vertices is constructed through the voxelized three-dimensional model to realize the reconstruction of the original three-dimensional model. Then, the first three-dimensional model is divided into multiple local regions, and the characteristic vertices corresponding to each local region are determined according to the vertex positions and vertex normal directions of each local region. The characteristic vertices are used to enhance the details of some key regions. Then, a second three-dimensional model is formed by the characteristic vertices and the vertices in the first three-dimensional model, and the normal vectors of each triangular face in the second three-dimensional model are refined to obtain the target second three-dimensional model. Through the normal vector refinement process, the microscopic geometric structure of the object surface can be described more accurately, and the enhancement of detail features can be realized. Finally, a mesh reconstruction process is performed on the target second three-dimensional model or a vertex merging process is performed on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model, thereby realizing the simplification of the original three-dimensional model. Compared with the technical solution in the related art that identifies and distinguishes the core structural features and non-core features, and then performs reduction measures on the non-core features according to the lightweight criterion, the target three-dimensional model obtained by the solution in this application contains the detail features of some regions of the original three-dimensional model, and at the same time, the original three-dimensional model can be simplified to the required degree.
[0318] An embodiment of this application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above three-dimensional model simplification method is implemented. The computer device can be any intelligent terminal including a tablet computer, an in-vehicle computer, etc.
[0319] Please refer to Figure 11 , Figure 11 which schematically shows the hardware structure of a computer device in another embodiment. The computer device includes:
[0320] A processor 701, which can be implemented in ways such as a general-purpose CPU (Central Processing Unit, central processor), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided by the embodiments of this application;
[0321] The memory 702 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), etc. The memory 702 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 702 and are called by the processor 701 to execute the 3D model simplification method of the embodiments of this application;
[0322] The input / output interface 703 is used to implement information input and output;
[0323] The communication interface 704 is used to implement communication and interaction between this device and other devices. It can implement communication through a wired manner (such as USB, network cable, etc.) or through a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0324] The bus 705 transmits information between various components of the device (such as the processor 701, the memory 702, the input / output interface 703, and the communication interface 704);
[0325] Among them, the processor 701, the memory 702, the input / output interface 703, and the communication interface 704 achieve communication connections with each other inside the device through the bus 705.
[0326] The embodiments of this application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned 3D model simplification method is implemented.
[0327] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include a high-speed random access memory, and can also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory optionally includes a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0328] The 3D model simplification method, 3D model simplification device, computer device, and storage medium provided by the embodiments of the present application obtain an original 3D model and perform voxelization processing on the original 3D model to obtain a voxelized 3D model; determine a first 3D model composed of a plurality of vertices based on the voxelized 3D model; divide the first 3D model into multiple local regions, and determine the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region; form a second 3D model based on the characteristic vertices and the vertices in the first 3D model, and perform normal refinement processing on the normal of each triangular face in the second 3D model to obtain a target second 3D model; perform mesh reconstruction processing on the target second 3D model or perform vertex merging processing on the vertices in the target second 3D model to generate a simplified target 3D model.
[0329] Therefore, first voxelize the original 3D model, and then construct a first 3D model composed of triangular faces formed by a plurality of vertices through the voxelized 3D model to achieve the reconstruction of the original 3D model. Then divide the first 3D model into multiple local regions, and determine the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region. The characteristic vertices are used to enhance the details of some key regions. Then form a second 3D model based on the characteristic vertices and the vertices in the first 3D model, and perform normal refinement processing on the normal of each triangular face in the second 3D model to obtain a target second 3D model. Through normal refinement processing, the microscopic geometric structure of the object surface can be described more accurately, and detail feature enhancement can be achieved. Finally, perform mesh reconstruction processing on the target second 3D model or perform vertex merging processing on the vertices in the target second 3D model to generate a simplified target 3D model, thereby realizing the simplification of the original 3D model. Compared with the technical solution in the related art of identifying and distinguishing core structural features and non-core features, and then performing reduction measures on the non-core features according to the lightweight criterion, the target 3D model obtained by the solution in the present application not only contains the detail features of some regions of the original 3D model, but also can simplify the original 3D model to the degree required for simplification.
[0330] The embodiments described in the embodiments of the present application are for more clearly explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0331] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figures, or combine certain steps, or different steps.
[0332] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0333] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in systems and devices, can be implemented as software, firmware, hardware, and appropriate combinations thereof.
[0334] It should be understood that in this application, the terms "first", "second", "third", "fourth", etc. (if any) in the description of the specification and the above drawings are used to distinguish similar objects and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0335] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or similar expressions refer to any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0336] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.
[0337] The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0338] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0339] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. And the foregoing storage medium includes: various media that can store programs such as USB flash drives, mobile hard disks, read-only memory (ROM for short), random access memory (RAM for short), magnetic disks, or optical discs.
[0340] The preferred embodiments of the embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of rights of the embodiments of the present application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of rights of the embodiments of the present application.
Claims
1. A three-dimensional model simplification method, characterized in that Including: Obtain an original 3D model, and perform voxelization processing on the original 3D model to obtain a voxelized 3D model; Determine a first 3D model including a plurality of vertices according to the voxelized 3D model; Perform regional division on the first 3D model to obtain a plurality of local regions, and determine characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region; Construct a second 3D model according to the characteristic vertices and the vertices in the first 3D model, and perform normal refinement processing on the normal of each triangular face in the second 3D model to obtain a target second 3D model; Perform mesh reconstruction processing on the target second 3D model or perform vertex merging processing on the vertices in the target second 3D model to generate a simplified target 3D model.
2. The three-dimensional model simplification method according to claim 1, wherein The determining the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region includes: Subtract the vertex position of each vertex in each local region from the expected position of the characteristic vertex corresponding to each local region to obtain a position deviation result corresponding to each vertex in each local region; Multiply the position deviation result corresponding to each vertex in each local region by the vertex normal direction corresponding to each vertex in each local region to obtain a first calculation result; Add the squared values of the first calculation results corresponding to each vertex in each local region to obtain a second calculation result; Adjust the expected position to reduce the second calculation result, and when the second calculation result is the smallest, generate the characteristic vertices corresponding to each local region at the expected position corresponding to the smallest second calculation result.
3. The 3D model simplification method according to claim 1, characterized in that The performing normal refinement processing on the normal of each triangular face in the second 3D model to obtain a target second 3D model includes: Perform initialization processing on the normal of each triangular face in the second 3D model to obtain an initial normal of each triangular face; Determine the spatial distance weight and normal proximity weight between adjacent triangular faces in the second 3D model; Perform weighted average refinement processing on the initial normal of each triangular face in the adjacent triangular faces according to the spatial distance weight and the normal proximity weight to obtain a target second 3D model.
4. The three-dimensional model simplification method according to claim 1, wherein The constructing a second 3D model according to the characteristic vertices and the vertices in the first 3D model includes: Determine target characteristic vertices located in the convex region in the first 3D model among the characteristic vertices; Construct a second 3D model according to the target characteristic vertices and the vertices in the first 3D model.
5. The three-dimensional model simplification method according to claim 1, wherein The performing vertex merging processing on the vertices in the target second 3D model to generate a simplified target 3D model includes: Determine the target image quality gap between the original 3D model and the target second 3D model under a plurality of preset viewpoints; Determine the unit normal vector corresponding to each vertex in the target second 3D model, and determine the curvature along the adjacent vertex according to the unit normal vector corresponding to each vertex; Determine the area and plane matrix corresponding to each triangular face associated with each vertex; Determine the quadratic error measurement matrix corresponding to each vertex according to the target image quality gap, the curvature, the area, and the plane matrix; Perform vertex merging processing on the vertices in the target second three-dimensional model according to the quadratic error measurement matrix to generate a simplified target three-dimensional model.
6. The three-dimensional model simplification method according to claim 5, characterized in that The determination of the target image quality gap between the original three-dimensional model and the target second three-dimensional model at multiple preset viewpoints includes: Obtain the first image of the original three-dimensional model at each preset viewpoint and the second image of the target second three-dimensional model at each preset viewpoint; Determine the image quality gap between the first image and the second image corresponding to each preset viewpoint; Determine the target image quality gap between the original three-dimensional model and the target second three-dimensional model according to the image quality gap corresponding to each preset viewpoint.
7. The three-dimensional model simplification method according to claim 5, characterized in that The determination of the unit normal vector corresponding to each vertex in the target second three-dimensional model includes: Determine the associated vertices corresponding to each vertex in the associated triangular faces in the target second three-dimensional model; Determine the direction vector between each vertex and each associated vertex, and determine the normal vector of the triangular face associated with each vertex according to the direction vector; Determine the unit normal vector corresponding to each vertex according to the normal vector of the triangular face associated with each vertex.
8. The three-dimensional model simplification method according to claim 5, characterized in that, The determination of the curvature along the adjacent vertex according to the unit normal vector corresponding to each vertex includes: Multiply the unit normal vector corresponding to each vertex by the direction vector between each vertex and each associated vertex and then multiply by two to obtain a multiplication result; Divide the multiplication result by the norm corresponding to the direction vector to obtain the curvature along the adjacent vertex determined by the unit normal vector corresponding to each vertex.
9. The three-dimensional model simplification method according to claim 1, characterized in that, The mesh reconstruction processing of the target second three-dimensional model to generate a simplified target three-dimensional model includes: Obtain the contour surfaces corresponding to the target second three-dimensional model at multiple viewpoints; Generate a plurality of voxels in three-dimensional space and determine the target vertices corresponding to the plurality of voxels located on the contour surface; Construct an outer shell three-dimensional model corresponding to the target second three-dimensional model according to the target vertices; Perform mesh reconstruction processing on the outer shell three-dimensional model to obtain a simplified target three-dimensional model.
10. The three-dimensional model simplification method according to claim 9, characterized in that, The generation of a plurality of voxels in three-dimensional space and the determination of the target vertices corresponding to the plurality of voxels located on the contour surface include: Perform octree partitioning according to the target vertices corresponding to the plurality of voxels located on the contour surface to obtain a plurality of updated voxels; Determine the target vertices corresponding to the plurality of updated voxels located on the contour surface, and return to perform octree partitioning according to the target vertices corresponding to the plurality of voxels located on the contour surface until the preset partitioning times are reached, to obtain the target vertices corresponding to the plurality of voxels located on the contour surface.
11. The three-dimensional model simplification method according to claim 10, wherein The mesh reconstruction processing of the outer shell three-dimensional model according to the plurality of target vertices to obtain a simplified target three-dimensional model includes: Reconstruct multiple triangular meshes on the three-dimensional model of the housing to obtain a three-dimensional model to be selected; Determine the similarities corresponding to multiple viewing directions in a preset image space between the three-dimensional model to be selected and the original three-dimensional model; When the similarity does not meet the preset condition, adjust the multiple triangular meshes of the three-dimensional model to be selected to obtain an updated three-dimensional model to be selected until the similarity corresponding to multiple viewing directions in the preset image space between the updated three-dimensional model to be selected and the original three-dimensional model meets the preset condition, then obtain the simplified target three-dimensional model.
12. A three-dimensional model simplification device, characterized in that, Includes: An acquisition module, configured to acquire an original three-dimensional model and perform voxelization processing on the original three-dimensional model to obtain a voxelized three-dimensional model; A determination module, configured to determine a first three-dimensional model including multiple vertices according to the voxelized three-dimensional model; A division module, configured to perform region division on the first three-dimensional model to obtain multiple local regions, and determine the characteristic vertices corresponding to each local region according to the vertex positions and vertex normal directions of each local region; A composition module, configured to form a second three-dimensional model according to the characteristic vertices and the vertices in the first three-dimensional model, and perform normal refinement processing on the normal of each triangular face in the second three-dimensional model to obtain a target second three-dimensional model; A simplification module, configured to perform mesh reconstruction processing on the target second three-dimensional model or perform vertex merging processing on the vertices in the target second three-dimensional model to generate a simplified target three-dimensional model.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the three-dimensional model simplification method according to any one of claims 1 to 8.
14. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the three-dimensional model simplification method according to any one of claims 1 to 11.
Citation Information
Cited By
Grid model normalizing method, related device, equipment and medium
CN120876748A
Mesh model regularization method and related apparatus, device, and medium
CN120876748B
Regular building three-dimensional model data lightweight method
CN120997444A
Method for lightweighting regular building three-dimensional model data
CN120997444B