Three-dimensional model retopology method, device, equipment and storage medium

By presetting the correspondence between three-dimensional vertices and triangular face sheets and the initial center of gravity coordinates, the target spatial coordinates are calculated, and the problem of geometric shape differences in the re-topology of the three-dimensional face model is solved, the topology accuracy and similarity are improved, and the texture is realized Reuse of maps.

CN116993955BActive Publication Date: 2024-11-08NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310797866.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2024-11-08
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

Due to the sparseness of semantic key points, the geometric shape of the re-topology result differs from the source triangle mesh model due to the difference in the geometric shape of the re-topology result.

Method used

Through the corresponding relationship between preset three-dimensional vertices and triangular faces, determine the triangle faces corresponding to each vertex on the target three-dimensional grid model, and calculate the target spatial coordinates of each vertices based on the initial center of gravity coordinates, and modify the target three-dimensional grid model. vertex coordinates for higher precision re-topology.

Benefits of technology

The accuracy and similarity of the re-topology of the three-dimensional mesh model are improved, making the re-topology results closer to the source three-dimensional mesh model, and can adaptively describe any position on the surface of the three-dimensional mesh model, realizing effective multiplexing of texture maps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116993955B_ABST
    Figure CN116993955B_ABST
Patent Text Reader

Abstract

The present application provides a three-dimensional model retopology method, device, equipment and storage medium, which relates to the field of three-dimensional model technology. The method includes: according to the preset correspondence between three-dimensional vertices and triangular facets, respectively determining the first triangular facets corresponding to each vertex on the target three-dimensional mesh model; wherein the first triangular facet is a triangular facet of the source three-dimensional mesh model; according to the preset correspondence between the first triangular facet and the initial barycentric coordinates, determining the initial barycentric coordinates of each vertex in the first triangular facet; according to the coordinates of each vertex in the first triangular facet and the initial barycentric coordinates corresponding to the coordinates of each vertex, determining the target space coordinates of each vertex; according to the target space coordinates of each vertex, modifying the coordinates of each vertex in the target three-dimensional mesh model to obtain a modified target three-dimensional mesh model. Compared with the prior art, the problem that the geometric shape of the retopology result is different from the source triangular mesh model is avoided.
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 models, and in particular to a three-dimensional model retopology method, device, equipment and storage medium. Background Art

[0002] In recent years, the retopology methods of 3D face models have been widely developed and applied in many graphics related fields. The current mainstream retopology schemes of 3D face models are mainly based on semantic key points.

[0003] The existing retopology scheme for 3D face model based on semantic key points can obtain a retopology result that is closer in geometry to the source triangular mesh model to a certain extent by maintaining the consistency of the coordinates of the semantic key points of the retopology result and the source triangular mesh model.

[0004] However, due to the sparsity of semantic keypoints, the geometry of the retopology result may be different from the source triangular mesh model. Summary of the invention

[0005] The purpose of this application is to provide a three-dimensional model retopology method, device, equipment and storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the problem in the prior art that the geometric shape of the retopology result may be different from the source triangular mesh model.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a three-dimensional model retopology method, the method comprising:

[0008] According to the preset correspondence between three-dimensional vertices and triangular facets, first triangular facets corresponding to each vertex on the target three-dimensional mesh model are determined respectively; wherein the first triangular facet is a triangular facet of the source three-dimensional mesh model;

[0009] Determining the initial barycentric coordinates of each of the vertices in the first triangular facet according to the correspondence between the preset first triangular facet and the initial barycentric coordinates;

[0010] Determine the target space coordinates of each vertex according to the coordinates of each vertex in the first triangular face and the initial centroid coordinates corresponding to the coordinates of each vertex;

[0011] According to the target space coordinates of each vertex, the coordinates of each vertex in the target three-dimensional mesh model are modified to obtain a modified target three-dimensional mesh model.

[0012] In a second aspect, another embodiment of the present application provides a three-dimensional model retopology device, the device comprising: a determination module and a modification module, wherein:

[0013] The determination module is used to determine the first triangular facets corresponding to each vertex on the target three-dimensional mesh model according to the preset correspondence between the three-dimensional vertices and the triangular facets; wherein the first triangular facet is a triangular facet of the source three-dimensional mesh model; according to the preset correspondence between the first triangular facet and the initial barycentric coordinates, determine the initial barycentric coordinates of each vertex in the first triangular facet; according to the coordinates of each vertex in the first triangular facet and the initial barycentric coordinates corresponding to the coordinates of each vertex, determine the target space coordinates of each vertex;

[0014] The modification module is used to modify the coordinates of each vertex in the target three-dimensional mesh model according to the target space coordinates of each vertex to obtain a modified target three-dimensional mesh model.

[0015] In the third aspect, another embodiment of the present application provides a three-dimensional model retopology device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, when the three-dimensional model retopology device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of any method described in the first aspect above.

[0016] In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any method described in the first aspect are executed.

[0017] The beneficial effect of the present application is: by adopting the three-dimensional model retopology method provided by the present application, the first triangular facet corresponding to each vertex on the target three-dimensional mesh model can be directly determined through the preset correspondence between the three-dimensional vertices and the triangular facets, and the initial barycentric coordinates of each vertex in the first triangular facet can be determined according to the preset correspondence between the first triangular facet and the initial barycentric coordinates, and then the target space coordinates of each vertex are determined according to the coordinates of each vertex in the first triangular facet and the initial barycentric coordinates corresponding to the coordinates of each vertex, and the coordinates of each vertex in the target three-dimensional mesh model are modified to the target center coordinates of each vertex, so as to realize the retopology from the source three-dimensional mesh model to the target three-dimensional mesh model. Such a topology method only needs to preset the correspondence between the three-dimensional vertices and the triangular facets and the correspondence between the first triangular facet and the initial barycentric coordinates, so as to realize the adaptive use of the center coordinates, accurately describe any position on the surface of the three-dimensional mesh model, improve the accuracy of the three-dimensional mesh model retopology, and thus significantly improve the similarity between the retopology result and the source three-dimensional mesh model. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A schematic diagram of a process flow of a three-dimensional model retopology method provided in one embodiment of the present application;

[0020] Figure 2 A schematic diagram of a process flow of a three-dimensional model retopology method provided in another embodiment of the present application;

[0021] Figure 3 A comparison diagram of the effects of a three-dimensional model retopology method provided in one embodiment of the present application;

[0022] Figure 4 A schematic diagram of a process flow of a three-dimensional model retopology process provided in an embodiment of the present application;

[0023] Figure 5 A schematic diagram of a process flow of a three-dimensional model retopology process provided in another embodiment of the present application

[0024] Figure 6 A schematic diagram of the structure of a three-dimensional model retopology device provided in one embodiment of the present application;

[0025] Figure 7A schematic diagram of the structure of a three-dimensional model retopology device provided in another embodiment of the present application;

[0026] Figure 8 A schematic diagram of the structure of a three-dimensional model retopology device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings 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.

[0028] To facilitate understanding of the embodiments of the present application, some of the terms designed in the present application are explained below:

[0029] 3D face model: The 3D face model contains a triangular mesh model to represent the geometric information of the face, and one or more texture maps to represent the color and material information of the face.

[0030] Triangular mesh model: A triangular mesh model is a geometric model composed of multiple triangular meshes, where each triangle consists of three vertices and three edges. The basic unit in the triangular mesh model is the triangle.

[0031] Texture mapping: Texture mapping is a technology that establishes a mapping between a two-dimensional image and the surface of a three-dimensional model. It maps each face of the three-dimensional model to a two-dimensional image by assigning a two-dimensional mapping coordinate on a texture map to each vertex of the three-dimensional model.

[0032] Retopology: Retopology refers to the reconstruction of the facet topology of a geometric object in 3D geometric modeling while keeping the shape of the geometric object basically unchanged, thereby changing its facet topology properties, including the number of vertices and faces, surface wiring structure, etc.

[0033] Barycentric coordinates: Barycentric coordinates are a method of representing the position of a point on a triangular mesh, used to determine the position of a point within a triangle. It consists of three weight values, each of which represents the relationship between the point and the three vertices of the triangle. The coordinates of the three vertices of the triangle are multiplied by the weight value of the barycentric coordinates and summed to obtain the position coordinates of the point.

[0034] Rasterization: Rasterization is a technology that establishes a mapping between two-dimensional pixels and triangular mesh models. It maps the triangular mesh model to a two-dimensional plane and checks the corresponding triangle index and centroid coordinates for each pixel of the two-dimensional image to calculate the mapping relationship between each pixel and the triangular mesh model.

[0035] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0036] In addition, the flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of this application, and can also remove one or more operations from the flowchart.

[0037] The following is an explanation of a three-dimensional model retopology method provided in an embodiment of the present application in combination with a number of specific application examples. Figure 1 A schematic diagram of a process of retopology of a three-dimensional model provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method includes:

[0038] S101: Determine first triangular facets corresponding to respective vertices on a target three-dimensional mesh model according to a preset correspondence relationship between three-dimensional vertices and triangular facets.

[0039] The first triangular face is a triangular face of the source three-dimensional mesh model.

[0040] Although the retopology of a three-dimensional face model is used as an example to illustrate the embodiment of the present application, it should be understood that the retopology of the three-dimensional model provided by the present application can be applied to any retopology scenario of the three-dimensional model, such as the retopology of a three-dimensional face model, the retopology of a three-dimensional car model, the retopology of a three-dimensional house model, and any other scenario that requires retopology of the three-dimensional model. The application scenario can be flexibly adjusted according to user needs and is not limited to the above embodiments.

[0041] In the embodiment of the present application, for example, the correspondence between the preset three-dimensional vertices and the triangular facets is recorded as {f i}, for any given source 3D mesh model S′ to be processed A , according to {f i}, determine the target 3D mesh model For each vertex v i Corresponding to S′ A The first triangle in .

[0042] The determination method may be, for example:i}, for example, includes a target 3D mesh model For each vertex v i Corresponding to S′ A The face index information of the first triangle face in , given any S′ to be processed A Afterwards, you can directly For each vertex v i and {f i},Sure For each vertex v i The corresponding patch index f i , and according to f i In S′ A Determine the first triangle corresponding to the index information, and determine f i The three vertex coordinates v1, v2, v3 of the corresponding first triangle.

[0043] S102: Determine the initial centroid coordinates of each vertex in the first triangular facet according to a preset correspondence between the first triangular facet and the initial center coordinates.

[0044] In the embodiment of the present application, for example, the correspondence between the preset first triangular face and the initial center coordinate is recorded as {W i}, in determining For each vertex v i The corresponding f i After that, we can directly use {W i}Determine f i The initial barycentric coordinates w corresponding to the first triangle patch i-1 ,w i-2 ,w i-3 .

[0045] S103: Determine the target space coordinates of each vertex according to the coordinates of each vertex in the first triangular face and the initial centroid coordinates corresponding to the coordinates of each vertex.

[0046] In an optional embodiment, the given i The initial barycentric coordinates w corresponding to the first triangle patch i-1 ,w i-2 ,w i-3 Afterwards, according to Each vertex v i Corresponding to S′ A f i Vertex coordinates v1, v2, v3, determine the target space coordinates of each vertex, determine the target space coordinates For example, the method may be:

[0047] In an embodiment of the present application, V is a spatial coordinate representing the actual spatial position (x, y, z) of each of the vertices; W is a barycentric coordinate representing the correlation weight (w1, w2, w3) between each of the vertices and the three vertices of the first triangular face; during retopology, the spatial coordinates of the vertices are determined by taking the spatial coordinates of the three vertices of the first triangular face, using the target barycentric coordinates as weights, and performing weighted summation on the actual spatial position of each vertex to obtain the target spatial coordinates of each vertex.

[0048] S104: modifying the coordinates of each vertex in the target three-dimensional mesh model according to the target space coordinates of each vertex to obtain a modified target three-dimensional mesh model.

[0049] For example, The i-th vertex v i The coordinates are changed to For all After all vertices of are modified, the modified At this time, the modified That is S′ A The retopology result of the triangular mesh model.

[0050] By adopting the three-dimensional model retopology method provided in the present application, the first triangular facet corresponding to each vertex on the target three-dimensional mesh model can be directly determined through the preset correspondence between the three-dimensional vertices and the triangular facets, and the initial centroid coordinates of each vertex in the first triangular facet can be determined according to the preset correspondence between the first triangular facet and the initial centroid coordinates, and then the target space coordinates of each vertex are determined according to the coordinates of each vertex in the first triangular facet and the initial centroid coordinates corresponding to the coordinates of each vertex, and the coordinates of each vertex in the target three-dimensional mesh model are modified to the target center coordinates of each vertex, so as to realize the retopology from the source three-dimensional mesh model to the target three-dimensional mesh model. Such a topology method only needs to preset the correspondence between the three-dimensional vertices and the triangular facets and the correspondence between the first triangular facet and the initial centroid coordinates, so as to realize the adaptive use of the center coordinates, accurately describe any position on the surface of the three-dimensional mesh model, improve the accuracy of the three-dimensional mesh model retopology, and thus significantly improve the similarity between the retopology result and the source three-dimensional mesh model.

[0051] In the embodiment of the present application, a correspondence relationship between a preset three-dimensional vertex and a triangular face is established. i} method, for example, may be: respectively calculating first distances between multiple triangular faces of the source three-dimensional mesh model and each vertex of the first three-dimensional mesh model; according to the first distances, respectively determining a second triangular face corresponding to each vertex in the multiple triangular faces of the source three-dimensional mesh model; and establishing a preset correspondence between three-dimensional vertices and triangular faces based on the second triangular face corresponding to each vertex.

[0052] For example, given a triangular mesh model S representing the source topology A and the triangular mesh model S representing the target topology B , where S A and Tightly aligned on the geometric surface; in some possible embodiments, the alignment method may be, for example, adjusting the vertex positions of the first three-dimensional mesh model according to the vertex positions of the source three-dimensional mesh model; so that the vertices of the adjusted first three-dimensional mesh model are aligned with the vertex positions of the source three-dimensional mesh model.

[0053] The adjustment method may be, for example, manual adjustment by the user. B The vertex position is corrected so that the adjusted With S A Tightly align on the geometric surface; or, align S by an alignment algorithm (e.g., point cloud matching algorithm N-ICP) B The vertex position is corrected so that the adjusted With S A Tightly align on the geometric surface; the specific alignment method can be flexibly adjusted according to user needs and is not limited to the above embodiments.

[0054] In determining S A and After alignment on the geometric surface, for Every vertex v on i , calculate S A Each level 3 patch is related to v i The spatial distance between them and v i The nearest triangle is v i Corresponding second triangle patch, get the index f of each second triangle patch i After that, save All vertices v in i The corresponding f i The corresponding relationship between them, thus obtaining {f i}.

[0055] This setting is due to S A and They are aligned on the geometric surface, so in the subsequent determination of vertex v i The corresponding f i The corresponding relationship between the two is more accurate, and the corresponding relationship is determined later. Each vertex on S′ A When the correspondence between the triangles in With S′A Instead of aligning, you can directly use {f i}, accurate corresponding results can be obtained, which greatly improves the efficiency of determining the corresponding relationship between three-dimensional vertices and triangular facets.

[0056] The correspondence between the preset first triangular facet and the initial center coordinates may be established, for example, by calculating the centroid coordinates of the projection of each vertex in the corresponding second triangular facet; and establishing the correspondence between the preset first triangular facet and the initial center coordinates based on the calculation results.

[0057] In some possible embodiments, the method for determining the centroid coordinates may be, for example: determining the vectors of the three edges of the second triangular facet based on the three vertices of the second triangular facet; and calculating the centroid coordinates of the projection of the target vertex on the second triangular facet based on the vectors of the three edges.

[0058] For example, a triangular mesh model S representing the source topology is still given in the above embodiment. A and the triangular mesh model S representing the target topology B Take S as an example to illustrate. A The triangle information of S A Middle f i The three-dimensional space coordinates v of the three vertices of the triangle patch a1 ,v a2 ,v a3 Then according to the f i The three-dimensional space coordinates of the three vertices of the triangle patch, calculate the vectors of the three edges of the triangle: e1 = v a3 -v a2 , e2=v a1 -v a3 , e3=v a2 -v a1 .

[0059] On this basis, calculate v i In the f i The barycentric coordinates W of the triangle patch projection i ={w i-1 ,w i-2 ,w i-3}, the specific calculation process is as follows:

[0060]

[0061]

[0062]

[0063]

[0064] In the embodiments of the present application, it is generally required that the model type between the source three-dimensional mesh model and the first three-dimensional mesh model is the same or similar, then when retopology is performed on the source three-dimensional mesh model, the correspondence between the preset three-dimensional vertices and the triangular facets, and the correspondence between the preset first triangular facets and the initial centroid coordinates determined according to the first three-dimensional mesh model and the target three-dimensional mesh model can be used.

[0065] For example, if the model types of the source three-dimensional mesh model and the first three-dimensional mesh model are both three-dimensional face models, then when retopologically retopologically the source three-dimensional mesh model, the preset correspondence between three-dimensional vertices and triangular facets determined according to the first three-dimensional mesh model and the target three-dimensional mesh model, and the preset correspondence between the first triangular facet and the initial centroid coordinates can be used.

[0066] If the model type of the source 3D mesh model is a 3D chair model, and the model type of the first 3D mesh model is a 3D table model, that is, the model types of the source 3D mesh model and the first 3D mesh model are different, then when retopologizing the source 3D mesh model, the preset correspondence between 3D vertices and triangles determined according to the first 3D mesh model and the target 3D mesh model, and the preset correspondence between the first triangle and the initial centroid coordinates cannot be used.

[0067] This setting makes it possible for three-dimensional models of the same model type to be retopologically modified after determining the correspondence between the preset three-dimensional vertices and triangles, and the correspondence between the preset first triangle and the initial barycentric coordinates. There is no need to align the target three-dimensional mesh model and the source three-dimensional mesh model before retopology for the three-dimensional model of the model type. Instead, the correspondence between the preset three-dimensional vertices and triangles corresponding to the model type, and the correspondence between the preset first triangle and the initial barycentric coordinates can be used directly to achieve retopology for the target three-dimensional mesh model.

[0068] Moreover, three-dimensional models of different model types have a corresponding preset correspondence between three-dimensional vertices and triangular faces under the model type, and a corresponding relationship between the preset first triangular face and the initial centroid coordinates, so that each model type has its own corresponding preset correspondence, which means that the present application has wide applicability and strong scalability.

[0069] Optionally, based on the above embodiment, the embodiment of the present application may further provide a three-dimensional model retopology method. The implementation process of the above method is illustrated below in conjunction with the accompanying drawings. Figure 2 A schematic diagram of a process of retopologically resolving a three-dimensional model according to another embodiment of the present application is shown in FIG. Figure 2 As shown, the method may also include:

[0070] S111: According to a preset correspondence between the pixel position of the target texture map and the pixel position of the source texture map, the pixel position of each pixel point in the target texture map in the source texture map is determined respectively.

[0071] The target texture map is a texture map corresponding to the target three-dimensional mesh model, and the source texture map is a texture map corresponding to the source three-dimensional mesh model.

[0072] The correspondence between the pixel positions of the preset target texture map and the pixel positions of the source texture map is recorded as: That is, for any triangular mesh model S′ under the source topology to be processed A The corresponding source texture map Tex′ A , according to the preset You can determine Each pixel pix in the target texture map j In S′ A The coordinates of the corresponding pixel position in the source texture map

[0073] S112: Determine the target color of each pixel point in the target texture map according to the color corresponding to each pixel position in the source texture map.

[0074] Map the source texture Tex′ A The coordinates of the corresponding pixel position are Color Assignment The target texture map Tex B The pixel pix j Place.

[0075] S113: adjusting the color of each pixel in the target texture map according to the target color of each pixel in the target texture map to obtain a modified target texture map.

[0076] right The target texture map Tex B After all pixels in the image are assigned colors, the modified target texture map Tex′ is obtained. B , that is, according to the source texture map Tex′ A Determined retopology results.

[0077] Figure 3 This is a comparison diagram of the effects of the three-dimensional model retopology method provided in one embodiment of the present application, such as Figure 3 As shown, Figure 3 It includes: the input source 3D face model and the retopological target 3D face model, the first column of the input source 3D face model is the source 3D mesh model S′ AThe second column of the input source 3D face model is the triangular mesh model S′ under the source topology A The corresponding source texture map Tex′ A ; The input source 3D face model is retopologically retopologically performed using the calculated parameters to obtain a retopologically target 3D face model, wherein the calculated parameters include: {f i},{W i},as well as The first column in the retopological target 3D face model is the modified target 3D mesh model, and the second column in the retopological target 3D face model is the modified target texture map.

[0078] like Figure 3 As shown, it can be intuitively seen that the three-dimensional model retopology method provided by the present application can not only retopologize the three-dimensional model, but also convert the texture map corresponding to the three-dimensional model, thereby generating a modified target texture map corresponding to the retopological target three-dimensional mesh model, so that the retopological three-dimensional model can directly use the retopological target texture map, that is, after the three-dimensional model is retopological, the three-dimensional model can be rendered directly based on the modified target texture map, which solves the problem in the prior art that the source texture map cannot be used normally due to the difference between the geometric shape of the retopological three-dimensional model and the source three-dimensional mesh model, improves the efficiency of model processing, reduces the workload of model processing, and realizes the effective reuse of the source texture map.

[0079] In some possible embodiments, the correspondence between the preset target texture map pixel position and the source texture map pixel position may be established, for example, by calculating the target coordinates of the surface point of the first three-dimensional mesh model corresponding to each pixel in the texture map based on the coordinates of the texture map of the first three-dimensional mesh model; determining the second distance between each triangle patch in the source three-dimensional mesh model and the target coordinates of each pixel point; determining, based on the second distance, a third triangle patch corresponding to each pixel point in multiple triangle patches of the source three-dimensional mesh model; and establishing the correspondence between the preset target texture map pixel position and the source texture map pixel position based on the third triangle patch corresponding to each pixel point and the source texture map of each third triangle patch.

[0080] For example, the correspondence between the preset target texture map pixel position and the source texture map pixel position is established as follows:

[0081] Using rasterization technology (for example, using the pytorch3d library), according to The texture coordinates of the target texture map are calculated The target texture map Tex B In the example, each pixel pixj exist The corresponding patch index f j and the barycentric coordinates w′ j-1 ,w′ j-2 ,w′ j-3 ; According to the obtained patch index f j as well as The patch information is determined Medium j The coordinates of the three vertices included are v′ b1 ,v′ b2 ,v′ b3 , and calculate The target texture map Tex b Each pixel pix j correspond The spatial coordinates of the surface point are p j , where: p j =w′ j-1 v′ b1 +w′ j-2 v′ b2 +w′ j-3 v′ b3 .

[0082] Then, according to the calculated The target texture map Tex B Each pixel pix j correspond The surface point space coordinates p j , calculate S A Each triangle is related to p j The spatial distance between them is calculated, and the index of the nearest triangle is determined as f′ i .

[0083] According to S A The patch information is used to determine S A f′ i The three-dimensional space coordinates v′ of the three vertices of the triangle a1 ,v′ a2 ,v′ a3 . And according to the three-dimensional space coordinates of the three vertices, the vectors e′1, e′2 and e′3 of the three edges of the triangle are calculated as follows:

[0084] e′1=v′ a3 -v′ a2 , e′2=v′ a1 -v′ a3 , e′3=v′ a2 -v′ a1 .

[0085] According to the vectors e′1, e′2 and e′3 of the three edges of the triangle, calculate p j At the f′ i The barycentric coordinates w′ of the projection inside the triangle i-1 ,w′ i-2 ,w′ i-3 :

[0086]

[0087]

[0088]

[0089]

[0090] According to S A The patch information is used to determine S A f′ i The coordinates T′ of the three vertices of the triangle in the source texture map a1 ,T′ a2 ,T′ a3 , according to the centroid coordinates w′ in step 8 i-1 ,w′ i-2 ,w′ i-3 ,calculate Texture map Tex B Medium pixel pix j Corresponding to S A The texture map coordinates

[0091] In an optional embodiment, establishing a correspondence between a preset target texture map pixel position and a source texture map pixel position also includes: calculating the centroid coordinates of the projection of each pixel point in the corresponding third triangle patch; determining the pixel position of each pixel point in the corresponding source texture map based on the centroid coordinates of each pixel point, so as to establish a correspondence between the preset target texture map pixel position and the source texture map pixel position.

[0092] Figure 4 A schematic diagram of a process flow of a three-dimensional model retopology process provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the following is a complete embodiment to explain the calculation method of each preset corresponding relationship in the retopology process of the three-dimensional model provided by the present application. The calculation of the preset corresponding relationship includes: the corresponding relationship between the preset three-dimensional vertices and the triangular facets {f i}; the correspondence between the preset first triangle patch and the initial center coordinates {W i} calculation; the correspondence between the pixel positions of the preset target texture map and the pixel positions of the source texture map Calculation of; where {f i} and {W i The calculation steps of} are as follows:

[0093] First, for a given representation of the first three-dimensional mesh model S A and represents the target 3D mesh model Adjust so that the adjusted S A and Tightly align on geometric surfaces.

[0094] Given a pair of closely aligned surfaces S A and as well as The corresponding target texture map Tex B .

[0095] Then, for Every vertex v on i , look for S A The nearest patch index f i , and calculate v i The coordinates of the center of gravity of the patch are W i , that is, perform the following steps.

[0096] calculate Each vertex in S A The index of the nearest patch on the i , Barycentric coordinates W i .

[0097] according to f corresponding to each vertex in i and W i , we get {f i} and {W i} and follow the steps below.

[0098] Save parameters {f i} and {W i}.

[0099] The calculation steps involved are as follows:

[0100] for Texture Map Tex B Each pixel pix j , through rasterization technology, calculate its corresponding The spatial coordinate p of the surface j , that is, perform the following steps.

[0101] Using rasterization, calculate Tex B Each pixel j exist The spatial coordinates of the surface p j .

[0102] According to the calculation results of the above steps, pix j , look for S A On with pix j The nearest patch index f′ i , and calculate pix j The centroid coordinates W′ of the patch i , that is, perform the following steps.

[0103] Calculating pix j In S A The index of the nearest patch on the top f′ i , Barycentric coordinates W′ i .

[0104] The center of gravity coordinates W calculated according to the above steps i and patch index f′ i Determine the texture coordinates of the three vertices and calculate pix j Corresponding to S A The texture coordinates on That is, the following steps are performed.

[0105] Calculating pix j The corresponding S A The texture coordinates on

[0106] Will Texture Map Tex B Each pixel pix j The corresponding S A The texture coordinates on After sorting, we get

[0107] Save Parameters

[0108] Figure 5 A schematic diagram of a process flow of a three-dimensional model retopology process provided by another embodiment of the present application is shown in FIG. Figure 5 As shown, the following is a complete embodiment to explain the process of retopology using the determined preset correspondence relationship in the retopology process of the three-dimensional model provided by the present application, and the steps included are as follows:

[0109] Load the calculated parameters.

[0110] The calculated parameters include: i},{W i},as well as

[0111] Input any source 3D mesh model S′ to be processed A And the corresponding source texture map Tex′ A .

[0112] Subsequently, the retopology process includes retopology of the target three-dimensional mesh model and retopology of the target texture map corresponding to the target three-dimensional mesh model, wherein the retopology of the target three-dimensional mesh model includes the following:

[0113] According to {f i}Get S′ corresponding to each vertex of the target 3D mesh model A The triangle index of .

[0114] Then, according to the triangle patch index obtained in step S133, S′ is obtained. A The vertex coordinates in , that is, perform the following steps.

[0115] According to S′ A , get the vertex coordinates of the triangle patch.

[0116] Then, according to the vertex coordinates obtained in step S134 and {W i}, calculate the coordinate mapping result, that is, execute the following steps.

[0117] According to {W i}, calculate the coordinate mapping result.

[0118] Then, the spatial coordinates of each vertex of the target three-dimensional mesh are modified to be the coordinate mapping results calculated in the above steps, that is, the following steps are performed.

[0119] The spatial coordinates of the vertices of the target three-dimensional mesh model are modified to be the coordinate mapping results.

[0120] Then, save the target 3D mesh model S′ after modifying the vertex space coordinates in the above steps B That is, perform the following steps.

[0121] Save the target 3D mesh model S′ after the vertex space coordinates are modified B .

[0122] The retopology of the texture map corresponding to the target 3D mesh model includes the following:

[0123] according to Get the pixel-by-pixel Tex' of the target texture map AThe pixel coordinates of .

[0124] Then, the correspondence obtained according to the above steps is in Tex′ A The pixel coordinates on Tex′ A , that is, perform the following steps.

[0125] According to the coordinates of the element, take Tex′ A The pixel color.

[0126] Assign the obtained pixel color to the corresponding pixel of the target texture map.

[0127] Then, save the target texture map Tex′ after assigning pixel colors in the step B , that is, perform the following steps.

[0128] Save the target texture map Tex′ after assigning pixel color B .

[0129] By adopting the three-dimensional model retopology method provided by the present application, the first triangular facet corresponding to each vertex on the target three-dimensional mesh model can be directly determined through the preset correspondence between the three-dimensional vertices and the triangular facets, and the initial centroid coordinates of each vertex in the first triangular facet can be determined according to the preset correspondence between the first triangular facet and the initial centroid coordinates, and then the target spatial coordinates of each vertex are determined according to the coordinates of each vertex in the first triangular facet and the initial centroid coordinates corresponding to the coordinates of each vertex, and the coordinates of each vertex in the target three-dimensional mesh model are modified to the target center coordinates of each vertex, so as to realize the retopology from the source three-dimensional mesh model to the target three-dimensional mesh model. Such a topology method only needs to preset the correspondence between the three-dimensional vertices and the triangular facets and the correspondence between the first triangular facet and the initial centroid coordinates, so as to realize the adaptive use of the center coordinates to accurately locate any position on the surface of the three-dimensional mesh model. Description ability, improves the accuracy of three-dimensional mesh model retopology, thereby significantly improving the similarity between the retopology result and the source three-dimensional mesh model; in addition, the present application can not only retopologize the three-dimensional model, but also convert the texture map corresponding to the three-dimensional model, thereby generating a modified target texture map corresponding to the retopological target three-dimensional mesh model, so that after the three-dimensional model is retopologized, the three-dimensional model can be rendered directly based on the modified target texture map, thereby improving the efficiency of model processing and reducing the workload of model processing; that is, by adopting the method provided by the present application, the accurate description ability of the barycentric coordinates for any position on the surface of the triangular mesh model can be fully and adaptively utilized to construct a high-precision three-dimensional mesh model retopology scheme, significantly improving the geometric similarity of the three-dimensional mesh model retopology result, and combining with the rasterization technology, at the same time, realizing the effective reuse of the texture map of the source three-dimensional mesh model.

[0130] The following is an explanation of the three-dimensional model retopology device provided by the present application in conjunction with the accompanying drawings. The three-dimensional model retopology device can perform the above Figure 1-Figure 5 The specific implementation and beneficial effects of any three-dimensional model retopology method are as mentioned above and will not be repeated below.

[0131] Figure 6 A schematic diagram of the structure of a three-dimensional model retopology device provided in an embodiment of the present application, such as Figure 6 As shown, the device includes: a determination module 201 and a modification module 202, wherein:

[0132] The determination module 201 is used to determine the first triangular facets corresponding to each vertex on the target three-dimensional mesh model according to the preset correspondence between the three-dimensional vertices and the triangular facets; wherein the first triangular facet is a triangular facet of the source three-dimensional mesh model; according to the preset correspondence between the first triangular facet and the initial barycentric coordinates, determine the initial barycentric coordinates of each vertex in the first triangular facet; according to the coordinates of each vertex in the first triangular facet and the initial barycentric coordinates corresponding to the coordinates of each vertex, determine the target space coordinates of each vertex;

[0133] The modification module 202 is used to modify the coordinates of each vertex in the target three-dimensional mesh model according to the target space coordinates of each vertex to obtain a modified target three-dimensional mesh model.

[0134] Optionally, based on the above embodiment, the present application embodiment may also provide a three-dimensional model retopology device, as shown in the following figure. Figure 6 The implementation process of the given device is described by way of example. Figure 7 A schematic diagram of a structural diagram of a three-dimensional model retopology device provided in another embodiment of the present application, such as Figure 7 As shown, the device further includes: a calculation module 203, used to respectively calculate first distances between a plurality of triangular facets of the source three-dimensional mesh model and each vertex of the first three-dimensional mesh model;

[0135] The determination module 201 is specifically used to determine the second triangular facets corresponding to each vertex in multiple triangular facets of the source three-dimensional mesh model according to the first distance; and establish a preset correspondence relationship between three-dimensional vertices and triangular facets according to the second triangular facets corresponding to each vertex.

[0136] Optionally, the calculation module 203 is specifically used to calculate the centroid coordinates of the projection of each vertex in the corresponding second triangular facet;

[0137] The determination module 201 is specifically configured to establish a corresponding relationship between a preset first triangular face and an initial center coordinate according to the calculation result.

[0138] Optionally, the determination module 201 is specifically configured to determine the vectors of three edges of the second triangular face according to the three vertices of the second triangular face;

[0139] The calculation module 203 is specifically configured to calculate the centroid coordinates of the projection of the target vertex on the second triangle patch according to the vectors of the three edges.

[0140] Optionally, the device further includes: an adjustment module 204, configured to adjust the vertex positions of the first 3D mesh model according to the vertex positions of the source 3D mesh model, so that the vertices of the adjusted first 3D mesh model are aligned with the vertex positions of the source 3D mesh model.

[0141] Optionally, the determination module 201 is specifically used to determine the pixel position of each pixel point in the target texture map in the source texture map according to the preset correspondence between the pixel position of the target texture map and the pixel position of the source texture map; wherein the target texture map is the texture map corresponding to the target three-dimensional mesh model, and the source texture map is the texture map corresponding to the source three-dimensional mesh model; and determine the target color of each pixel point in the target texture map according to the color corresponding to each pixel position in the source texture map;

[0142] The adjustment module 204 is specifically configured to adjust the color of each pixel in the target texture map according to the target color of each pixel in the target texture map to obtain a modified target texture map.

[0143] Optionally, the calculation module 203 is specifically configured to calculate the target coordinates of the surface point of the first three-dimensional mesh model corresponding to each pixel in the texture map according to the coordinates of the texture map of the first three-dimensional mesh model;

[0144] Determination module 201 is specifically used to determine the second distance between each triangle in the source three-dimensional mesh model and the target coordinates of each pixel point; according to the second distance, determine the third triangle corresponding to each pixel point in multiple triangles of the source three-dimensional mesh model; according to the third triangle corresponding to each pixel point and the source texture map of each third triangle, establish the corresponding relationship between the preset target texture map pixel position and the source texture map pixel position.

[0145] Optionally, the calculation module 203 is specifically used to calculate the centroid coordinates of the projection of each pixel point in the corresponding third triangular facet;

[0146] The determination module 201 is specifically used to determine the pixel position of each pixel point in the corresponding source texture map according to the centroid coordinates of each pixel point, so as to establish a correspondence between the preset target texture map pixel position and the source texture map pixel position.

[0147] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0148] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0149] Figure 8 A schematic diagram of the structure of a three-dimensional model retopology device provided in one embodiment of the present application. The three-dimensional model retopology device can be integrated into a terminal device or a chip of the terminal device.

[0150] like Figure 8 As shown, the three-dimensional model retopology device includes: a processor 501, a bus 502 and a storage medium 503.

[0151] The processor 501 is used to store programs. The processor 501 calls the program stored in the storage medium 503 to execute the above Figure 1-Figure 5 The corresponding method embodiment has similar specific implementation methods and technical effects, which will not be described here.

[0152] Optionally, the present application also provides a program product, such as a storage medium, on which a computer program is stored, including a program that, when executed by a processor, executes an embodiment corresponding to the above method.

[0153] In the 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 only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0156] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

Claims

1. A three-dimensional model retopology method, characterized in that: The method comprises: According to the preset correspondence between three-dimensional vertices and triangular facets, first triangular facets corresponding to each vertex on the target three-dimensional mesh model are determined respectively; wherein the first triangular facet is a triangular facet of the source three-dimensional mesh model; Determine the initial barycentric coordinates of each of the vertices in the first triangular patch according to the correspondence between the preset first triangular patch and the initial barycentric coordinates, wherein the correspondence between the preset first triangular patch and the initial barycentric coordinates is determined according to the barycentric coordinates of each of the vertices projected in the corresponding second triangular patch, wherein the barycentric coordinates are determined according to the vectors of the three edges of the second triangular patch, and the second triangular patch corresponding to the vertex is the triangular patch having the smallest spatial distance with the vertex among the multiple triangular patches of the source three-dimensional mesh model; Determine the target space coordinates of each vertex according to the coordinates of each vertex in the first triangular face and the initial centroid coordinates corresponding to the coordinates of each vertex; According to the target space coordinates of each vertex, the coordinates of each vertex in the target three-dimensional mesh model are modified to obtain a modified target three-dimensional mesh model.

2. The method according to claim 1, characterized in that Before determining the first triangular facets corresponding to the vertices on the target three-dimensional mesh model according to the preset correspondence between the three-dimensional vertices and the triangular facets, the method further includes: Calculating first distances between a plurality of triangular facets of the source three-dimensional mesh model and each vertex of the first three-dimensional mesh model respectively; According to the first distance, determining second triangular facets corresponding to the respective vertices among a plurality of triangular facets of the source three-dimensional mesh model; According to the second triangular facets corresponding to the vertices, a corresponding relationship between the preset three-dimensional vertices and the triangular facets is established.

3. The method according to claim 2, characterized in that Before determining the initial barycentric coordinates of each of the vertices in the first triangular facet according to the preset correspondence between the first triangular facet and the initial center coordinates, the method further includes: Calculate the centroid coordinates of the projection of each vertex in the corresponding second triangular face; According to the calculation result, a corresponding relationship between the preset first triangular face and the initial center coordinates is established.

4. The method according to claim 3, characterized in that The calculating the centroid coordinates of the projection of each vertex in the corresponding second triangular facet includes: Determine the vectors of three edges of the second triangular face according to the three vertices of the second triangular face; According to the vectors of the three edges, the centroid coordinates of the projection of the target vertex on the second triangle patch are calculated.

5. The method according to claim 3, characterized in that Before calculating the barycentric coordinates of the projection of each vertex in the corresponding second triangular facet, the method further includes: According to the vertex positions of the source three-dimensional mesh model, the vertex positions of the first three-dimensional mesh model are adjusted, so that the adjusted vertices of the first three-dimensional mesh model are aligned with the vertex positions of the source three-dimensional mesh model.

6. The method according to claim 1, characterized in that The method further comprises: According to a preset correspondence between a target texture map pixel position and a source texture map pixel position, respectively determining a pixel position of each pixel point in the target texture map in the source texture map; wherein the target texture map is a texture map corresponding to the target three-dimensional mesh model, and the source texture map is a texture map corresponding to the source three-dimensional mesh model; Determine the target color of each pixel point in the target texture map according to the color corresponding to each pixel position in the source texture map; According to the target color of each pixel in the target texture map, the color of each pixel in the target texture map is adjusted to obtain a modified target texture map.

7. The method according to claim 6, characterized in that Before respectively determining the pixel position of each pixel point in the target texture map according to the preset correspondence between the pixel position of the target texture map and the pixel position of the source texture map, the method further comprises: Calculating target coordinates of a surface point of the first three-dimensional mesh model corresponding to each pixel in the texture map according to the coordinates of the texture map of the first three-dimensional mesh model; Determine a second distance between each triangular face in the source three-dimensional mesh model and the target coordinates of each pixel point; According to the second distance, respectively determine a third triangular facet corresponding to each pixel point among a plurality of triangular facets of the source three-dimensional mesh model; According to the third triangular facets corresponding to each of the pixel points and the source texture maps of each of the third triangular facets, a correspondence relationship between a preset target texture map pixel position and a source texture map pixel position is established.

8. The method according to claim 7, characterized in that The establishing of a correspondence between a preset target texture map pixel position and a source texture map pixel position according to the third triangular facets corresponding to each pixel point and the source texture map information of each third triangular facet comprises: Calculate the centroid coordinates of the projection of each pixel point in the corresponding third triangular face; According to the centroid coordinates of each pixel point, the pixel position of each pixel point in the corresponding source texture map is determined to establish a corresponding relationship between a preset target texture map pixel position and a source texture map pixel position.

9. A three-dimensional model retopology device, characterized in that: The device comprises: a determination module and a modification module, wherein: The determination module is used to determine the first triangular facets corresponding to each vertex on the target three-dimensional mesh model according to the preset correspondence between the three-dimensional vertices and the triangular facets; wherein the first triangular facet is a triangular facet of the source three-dimensional mesh model; determine the initial barycentric coordinates of each vertex in the first triangular facet according to the preset correspondence between the first triangular facet and the initial barycentric coordinates; determine the target spatial coordinates of each vertex according to the coordinates of each vertex in the first triangular facet and the initial barycentric coordinates corresponding to the coordinates of each vertex, the corresponding relationship between the preset first triangular facet and the initial barycentric coordinates is determined according to the barycentric coordinates of each vertex projected in the corresponding second triangular facet, the barycentric coordinates are determined according to the vectors of the three edges of the second triangular facet, and the second triangular facet corresponding to the vertex is the triangular facet with the smallest spatial distance to the vertex among the multiple triangular facets of the source three-dimensional mesh model; The modification module is used to modify the coordinates of each vertex in the target three-dimensional mesh model according to the target space coordinates of each vertex to obtain a modified target three-dimensional mesh model.

10. A three-dimensional model retopology device, characterized in that: The device includes: a processor, a storage medium and a bus, the storage medium stores machine-readable instructions executable by the processor, when the three-dimensional model retopology device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the method described in any one of claims 1 to 8.

11. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is executed.