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

By using the target tetrahedral mesh in offline resource pool during the 3D model generation process to update the mesh structure in the video memory, the problem of high resource consumption during the SDF conversion to Mesh is solved, and the efficiency and display effect of 3D model generation are improved. .

CN118587389BActive Publication Date: 2024-11-19GUANGZHOU QUWAN NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411017636.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-19
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

During the three-dimensional model generation process, the full-scale tetrahedral resources are used during the conversion of SDF to Mesh, resulting in an increase in meaningless tetrahedral areas, reducing the computing efficiency and increasing resource consumption, and reducing the efficiency of 3D model generation.

Method used

By obtaining the target tetrahedral mesh in the offline resource pool, the initial three-dimensional model is generated, and the initial three-dimensional model is expanded when the range of the initial three-dimensional model exceeds or the density is inconsistent. The target tetrahedral mesh in the offline resource pool is used to update the mesh in the video memory Structure to ensure uniform density distribution and save computing and video memory resources.

Benefits of technology

The efficiency of three-dimensional model generation is improved, the display effect of the model is improved through uniform density distribution, and computing and video memory resources are saved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587389B_ABST
    Figure CN118587389B_ABST
Patent Text Reader

Abstract

The three-dimensional model generation method, device, storage medium and computer equipment provided by the present application include: in the process of three-dimensional model generation, obtaining the target function model to generate the initial three-dimensional model in combination with the grid structure in the video memory, and using the initial three-dimensional model to update the target function model. When the range of the initial three-dimensional model is not suitable or the grid density in the video memory is inconsistent with the pre-agreed density, the grid structure in the video memory is updated, and the target tetrahedron grid of the corresponding density is provided by the offline resource pool during the update. The generation range of the target tetrahedron grid determined at each update is consistent to improve the generation effect of the three-dimensional model. The second target structure formed by obtaining each target tetrahedron in the first target structure in the target tetrahedron grid is used to update the grid structure in the video memory, which can save computing resources and video memory resources and improve the efficiency of three-dimensional model generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of three-dimensional modeling, and in particular to a three-dimensional model generation method, device, storage medium and computer equipment. Background Art

[0002] The three-dimensional model generation algorithm has been greatly improved in terms of generation quality and generalization, and has gradually been implemented in various industries. The three-dimensional generation algorithm based on the diffusion model has shown good generation effects in the generation of objects of different forms and has extremely high versatility. Since three-dimensional objects are usually represented by a mesh structure (Mesh) of points and surfaces, the generation through the diffusion model usually does not directly generate a three-dimensional topological structure similar to triangles, but obtains a result expressed in the form of SDF (Signed distance function). SDF is an implicit 3D expression, which means to describe a continuous surface function in three-dimensional space through a function, so it has a relatively clear mathematical expression to adapt to the output form of the diffusion model.

[0003] Since SDF itself cannot perform 3D rendering and other operations, it is only suitable for intermediate representation. Therefore, in the process of 3D generation, it is necessary to go through multiple conversions from SDF to Mesh to perform 3D rendering and other operations. The Mesh structure can be directly converted to SDF format, but SDF requires a series of processing to convert it into a more universal Mesh structure. In the process of converting SDF to Mesh, more tetrahedron resources will be occupied, thereby reducing the efficiency of 3D model generation. Summary of the invention

[0004] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defect that in the process of converting SDF to Mesh in the prior art, tetrahedron resources of the full scale range are generally used to assist in the conversion. In this process, as the density of the tetrahedron resources used increases, a large number of meaningless tetrahedron areas will be generated, which will reduce the computational efficiency and increase resource consumption, thereby reducing the efficiency of three-dimensional model generation.

[0005] In a first aspect, the present application provides a three-dimensional model generation method, the method comprising:

[0006] Obtaining an objective function model, and generating an initial three-dimensional model according to the objective function model and a grid structure in a video memory;

[0007] Using the initial three-dimensional model to update the objective function model;

[0008] When the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the density of the grid structure in the video memory is inconsistent with the pre-agreed density, the initial three-dimensional model is expanded to obtain a first target structure;

[0009] Determine a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, and obtain a second target structure formed by each target tetrahedron in the first target structure in the target tetrahedral mesh;

[0010] The grid structure in the video memory is updated according to the second target structure, and the step of obtaining the target function model and its subsequent steps are continued until the update number of the target function model reaches a preset threshold, and the target three-dimensional model is generated according to the updated target function model and the grid structure in the video memory.

[0011] In one embodiment, the process of constructing the offline resource pool includes:

[0012] Obtaining preset limit range and preset density parameters;

[0013] Constructing a plurality of tetrahedral grids with different densities based on the density parameters within the limit range;

[0014] Determine the vertex array and tetrahedron index array corresponding to each tetrahedron mesh;

[0015] Each tetrahedral mesh and its corresponding vertex array and tetrahedral index array are stored in a preset resource pool to obtain the offline resource pool.

[0016] In one embodiment, the step of acquiring, in the target tetrahedron grid, a second target structure formed by each target tetrahedron within the first target structure comprises:

[0017] Determining an SDF characterization function of the first target structure;

[0018] Acquire the vertex array and tetrahedron index array of the target tetrahedron mesh, and determine the target tetrahedron in the target tetrahedron mesh according to the SDF characterization function and the vertex array and tetrahedron index array of the target tetrahedron mesh;

[0019] A grid structure formed by each target tetrahedron in the target tetrahedron grid is determined as a second target structure, and the second target structure is acquired.

[0020] In one embodiment, the step of determining a target tetrahedron in the target tetrahedron grid comprises:

[0021] Determine, according to the vertex array of the target tetrahedral mesh, a plurality of vertices corresponding to the target tetrahedral mesh;

[0022] According to the SDF characterization function, respectively determining the distance between each vertex of the target tetrahedral mesh and the surface of the first target structure;

[0023] determining a vertex whose distance from the surface of the first target structure is a negative number as a target vertex;

[0024] A tetrahedron index whose four vertices are all the target vertices is determined in the tetrahedron index array, and a target tetrahedron is determined in the target tetrahedron mesh according to the determined tetrahedron index.

[0025] In one embodiment, the step of updating the objective function model using the initial three-dimensional model includes:

[0026] Determining an expected loss function based on the initial three-dimensional model;

[0027] Calculating the gradient of the expected loss function to the objective function model based on the expected loss function;

[0028] The parameters of the objective function model are updated using the gradient of the expected loss function with respect to the objective function model.

[0029] In one embodiment, the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool includes:

[0030] Obtaining a preset density table, and obtaining the number of updates of the objective function model as a target value;

[0031] The density corresponding to the target value is queried in the density table, and a target tetrahedral mesh matching the density is determined in the offline resource pool.

[0032] In one embodiment, before executing the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, the method further includes:

[0033] Determining a modeling category of the initial three-dimensional model, and judging whether the first target structure needs to be divided according to the modeling category;

[0034] If yes, the first target structure is divided into a plurality of substructures, and for each substructure, the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps thereof are respectively performed;

[0035] If not, continue to execute the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps.

[0036] In one embodiment, the method further comprises:

[0037] The region corresponding to each substructure is determined in the target three-dimensional model, and the overlaps between the determined regions are reconstructed to obtain a final target three-dimensional model.

[0038] In a second aspect, the present application provides a three-dimensional model generation device, the device comprising:

[0039] A model generation module, used to obtain an objective function model and generate an initial three-dimensional model according to the objective function model and a grid structure in a video memory;

[0040] A model updating module, used to update the objective function model using the initial three-dimensional model;

[0041] A model expansion module, configured to expand the initial three-dimensional model to obtain a first target structure when the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the density of the grid structure in the video memory is inconsistent with a pre-agreed density;

[0042] A range selection module, used to determine a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, and to obtain a second target structure formed by each target tetrahedron within the first target structure in the target tetrahedral mesh;

[0043] A video memory update module is used to update the grid structure in the video memory according to the second target structure. After the update, the model generation module, the model update module, the model expansion module, the range selection module and the video memory update module continue to execute until the update number of the objective function model reaches a preset threshold, and a target three-dimensional model is generated according to the updated objective function model and the grid structure in the video memory.

[0044] In a third aspect, the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the three-dimensional model generation method described in any of the above embodiments.

[0045] In a fourth aspect, the present application provides a computer device, comprising: one or more processors, and a memory;

[0046] The memory stores computer-readable instructions, and when the one or more processors execute the computer-readable instructions, the steps of the three-dimensional model generation method described in any one of the above embodiments are performed.

[0047] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0048] The present application provides a three-dimensional model generation method, device, storage medium and computer equipment, the method comprising: in the process of three-dimensional model generation, obtaining a target function model to generate an initial three-dimensional model in combination with a grid structure in a video memory, and using the initial three-dimensional model to update the target function model, when the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the grid density in the video memory is inconsistent with the pre-agreed density, the former means that the grid structure in the video memory cannot effectively update the initial three-dimensional model, and the latter means that a higher density grid structure needs to be replaced to model the initial three-dimensional model more finely. Therefore, it is necessary to update the grid structure in the video memory, and when updating, the target tetrahedral grid of the corresponding density is uniformly provided by the offline resource pool, so that the generation range of the target tetrahedral grid determined each time is consistent, which ensures that the density distribution of the finally generated three-dimensional model is uniform, so as to improve the display effect of the three-dimensional model. Then, a second target structure formed by each target tetrahedron within the first target structure is obtained in the target tetrahedral mesh. Therefore, the second target structure is a structure with a shape similar to the first target structure and a range smaller than the target tetrahedral mesh. Compared with the method of updating using a complete tetrahedral mesh, updating the grid structure in the video memory with the second target structure can save computing resources and video memory resources, thereby improving the efficiency of 3D model generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0050] Figure 1 A schematic diagram of a process for generating a three-dimensional model provided in an embodiment of the present application;

[0051] Figure 2 A schematic flow chart of the steps of obtaining a second target structure formed by each target tetrahedron within a first target structure in a target tetrahedron grid provided in an embodiment of the present application;

[0052] Figure 3A schematic flow chart of the steps of determining a target tetrahedron in a target tetrahedron grid provided in an embodiment of the present application;

[0053] Figure 4 An example diagram of a three-dimensional model generation method provided in an embodiment of the present application;

[0054] Figure 5 A schematic diagram of the structure of a three-dimensional model generating device provided in an embodiment of the present application;

[0055] Figure 6 An internal structure diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0057] In one embodiment, the present application provides a 3D model generation method, and the following embodiment is described by applying the method to a server. It can be understood that the 3D model generation method can be executed by a single server or a server cluster composed of multiple servers, and the present application does not make specific restrictions on this.

[0058] Specifically, in the process of converting SDF to Mesh, tetrahedron resources of the full scale range are generally used to assist in the conversion. In this process, as the density of the tetrahedron resources used increases, a large number of meaningless tetrahedron areas will be generated, which will reduce the computational efficiency and increase resource consumption, thereby reducing the efficiency of 3D model generation. Figure 1 As shown, the present application provides a three-dimensional model generation method, the method comprising:

[0059] Step S101: Obtain an objective function model, and generate an initial three-dimensional model according to the objective function model and a grid structure in a video memory.

[0060] The target function model is a data in the form of SDF, and is an intermediate result in the process of generating a 3D model. Video memory refers to the high-speed memory on the GPU (Graphics Processing Unit) that is specifically used to store graphics data. The initial 3D model is a mesh structure data used to describe the shape and surface features of an object in 3D space.

[0061] In this step, when a 3D model needs to be generated, a corresponding shape region is first constructed according to the model category of the 3D model to be constructed. In the process of generating the 3D model, the shape region can be used to determine the objective function model of the first iteration. After that, the objective function model will be updated in each iteration to serve as the objective function model obtained in the next iteration. When the objective function model is obtained, the initial 3D model is generated according to the objective function model and the grid structure in the video memory.

[0062] Specifically, we can use some methods to convert SDF (Signed distance function) data into a mesh structure, and use the objective function model and the mesh structure in the video memory to generate an initial three-dimensional model. Common methods for converting SDF to Mesh structure include the MT (Marching Tetrahedra) algorithm, the MC (MarchingCube) algorithm, and so on.

[0063] Step S102: using the initial three-dimensional model to update the objective function model.

[0064] In this step, the objective function model is gradient-backed and calculated through the initial three-dimensional model, and then the objective function model is updated according to the rendering result of the initial three-dimensional model. It can be understood that the updated objective function model is used as the objective function model obtained in the next iteration.

[0065] Step S103: determining whether the range of the initial three-dimensional model does not exceed the range of the grid structure in the video memory and whether the density of the grid structure in the video memory is consistent with a pre-agreed density.

[0066] Step S104: when the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the density of the grid structure in the video memory is inconsistent with the pre-agreed density, the initial three-dimensional model is expanded to obtain a first target structure.

[0067] The range refers to the three-dimensional area occupied by the corresponding model or structure in the three-dimensional space. The density refers to the number of tetrahedrons contained in the unit space. The higher the density, the more tetrahedrons are contained in the unit space. The first target structure is the grid structure after the initial three-dimensional model is expanded.

[0068] It is understandable that when the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory, it means that the grid structure in the video memory cannot effectively update the initial three-dimensional model. When the density of the grid structure in the video memory is inconsistent with the pre-agreed density, it means that a higher density grid structure needs to be replaced to model the initial three-dimensional model more finely. Therefore, when one of these two situations or both situations are met, the grid structure in the video memory needs to be updated. Since the process of updating the grid structure in the video memory consumes more resources and time, it is not necessary to update the grid structure in the video memory except for the above-mentioned situations.

[0069] Specifically, whether the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory can be determined by calculating whether the minimum distance between the two is less than a preset value. In one example, the preset value can be set to 0.01.

[0070] In this step, when the range of the initial 3D model exceeds the range of the grid structure in the video memory or the density of the grid structure in the video memory is inconsistent with the pre-agreed density, there are three situations, as follows:

[0071] (1) The range of the initial 3D model exceeds the range of the grid structure in the video memory and the density of the grid structure in the video memory is consistent with the pre-agreed density.

[0072] (2) The range of the initial three-dimensional model does not exceed the range of the grid structure in the video memory and the density of the grid structure in the video memory is inconsistent with the pre-agreed density.

[0073] (3) The range of the initial 3D model exceeds the range of the grid structure in the video memory and the density of the grid structure in the video memory is inconsistent with the pre-agreed density.

[0074] When any of the above three situations is triggered, the initial 3D model can be expanded using the mesh uniform resampling method of the offset spatial distance offset to obtain the first target structure. Specifically, after the expansion operation, the 3D surface of the first target structure is smoother, and since a certain expansion range is added, it can be ensured that the initial process of generating the 3D model will not exceed the range of the mesh structure in the video memory.

[0075] Step S105: determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, and acquiring a second target structure formed by each target tetrahedron in the first target structure in the target tetrahedral mesh.

[0076] The offline resource pool is a storage space set in the hard disk. The offline resource pool includes multiple tetrahedral meshes with different densities. Moreover, the tetrahedral meshes in the offline resource pool are all generated based on the same range. The trend of the density determined in the process of generating the three-dimensional model is from low to high. The target tetrahedral mesh includes multiple tetrahedrons.

[0077] In this step, the pre-agreed density can be determined by querying the density table according to the number of updates of the objective function model. When the density is determined, the target tetrahedron mesh corresponding to the density is determined from the offline resource pool, and then each target tetrahedron inside the first target structure is determined in the target tetrahedron mesh, and the second target structure formed by each target tetrahedron is obtained in the target tetrahedron mesh. The target tetrahedron refers to the tetrahedron inside the first target structure in the target tetrahedron mesh.

[0078] It is understandable that in the actual generation process of the three-dimensional model, a tetrahedral mesh with a higher density is generally required. When the density is high, the number of vertices and faces of the tetrahedral mesh will increase greatly, so that it cannot be completely stored in the video memory or internal memory. Therefore, tetrahedral meshes of different densities are pre-generated and stored in the offline resource pool in the hard disk for reading and use during the three-dimensional model generation process. This can also reduce the pressure on the video memory, reduce the consumption of computing resources, and thus improve the efficiency of three-dimensional model generation. Moreover, since the operation of step S105 has been performed before reading the data into the video memory, the range of the second target structure obtained is smaller than the range of the target tetrahedral mesh, which can further save computing resources and video memory resources and improve the generation efficiency of the three-dimensional model.

[0079] For example, it can be set that the density is updated once every 10,000 updates of the objective function model until the maximum density is updated. The setting and update interval of the density can be determined and set based on experience or experiments. This application does not make specific restrictions on this.

[0080] Step S106: Update the grid structure in the video memory according to the second target structure, and continue to execute the step of obtaining the target function model and its subsequent steps until the number of updates of the target function model reaches a preset threshold, and then generate a target three-dimensional model according to the updated target function model and the grid structure in the video memory.

[0081] Among them, the number of updates of the objective function model can be understood as the number of iterations in the process of generating the three-dimensional model.

[0082] In this step, the second target structure can replace the grid structure in the video memory to complete the update of the grid structure in the video memory. Then, return to step S101 and continue to execute until the update number of the target function model reaches the preset threshold, and then generate the target three-dimensional model according to the updated target function model and the grid structure in the video memory. It can be understood that the preset threshold is an empirical value.

[0083] Step S107: When the range of the initial three-dimensional model does not exceed the range of the grid structure in the video memory and the density of the grid structure in the video memory is consistent with the pre-agreed density, continue to execute the step of obtaining the objective function model and its subsequent steps until the update number of the objective function model reaches a preset threshold, and then generate the target three-dimensional model based on the updated objective function model and the grid structure in the video memory.

[0084] In this step, when the range of the initial three-dimensional model does not exceed the range of the grid structure in the video memory and the density of the grid structure in the video memory is consistent with the pre-agreed density, it means that the grid structure in the video memory does not need to be updated, and the grid structure in the video memory can continue to be used to update and generate the initial three-dimensional model.

[0085] The present application provides a three-dimensional model generation method, device, storage medium and computer equipment, the method comprising: in the process of three-dimensional model generation, obtaining a target function model to generate an initial three-dimensional model in combination with a grid structure in a video memory, and using the initial three-dimensional model to update the target function model, when the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the grid density in the video memory is inconsistent with the pre-agreed density, the former means that the grid structure in the video memory cannot effectively update the initial three-dimensional model, and the latter means that a higher density grid structure needs to be replaced to model the initial three-dimensional model more finely. Therefore, it is necessary to update the grid structure in the video memory, and when updating, the target tetrahedral grid of the corresponding density is uniformly provided by the offline resource pool, so that the generation range of the target tetrahedral grid determined each time is consistent, which ensures that the density distribution of the finally generated three-dimensional model is uniform, so as to improve the display effect of the three-dimensional model. Then, a second target structure formed by each target tetrahedron within the first target structure is obtained in the target tetrahedral mesh. Therefore, the second target structure is a structure with a shape similar to the first target structure and a range smaller than the target tetrahedral mesh. Compared with the method of updating using a complete tetrahedral mesh, updating the grid structure in the video memory with the second target structure can save computing resources and video memory resources, thereby improving the efficiency of 3D model generation.

[0086] In one embodiment, the process of building an offline resource pool includes:

[0087] Obtaining preset limit range and preset density parameters;

[0088] Construct multiple tetrahedral meshes with different densities based on density parameters within the limit range;

[0089] Determine the vertex array and tetrahedron index array corresponding to each tetrahedron mesh;

[0090] Each tetrahedral mesh and its corresponding vertex array and tetrahedral index array are stored in a preset resource pool to obtain an offline resource pool.

[0091] Among them, the limit range refers to the size range of the constructed tetrahedral mesh. The density parameter includes the density of the tetrahedral mesh to be generated. The vertex array includes multiple three-dimensional points, each of which represents the vertex coordinates in the tetrahedral mesh, and the tetrahedral index array includes the indexes of multiple tetrahedrons and the sequence number of the vertex of each tetrahedron in the vertex array. The tetrahedral mesh is composed of multiple tetrahedrons. Each tetrahedron is composed of four triangular faces. In an example, the limit range can be set to the space formed by the [0, 1] range of the X, Y, and Z axes.

[0092] It will be appreciated that the vertices in the tetrahedral mesh include the vertices of each tetrahedron in the tetrahedral mesh.

[0093] In this embodiment, a plurality of tetrahedral meshes with different densities are generated according to density parameters within a preset limit range for use in the three-dimensional model generation process. On the one hand, since each tetrahedral mesh is generated based on the same limit range, the shape of each tetrahedral mesh can be guaranteed to be completely equal, so that the size of the triangles in the generated initial three-dimensional model can be distributed as evenly as possible. This improves the display effect of the final generated three-dimensional model. On the other hand, pre-generating the required tetrahedral meshes of different densities can avoid occupying too many video memory resources, thereby improving the efficiency of three-dimensional model generation.

[0094] like Figure 2 As shown, in one embodiment, the step of acquiring a second target structure formed by each target tetrahedron in the first target structure in the target tetrahedron grid includes:

[0095] Step S201: Determine the SDF characterization function of the first target structure.

[0096] The SDF characterization function is used to represent the distance from any point in the three-dimensional space to the surface of the first target structure.

[0097] In this step, the corresponding SDF characterization function is determined according to the position and range of the first target structure in the three-dimensional space, so that it can be determined whether a point in the three-dimensional space is inside the first target structure according to the SDF characterization function.

[0098] Step S202: Acquire the vertex array and tetrahedron index array of the target tetrahedron mesh, and determine the target tetrahedron in the target tetrahedron mesh according to the SDF characterization function and the vertex array and tetrahedron index array of the target tetrahedron mesh.

[0099] In this step, when the target tetrahedral mesh is determined from the offline resource pool, the vertex array and tetrahedral index array of the target tetrahedral mesh can be obtained, and then the target tetrahedron can be determined in the target tetrahedral mesh according to the SDF characterization function and the vertex array and tetrahedral index array of the target tetrahedral mesh.

[0100] Step S203: determining a grid structure formed by each target tetrahedron in the target tetrahedron grid as a second target structure, and acquiring the second target structure.

[0101] In this step, when the target tetrahedrons in the target tetrahedron mesh are determined, a second target structure formed by each target tetrahedron can be determined in the target tetrahedron mesh, so that the second target structure can be subsequently read into the video memory to replace the grid structure in the video memory.

[0102] It can be understood that the second target structure formed by each target tetrahedron in the first target structure is obtained in the target tetrahedron mesh. It can be seen that the second target structure is a mesh structure with a shape similar to the first target structure and a smaller range than the target tetrahedron mesh. Compared with the method of directly using the complete tetrahedron mesh to update the video memory, obtaining the second target structure from the offline resource pool and updating the mesh structure in the video memory with the second target structure can save a lot of computing resources and video memory resources, thereby improving the efficiency of 3D model generation.

[0103] like Figure 3 As shown, in one embodiment, the step of determining a target tetrahedron in a target tetrahedron mesh comprises:

[0104] Step S301: determining a plurality of vertices corresponding to the target tetrahedral mesh according to the vertex array of the target tetrahedral mesh.

[0105] Step S302: According to the SDF characterization function, the distance between each vertex of the target tetrahedral mesh and the surface of the first target structure is determined respectively.

[0106] In this step, since the SDF characterization function is used to represent the distance from any point in the three-dimensional space to the surface of the first target structure, and the vertices corresponding to the target tetrahedral mesh belong to the points in the three-dimensional space, the distance between each order in the target tetrahedral mesh and the surface of the first target structure can be determined separately according to the SDF characterization function.

[0107] Step S303: Determine a vertex whose distance to the surface of the first target structure is a negative number as a target vertex.

[0108] It is understandable that when the distance between a point in the three-dimensional space and the surface of the first target structure is a negative number, it means that the point is inside the first target structure. In this step, the vertices inside the first target structure among the multiple vertices corresponding to the target tetrahedral mesh are determined as target vertices.

[0109] Step S304: determining in the tetrahedron index array a tetrahedron index whose four vertices are all target vertices, and determining a target tetrahedron in the target tetrahedron mesh according to the determined tetrahedron index.

[0110] In this step, since the tetrahedron index array includes the index of each tetrahedron in the target tetrahedron mesh and the serial number of each tetrahedron's vertex in the vertex array, it is possible to determine whether each tetrahedron's vertex is a target vertex through the tetrahedron index array and the vertex array. When there is a tetrahedron whose four vertices are all target vertices, the tetrahedron is determined as the target tetrahedron. It can be understood that the target tetrahedron is a tetrahedron inside the first target structure in the target tetrahedron mesh.

[0111] It is understandable that by determining the portion of the target tetrahedral mesh that is inside the first target structure through the tetrahedral index array and the vertex array, data for updating the mesh structure in the video memory can be quickly determined, thereby improving the efficiency of generating the three-dimensional model.

[0112] In one embodiment, the step of updating the objective function model using the initial three-dimensional model includes:

[0113] Determine an expected loss function based on the initial three-dimensional model;

[0114] Calculate the gradient of the expected loss function to the objective function model based on the expected loss function;

[0115] The parameters of the objective function model are updated using the gradient of the expected loss function to the objective function model.

[0116] Among them, the expected loss function is used to measure the difference between the initial three-dimensional model and the expected three-dimensional model.

[0117] In this embodiment, the expected loss function is determined, and based on this, the gradient of the expected loss function to the objective function model is calculated, and then the parameters of the objective function model are updated according to the gradient to obtain a new objective function model. Therefore, the objective function model used in each iteration is the updated objective function model in the previous iteration. By continuously returning the gradient, the initial three-dimensional model can be brought closer to the expected three-dimensional model, thereby improving the modeling accuracy of the three-dimensional model.

[0118] In one embodiment, the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool includes:

[0119] Obtain a preset density table, and obtain the update times of the objective function model as the target value;

[0120] The density corresponding to the target value is queried in the density table, and a target tetrahedral mesh matching the density is determined in the offline resource pool.

[0121] The density table is used to represent the corresponding relationship between the update times of the objective function model and the density. And, as the update times of the objective function model increase, the density tends to be from low to high.

[0122] In this embodiment, the number of updates of the current objective function model is obtained, and the obtained number of updates is determined as the target value, and then a density table is obtained, and the density corresponding to the target value is queried in the density table to determine the target tetrahedral mesh matching the density in the offline resource pool.

[0123] It is understandable that by presetting the density table, and as the number of updates of the objective function model increases, the density trend is from low to high. Therefore, in the early stage of 3D model generation, a tetrahedral mesh with lower density can be used to save computing resources and computing time. In the later stage of 3D model generation, since the general shape of the 3D model has been determined, the main task in the later stage is to fill in the details. The shape changes will become smaller and smaller, and the generated details will become more and more. Therefore, a tetrahedral mesh with higher density can be used in the later stage. In this way, the modeling accuracy of the 3D model can be improved while saving computing resources as much as possible.

[0124] In one embodiment, before executing the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, the three-dimensional model generation method further includes:

[0125] Determining a modeling category of the initial three-dimensional model, and judging whether the first target structure needs to be divided according to the modeling category;

[0126] If yes, the first target structure is divided into a plurality of substructures, and for each substructure, the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps thereof are respectively performed;

[0127] If not, continue to execute the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps.

[0128] The modeling category refers to the category of the three-dimensional model to be generated, such as an object, a human body, and the like.

[0129] In this embodiment, it can be determined whether different areas of the three-dimensional model to be generated have different requirements according to the modeling category. When it is determined that the first target structure needs to be divided, the modeling information corresponding to the modeling category can be obtained to determine the part to be divided. After being divided into multiple substructures, for each substructure, the step of determining the target tetrahedral mesh corresponding to the pre-agreed density from the preset offline resource pool and its subsequent steps are respectively executed, and finally the target three-dimensional model with areas of different fineness is obtained.

[0130] For example, when three-dimensional modeling of a human body is performed, if the accuracy requirement for the head is high and the accuracy requirement for the body is low, the region can be divided and updated using tetrahedral meshes of different densities to achieve the purpose of constructing a three-dimensional model of composite density. In this way, video memory resources can be used more efficiently, resource utilization can be improved, and the efficiency of three-dimensional model generation can be improved while meeting modeling requirements.

[0131] In one embodiment, the three-dimensional model generation method further includes:

[0132] The region corresponding to each substructure is determined in the target three-dimensional model, and the overlaps between the determined regions are reconstructed to obtain the final target three-dimensional model.

[0133] In this embodiment, since multiple substructures are divided and tetrahedral meshes of different densities are used, the target 3D model finally obtained will have discontinuity problems at the overlaps of different densities. Therefore, the overlaps between the regions corresponding to each substructure in the target 3D model can be reconstructed to optimize the display effect of the target 3D model.

[0134] In one example, a Screened Poisson surface reconstruction algorithm may be used for reconstruction.

[0135] In one example, if Figure 4 As shown, Figure 4An example diagram of a three-dimensional model generation method provided for an embodiment of the present application. Among them, Tets video memory resources represent the grid structure in the video memory, and are also the second target structure obtained each time, SDF_model refers to the objective function model, the intermediate Mesh result refers to the initial three-dimensional model, SDF_tets refers to the SDF characterization function, Tets offline resources represent the resources in the offline resource pool, and updating Tets represents updating the grid structure in the video memory. Model update represents the process of updating the objective function model. It can be understood that the tth iteration in the figure needs to update the grid structure in the video memory, while the t+1th iteration in the figure does not need to update the grid structure in the video memory.

[0136] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0137] The following is a description of a three-dimensional model generation device provided in an embodiment of the present application. The three-dimensional model generation device described below and the three-dimensional model generation method described above can be referenced to each other.

[0138] like Figure 5 As shown, the present application provides a three-dimensional model generation device 400, the device comprising:

[0139] The model generation module 401 is used to obtain the target function model and generate an initial three-dimensional model according to the target function model and the grid structure in the video memory;

[0140] A model updating module 402 is used to update the objective function model using the initial three-dimensional model;

[0141] The model expansion module 403 is used to expand the initial three-dimensional model to obtain a first target structure when the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the density of the grid structure in the video memory is inconsistent with the pre-agreed density;

[0142] The range selection module 404 is used to determine a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, and obtain a second target structure formed by each target tetrahedron in the first target structure in the target tetrahedral mesh;

[0143] The video memory update module 405 is used to update the grid structure in the video memory according to the second target structure. After the update, the model generation module, the model update module, the model expansion module, the range selection module and the video memory update module continue to execute until the update number of the target function model reaches a preset threshold, and the target three-dimensional model is generated according to the updated target function model and the grid structure in the video memory.

[0144] In one embodiment, the three-dimensional model generating device comprises:

[0145] An information acquisition module, used to obtain a preset limit range and a preset density parameter;

[0146] A mesh construction module is used to construct multiple tetrahedral meshes with different densities based on density parameters within a limit range;

[0147] An array determination module, used for determining the vertex array and tetrahedron index array corresponding to each tetrahedron mesh;

[0148] The resource pool generation module is used to store each tetrahedral mesh and its corresponding vertex array and tetrahedral index array into a preset resource pool to obtain an offline resource pool.

[0149] In one embodiment, the range selection module includes:

[0150] A function determination submodule, used to determine the SDF characterization function of the first target structure;

[0151] A tetrahedron determination submodule is used to obtain a vertex array and a tetrahedron index array of a target tetrahedron mesh, and determine a target tetrahedron in the target tetrahedron mesh according to an SDF characterization function and the vertex array and the tetrahedron index array of the target tetrahedron mesh;

[0152] The structure determination submodule is used to determine the grid structure formed by each target tetrahedron in the target tetrahedron grid as the second target structure, and obtain the second target structure.

[0153] In one embodiment, the tetrahedron determination submodule includes:

[0154] A vertex determination unit, used for determining a plurality of vertices corresponding to the target tetrahedral mesh according to the vertex array of the target tetrahedral mesh;

[0155] A distance determination unit, used to determine the distance between each vertex of the target tetrahedral mesh and the surface of the first target structure according to the SDF characterization function;

[0156] a target vertex determination unit, configured to determine a vertex whose distance to the surface of the first target structure is a negative number as a target vertex;

[0157] The tetrahedron determination unit is used to determine the tetrahedron index whose four vertices are all target vertices in the tetrahedron index array, and determine the target tetrahedron in the target tetrahedron grid according to the determined tetrahedron index.

[0158] In one embodiment, the model updating module includes:

[0159] A loss function determination submodule, used to determine an expected loss function based on an initial three-dimensional model;

[0160] The gradient calculation submodule is used to calculate the gradient of the expected loss function to the objective function model based on the expected loss function;

[0161] The parameter updating submodule is used to update the parameters of the objective function model using the gradient of the expected loss function to the objective function model.

[0162] In one embodiment, the range selection module includes:

[0163] The density table acquisition submodule is used to obtain a preset density table and obtain the update times of the objective function model as a target value;

[0164] The mesh determination submodule is used to query the density corresponding to the target value in the density table and determine the target tetrahedral mesh matching the density in the offline resource pool.

[0165] In one embodiment, the three-dimensional model generating device further comprises:

[0166] A division judgment module is used to determine the modeling category of the initial three-dimensional model and determine whether the first target structure needs to be divided according to the modeling category;

[0167] a structure division module, for dividing the first target structure into a plurality of substructures, and for each substructure, respectively executing the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps thereof;

[0168] The continuing execution module is used for, if not, continuing to execute the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps.

[0169] In one embodiment, the three-dimensional model generating device further includes:

[0170] The model reconstruction module is used to determine the area corresponding to each substructure in the target three-dimensional model, and reconstruct the overlaps between the determined areas to obtain the final target three-dimensional model.

[0171] The division of each module in the above-mentioned three-dimensional model generation device is only for illustration. In other embodiments, the three-dimensional model generation device can be divided into different modules as needed to complete all or part of the functions of the above-mentioned three-dimensional model generation device. Each module in the above-mentioned three-dimensional model generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0172] In one embodiment, the present application also provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the three-dimensional model generation method described in any of the above embodiments.

[0173] In one embodiment, the present application also provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the three-dimensional model generation method as described in any one of the above embodiments.

[0174] Indicatively, if Figure 6 As shown, Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 500 may be provided as a server. Figure 6 The computer device 500 includes a processing component 502, which further includes one or more processors, and a memory resource represented by a memory 501, for storing instructions executable by the processing component 502, such as an application. The application stored in the memory 501 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 502 is configured to execute instructions to perform the three-dimensional model generation method of any of the above embodiments.

[0175] The computer device 500 may further include a power supply component 503 configured to perform power management of the computer device 500, a wired or wireless network interface 504 configured to connect the computer device 500 to a network, and an input / output (I / O) interface 505. The computer device 500 may operate based on an operating system stored in the memory 501, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

[0176] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0177] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish an entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only include those elements, but also include other elements that are not clearly listed, or also include elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements limited by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. Herein, the singular "one", "one" and "described / the" may also include plural forms, unless the context clearly indicates another way. It should also be understood that the terms "include / comprise" or "have" etc. specify the existence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the existence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof. At the same time, the term "and / or" used in this specification includes any and all combinations of the relevant listed items.

[0178] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0179] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A three-dimensional model generation method, characterized in that: The method comprises: Obtaining an objective function model, and generating an initial three-dimensional model according to the objective function model and a grid structure in a video memory; Using the initial three-dimensional model to update the objective function model; When the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the density of the grid structure in the video memory is inconsistent with the pre-agreed density, the initial three-dimensional model is expanded to obtain a first target structure; Determine a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, and obtain a second target structure formed by each target tetrahedron in the first target structure in the target tetrahedral mesh; The grid structure in the video memory is updated according to the second target structure, and the step of obtaining the target function model and its subsequent steps are continued until the update number of the target function model reaches a preset threshold, and the target three-dimensional model is generated according to the updated target function model and the grid structure in the video memory.

2. The three-dimensional model generation method according to claim 1, characterized in that: The offline resource pool construction process includes: Obtaining preset limit range and preset density parameters; Constructing a plurality of tetrahedral grids with different densities based on the density parameters within the limit range; Determine the vertex array and tetrahedron index array corresponding to each tetrahedron mesh; Each tetrahedral mesh and its corresponding vertex array and tetrahedral index array are stored in a preset resource pool to obtain the offline resource pool.

3. The three-dimensional model generation method according to claim 1, characterized in that: The step of acquiring, in the target tetrahedral grid, a second target structure formed by each target tetrahedron within the first target structure comprises: Determining an SDF characterization function of the first target structure; Acquire the vertex array and tetrahedron index array of the target tetrahedron mesh, and determine the target tetrahedron in the target tetrahedron mesh according to the SDF characterization function and the vertex array and tetrahedron index array of the target tetrahedron mesh; A grid structure formed by each target tetrahedron in the target tetrahedron grid is determined as a second target structure, and the second target structure is acquired.

4. The three-dimensional model generation method according to claim 3, characterized in that: The step of determining a target tetrahedron in the target tetrahedron grid comprises: Determine, according to the vertex array of the target tetrahedral mesh, a plurality of vertices corresponding to the target tetrahedral mesh; According to the SDF characterization function, respectively determining the distance between each vertex of the target tetrahedral mesh and the surface of the first target structure; determining a vertex whose distance from the surface of the first target structure is a negative number as a target vertex; A tetrahedron index whose four vertices are all the target vertices is determined in the tetrahedron index array, and a target tetrahedron is determined in the target tetrahedron mesh according to the determined tetrahedron index.

5. The three-dimensional model generation method according to claim 1, characterized in that: The step of updating the objective function model using the initial three-dimensional model comprises: Determining an expected loss function based on the initial three-dimensional model; Calculating the gradient of the expected loss function to the objective function model based on the expected loss function; The parameters of the objective function model are updated using the gradient of the expected loss function with respect to the objective function model.

6. The three-dimensional model generation method according to claim 1, characterized in that: The step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool comprises: Obtaining a preset density table, and obtaining the number of updates of the objective function model as a target value; The density corresponding to the target value is queried in the density table, and a target tetrahedral mesh matching the density is determined in the offline resource pool.

7. The three-dimensional model generation method according to any one of claims 1 to 6, characterized in that: Before executing the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, the method further includes: Determining a modeling category of the initial three-dimensional model, and judging whether the first target structure needs to be divided according to the modeling category; If yes, the first target structure is divided into a plurality of substructures, and for each substructure, the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps thereof are respectively performed; If not, continue to execute the step of determining a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool and subsequent steps.

8. The three-dimensional model generation method according to claim 7, characterized in that: The method further comprises: The region corresponding to each substructure is determined in the target three-dimensional model, and the overlaps between the determined regions are reconstructed to obtain a final target three-dimensional model.

9. A three-dimensional model generating device, characterized in that: The device comprises: A model generation module, used to obtain an objective function model and generate an initial three-dimensional model according to the objective function model and a grid structure in a video memory; A model updating module, used to update the objective function model using the initial three-dimensional model; A model expansion module, configured to expand the initial three-dimensional model to obtain a first target structure when the range of the initial three-dimensional model exceeds the range of the grid structure in the video memory or the density of the grid structure in the video memory is inconsistent with a pre-agreed density; A range selection module, used to determine a target tetrahedral mesh corresponding to a pre-agreed density from a preset offline resource pool, and to obtain a second target structure formed by each target tetrahedron within the first target structure in the target tetrahedral mesh; A video memory update module is used to update the grid structure in the video memory according to the second target structure. After the update, the model generation module, the model update module, the model expansion module, the range selection module and the video memory update module continue to execute until the update number of the objective function model reaches a preset threshold, and a target three-dimensional model is generated according to the updated objective function model and the grid structure in the video memory.

10. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the three-dimensional model generation method as described in any one of claims 1 to 8.

11. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the three-dimensional model generation method according to any one of claims 1 to 8 are performed.