Texture image generation method and apparatus, computer device, and storage medium
By generating texture images based on category and contour information of 3D model mesh data, and combining feature map decoding and UV unwrapping techniques, the problems of low efficiency and unstable quality of texture image generation in existing technologies are solved, and efficient and automatic texture image matching and 3D model fitting are achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2026-03-26
AI Technical Summary
Existing technologies struggle to efficiently generate texture images that match the categories and contours of 3D models, requiring art engineers to draw them manually, resulting in low generation efficiency and inconsistent quality.
By extracting category and contour information from the mesh data based on the 3D model, an initial texture image is generated. Feature map decoding technology is used to achieve high-precision alignment between the texture image and the model contour. Combined with texture optimization coefficients and UV unwrapping technology, a texture image matching the 3D model is automatically generated.
It enables rapid generation and matching of 3D model texture images, improving generation efficiency and quality, reducing reliance on art engineers, and ensuring that texture images fit the model surface.
Smart Images

Figure CN2025112506_26032026_PF_FP_ABST
Abstract
Description
Texture image generation method and device, computer device, and storage medium
[0001] The present application claims priority to the Chinese Patent Application No. 202411307516.0, filed on September 18, 2024, and entitled "Texture image generation method and device, computer device, and storage medium", the entire content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] Embodiments of the present application relate to the field of computer technology, and in particular to a texture image generation method and device, a computer device, and a storage medium. BACKGROUND
[0003] With the development of computer technology, three-dimensional models are increasingly widely used, and users have increasingly high requirements for the visual effects of three-dimensional models. In order to improve the visual effects of three-dimensional models, a texture image can be used to render a three-dimensional model, so that the three-dimensional model has color and concave-convex effects. Therefore, how to generate a texture image of a three-dimensional model has become a research hotspot. SUMMARY
[0004] Embodiments of the present application provide a texture image generation method and device, a computer device, and a storage medium. The technical solution is as follows:
[0005] In one aspect, a texture image generation method is provided, the method comprising:
[0006] Based on mesh data of a three-dimensional model, determining category information and contour information of the three-dimensional model, the mesh data being used to indicate a structure of the three-dimensional model, the category information being used to indicate a category to which the three-dimensional model belongs, and the contour information being used to indicate a contour of the three-dimensional model;
[0007] Based on texture information corresponding to the category information, generating an initial texture image of the three-dimensional model, the texture information including a texture type corresponding to each vertex in a three-dimensional model of an object belonging to the category;
[0008] Obtaining a feature map of the initial texture image;
[0009] Based on the contour information, decoding the feature map to obtain a target texture image of the three-dimensional model, so that a contour of the target texture image matches the contour information.
[0010] In another aspect, a texture image generation device is provided, the device comprising:
[0011] determine category information and contour information of the three-dimensional model based on mesh data of the three-dimensional model, the mesh data being used to indicate a structure of the three-dimensional model, the category information being used to indicate a category to which the three-dimensional model belongs, and the contour information being used to indicate a contour of the three-dimensional model;
[0012] generate an initial texture image of the three-dimensional model based on texture information corresponding to the category information, the texture information including a texture type corresponding to each vertex in a three-dimensional model of an object belonging to the category;
[0013] obtain a feature map of the initial texture image;
[0014] decode the feature map based on the contour information to obtain a target texture image of the three-dimensional model, so that a contour of the target texture image matches the contour information.
[0015] In a possible implementation, the determining module is configured to perform convolution processing on the mesh data to obtain local feature maps corresponding to a plurality of parts of the three-dimensional model, perform pooling processing on the plurality of local feature maps to obtain pooled local feature maps, perform full connection processing on the pooled local feature maps to obtain a global feature map, and determine the category information and the contour information of the three-dimensional model based on the global feature map.
[0016] In a possible implementation, the texture generation model includes a three-dimensional convolution layer, a three-dimensional pooling layer, and a full connection layer, the three-dimensional convolution layer includes N convolution kernels, N being a positive integer;
[0017] the three-dimensional convolution layer is configured to perform convolution processing on the mesh data by using the N convolution kernels to obtain local feature maps corresponding to N parts of the three-dimensional model;
[0018] the three-dimensional pooling layer is configured to perform pooling processing on the N local feature maps to obtain pooled local feature maps;
[0019] the full connection layer is configured to perform full connection processing on the pooled local feature maps to obtain a global feature map, and determine the category information and the contour information of the three-dimensional model based on the global feature map.
[0020] In a possible implementation, the texture generation model includes a linear layer.
[0021] the linear layer is configured to generate an initial texture image of the three-dimensional model based on texture information corresponding to the category information.
[0022] In a possible implementation, the obtaining module is configured to perform convolution processing on the initial texture image to obtain local feature maps corresponding to a plurality of regions of the initial texture image; perform batch normalization processing on the plurality of local feature maps to obtain batch-normalized local feature maps; and perform feature extraction on the batch-normalized local feature maps to obtain a feature map of the initial texture image.
[0023] In a possible implementation, the texture generation model comprises M two-dimensional convolution layers, M batch normalization layers, and a transformer encoding layer, each of the two-dimensional convolution layers comprises X convolution kernels, and M and X are positive integers.
[0024] The first two-dimensional convolution layer is configured to perform convolution processing on the initial texture image by using the X convolution kernels to obtain local feature maps corresponding to X regions of the initial texture image.
[0025] The first batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the first two-dimensional convolution layer to obtain batch-normalized local feature maps.
[0026] The i-th two-dimensional convolution layer is configured to perform convolution processing on the X local feature maps output by the (i-1)-th batch normalization layer by using the X convolution kernels to obtain convolution-processed local feature maps, i is a positive integer greater than 1 and less than or equal to M.
[0027] The i-th batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the i-th two-dimensional convolution layer to obtain batch-normalized local feature maps.
[0028] The transformer encoding layer is configured to perform feature extraction on the X local feature maps output by the M-th batch normalization layer to obtain a feature map of the initial texture image.
[0029] In a possible implementation, the texture generation model comprises a transformer decoding layer.
[0030] The transformer decoding layer is configured to decode the feature map based on the contour information to obtain a target texture image of the three-dimensional model.
[0031] In a possible implementation, the device further comprises:
[0032] The obtaining module is further configured to obtain a texture optimization coefficient of the three-dimensional model.
[0033] The optimization module is configured to optimize the target texture image based on the texture optimization coefficient.
[0034] The texture optimization coefficient includes at least one of a detail enhancement coefficient, a brightness adjustment coefficient, a contrast adjustment coefficient, and a color balance coefficient.
[0035] The detail enhancement coefficient is used to enhance the texture of the texture image of the three-dimensional model, the brightness adjustment coefficient is used to adjust the brightness of the texture image of the three-dimensional model, the contrast adjustment coefficient is used to adjust the contrast of the texture image of the three-dimensional model, and the color balance coefficient is used to adjust the color balance of the texture image of the three-dimensional model.
[0036] In a possible implementation manner, the apparatus further includes:
[0037] The rendering module is configured to perform UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information including UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent coordinates of the vertex on a UV plane; obtain the UV coordinate information from the UV unfolded image of the three-dimensional model; and map the target texture image onto the three-dimensional model based on the UV coordinate information to obtain the three-dimensional model after rendering.
[0038] In a possible implementation manner, the rendering module is configured to segment the three-dimensional model based on mesh data of the three-dimensional model to obtain a plurality of three-dimensional sub-models corresponding to a plurality of parts; perform UV unfolding on the plurality of three-dimensional sub-models respectively to obtain a plurality of UV unfolded images, each UV unfolded image corresponding to a three-dimensional sub-model; and splice the plurality of UV unfolded images to obtain the UV unfolded image of the three-dimensional model.
[0039] In a possible implementation manner, the rendering module is configured to, for any three-dimensional sub-model, determine a first angle corresponding to each vertex based on mesh data of the three-dimensional sub-model, the first angle corresponding to the vertex being an included angle between lines connecting the vertex and two adjacent vertices in the three-dimensional sub-model; randomly allocate a UV coordinate to each vertex in the three-dimensional sub-model; determine a second angle corresponding to the vertex, the second angle corresponding to the vertex being an included angle between lines connecting the vertex and two adjacent vertices in a UV unfolded image of the three-dimensional sub-model; determine an energy value corresponding to the three-dimensional sub-model based on the first angle corresponding to the vertex and the second angle corresponding to the vertex, the energy value being used to simulate deformation energy generated by angle changes of the three-dimensional sub-model before and after unfolding; and in a case where the energy value is not less than a preset threshold, adjust the UV coordinate of the vertex until, in a case where an energy value determined after the adjustment is less than the preset threshold, generate the UV unfolded image of the three-dimensional sub-model based on the adjusted UV coordinate of the vertex.
[0040] In a possible implementation, the apparatus further includes:
[0041] The processing module is configured to, for any vertex of the three-dimensional model, remove the vertex if the vertex is not connected with any vertex; merge any two vertices into one vertex if a distance between the two vertices is less than a distance threshold in the three-dimensional model; for any edge of the three-dimensional model, merge the edge and two vertices connected with the edge into one vertex if the edge satisfies an edge folding condition; and remove any face in the three-dimensional model if vertices constituting the face are collinear.
[0042] In a possible implementation, the apparatus further includes:
[0043] The training module is configured to obtain mesh data of a sample three-dimensional model; process the mesh data by using the texture generation model to obtain a predicted texture image of the sample three-dimensional model, the predicted texture image including predicted texture region images corresponding to a plurality of surface regions of the sample three-dimensional model, wherein a material in each surface region is the same; for any predicted texture region image in the predicted texture image, determine a sample texture image conforming to a material corresponding to the predicted texture region image from a sample image set, the sample image set including a plurality of sample texture images with different materials; determine a first loss based on a plurality of predicted texture region images and a plurality of sample texture images, the first loss being used to indicate a difference between the plurality of predicted texture images and corresponding sample texture images; and update model parameters of the texture generation model based on the first loss.
[0044] In a possible implementation, the training module is further configured to perform normalization processing on the plurality of sample texture images, the normalization processing being used to map pixel values of pixel points in the plurality of sample texture images to a preset value range; adjust sizes of the plurality of sample texture images to preset sizes; and perform data enhancement processing on the plurality of sample texture images, and add the plurality of sample texture images after the data enhancement processing to the sample image set, the data enhancement processing including at least one of rotation, translation, and scaling.
[0045] In a possible implementation, the training module is further configured to: obtain real category information of the sample three-dimensional model, the real category information being used to indicate a real category to which the sample three-dimensional model belongs; process the mesh data by using the texture generation model to obtain predicted category information of the sample three-dimensional model, the predicted category information being used to indicate a predicted category to which the sample three-dimensional model belongs; and update model parameters of the texture generation model based on the first loss and the second loss.
[0046] In another aspect, a computer device is provided, which includes a processor and a memory, and the memory stores at least one computer program, which is loaded and executed by the processor to implement the texture image generation method according to the above aspect.
[0047] In another aspect, a computer readable storage medium is provided, which stores at least one computer program, which is loaded and executed by a processor to implement the texture image generation method according to the above aspect.
[0048] In another aspect, a computer program product is provided, which includes a computer program, which is loaded and executed by a processor to implement the texture image generation method according to the above aspect.
[0049] The embodiment of the present application provides a texture image generation method, which can accurately extract category and contour information from three-dimensional model mesh data, ensure model structure recognition accuracy, automatically generate an initial texture image through a category-associated texture library, improve texture mapping and model category matching efficiency, and realize high-precision alignment of a texture image and a model contour through feature map extraction and contour-guided decoding technology. The above scheme can quickly generate a texture image matching a category and a contour of a three-dimensional model based on mesh data of the three-dimensional model, without the need for manual generation of a texture image by an art engineer, thereby greatly improving texture image generation efficiency. Since the generated texture image matches the category and the contour of the three-dimensional model, the texture image can be guaranteed to be surface-fitted to the three-dimensional model, thereby guaranteeing texture image quality. BRIEF DESCRIPTION OF DRAWINGS
[0050] FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0051] FIG. 2 is a flowchart of a texture image generation method provided by an embodiment of the present application;
[0052] FIG. 3 is a flowchart of another texture image generation method provided by an embodiment of the present application;
[0053] FIG. 4 is an architectural diagram of a texture generation model provided by an embodiment of the present application;
[0054] FIG. 5 is a schematic diagram of a texture rendering process according to an embodiment of the present application;
[0055] FIG. 6 is a flowchart of a method for training a texture generation model according to an embodiment of the present application;
[0056] FIG. 7 is a flowchart of another method for generating a texture image according to an embodiment of the present application;
[0057] FIG. 8 is a flowchart of a method for making a three-dimensional model according to an embodiment of the present application;
[0058] FIG. 9 is a schematic diagram of a structure of a texture image generation apparatus according to an embodiment of the present application;
[0059] FIG. 10 is a schematic diagram of a structure of a terminal according to an embodiment of the present application;
[0060] FIG. 11 is a schematic diagram of a structure of a server according to an embodiment of the present application. DETAILED DESCRIPTION
[0061] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0062] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals involved in the present application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of the related data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the grid data, texture optimization coefficients and real category information involved in the present application are all obtained under full authorization.
[0063] The method provided by the embodiments of the present application is executed by a computer device, which can be a terminal or a server, or other types of devices, and the embodiments of the present application do not make any limitation in this regard.
[0064] FIG. 1 is a schematic diagram of an implementation environment according to an embodiment of the present application, referring to FIG. 1, the implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected through wired or wireless communication, and the present application does not make any limitation in this regard.
[0065] In a possible implementation, the terminal 101 is a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, a flying vehicle, an AR (Augmented Reality) device, a VR (Virtual Reality) device, or the like, but is not limited thereto.
[0066] In a possible implementation, the server 102 is a standalone physical server, or can be a server cluster or a distributed system composed of multiple physical servers, or can be a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platform.
[0067] In a possible implementation, the server 102 undertakes the main computing work, and the terminal 101 undertakes the secondary computing work; or the server 102 undertakes the secondary computing work, and the terminal 101 undertakes the main computing work; or the server 102 and the terminal 101 cooperatively compute in a distributed computing architecture.
[0068] It can be appreciated by those skilled in the art that the number of terminals can be more or less. For example, the terminals can be only one, or tens or hundreds, or more. The number of terminals and the type of equipment are not limited in the embodiments of the present application.
[0069] In the embodiments of the present application, the server 102 can provide the terminal 101 with mesh data of a three-dimensional model. The terminal 101 can display the three-dimensional model in a mesh form based on the mesh data of the three-dimensional model, for a user to view, so that the user can understand the structure of the three-dimensional model. In addition, the terminal 101 or the server 102 can generate a texture image of the three-dimensional model based on the mesh data of the three-dimensional model, and then can render the three-dimensional model based on the generated texture image, so that the model surface of the three-dimensional model has color and concave-convex sense. The terminal 101 can also display the rendered three-dimensional model, for a user to view the rendering effect of the three-dimensional model.
[0070] Optionally, the terminal 101 installs and runs an application program supporting texture generation and texture rendering functions. The application program can be a rendering engine. The server 102 is configured to provide background services for the application program. The terminal 101 can display a three-dimensional model without texture rendering through the application program. In response to a texture generation operation on the three-dimensional model, the terminal 101 sends a texture generation request to the server 102 through the application program, where the texture generation request carries a model identifier of the three-dimensional model. The server 102 obtains mesh data of the three-dimensional model corresponding to the model identifier from a database in response to the texture generation request, and then generates a texture image of the three-dimensional model based on the mesh data. The server 102 delivers the texture image to the terminal 101. The terminal 101 displays the texture image of the three-dimensional model through the application program for a user to view. Optionally, the user can also edit the texture image through the application program. Further, in response to a texture rendering operation on the three-dimensional model, the terminal 101 sends a texture rendering request to the server 102 through the application program, where the texture rendering request carries the model identifier of the three-dimensional model and the texture image. The server 102 renders the three-dimensional model corresponding to the model identifier based on the texture image to obtain a rendered three-dimensional model in response to the texture rendering request. The server 102 delivers the rendered three-dimensional model to the terminal 101. The terminal 101 displays the rendered three-dimensional model through the application program for the user to view.
[0071] It should be noted that the above implementation environment is only an example, and the method provided by the embodiments of the present application can also be used in other implementation environments, which are not limited by the embodiments of the present application.
[0072] FIG. 2 is a flowchart of a texture image generation method provided by an embodiment of the present application. As shown in FIG. 2, the embodiment of the present application is executed by a computer device. The method includes the following steps:
[0073] 201. The computer device determines category information and contour information of the three-dimensional model based on mesh data of the three-dimensional model, where the mesh data is used to indicate a structure of the three-dimensional model, the category information is used to indicate a category to which the three-dimensional model belongs, and the contour information is used to indicate a contour of the three-dimensional model.
[0074] In the embodiment of the present application, the object to which the three-dimensional model belongs can be a virtual character, a virtual animal, a virtual building, a virtual plant, a virtual prop, etc. in a virtual scene. Alternatively, the object to which the three-dimensional model belongs can also be other objects, which are not limited by the embodiments of the present application.
[0075] The mesh data of the three-dimensional model is described below.
[0076] In the field of three-dimensional computer graphics, the mesh data of a three-dimensional model can be generally referred to as "Mesh" or "Polygon Mesh". The mesh data of a three-dimensional model is used to indicate the structure of the three-dimensional model. A three-dimensional model is composed of points, lines, and surfaces. The mesh data of a three-dimensional model includes vertex data, edge data, and surface data of the three-dimensional model, which are used to describe the data structure of the three-dimensional model composed of vertices, edges, and surfaces. The vertex data includes the vertex coordinates of each vertex in the three-dimensional model, which are used to represent the position of the vertex in the three-dimensional model. The surface data is used to represent the correspondence between each surface and vertex in the three-dimensional model. The vertices corresponding to each surface are the vertices that constitute the surface. For example, if a surface is a triangle, there are three vertices that constitute the surface.
[0077] The category information of a three-dimensional model refers to metadata used to describe the semantic classification or functional classification to which the three-dimensional model belongs. The category information identifies the type, purpose, or domain of the three-dimensional model through labels, classification systems, or hierarchical structures. The semantic classification refers to classification based on the shape, name, or natural / man-made category to which the model belongs, which is used to indicate what the model is. For example, animals, plants, vehicles, furniture, etc. The functional classification refers to classification based on the purpose or interactive behavior of the model, which is used to indicate what the model can do. For example, objects that can be sat on, containers that can hold liquids, etc.
[0078] Optionally, the category to which the three-dimensional model belongs is the category of the object to which the three-dimensional model belongs. The category of the object can include people, animals, plants, buildings, articles, etc. Since the mesh data of a three-dimensional model indicates the structure of the three-dimensional model, and the structures of three-dimensional models of different categories are different, the computer device can determine the category to which the three-dimensional model belongs based on the mesh data of the three-dimensional model.
[0079] Optionally, the computer device can determine the category corresponding to the mesh data as the category to which the three-dimensional model belongs based on a preset mapping relationship between the mesh data and the category. Alternatively, the computer device can predict the category to which the three-dimensional model belongs based on the mesh data of the three-dimensional model through a neural network model, and determine the predicted category as the category to which the three-dimensional model belongs. The neural network model is a model for predicting the category to which a three-dimensional model belongs based on the mesh data of the three-dimensional model, such as a convolutional neural network model, a recurrent neural network model, etc.
[0080] The contour information of the three-dimensional model refers to data describing the external edge shape of the three-dimensional model under a specific view or condition, and is used to represent the overall shape feature of the model, that is, the contour of the three-dimensional model reflects the shape of the three-dimensional model. The contour can be the geometric boundary of the model in space, or the silhouette under a specific projection (such as a two-dimensional view). Since the mesh data of the three-dimensional model indicates the structure of the three-dimensional model, and the structures of three-dimensional models of different shapes are different, the computer device can determine the contour information of the three-dimensional model based on the mesh data of the three-dimensional model.
[0081] Optionally, the computer device constructs a three-dimensional model with a corresponding structure based on the mesh data of the three-dimensional model. The computer device determines a plurality of view angles, projects the three-dimensional model under each view angle, and obtains the contour information of the projected three-dimensional model, thereby obtaining the contour information corresponding to each view angle. The contour information corresponding to each view angle can describe the contour of the three-dimensional model under this view angle. In this way, the projection contour of the three-dimensional model under a plurality of view angles can be obtained. The projection contour refers to the 2D silhouette of the three-dimensional model under a certain view angle, that is, the external contour of the model under this view angle.
[0082] 202. The computer device generates an initial texture image of the three-dimensional model based on the texture information corresponding to the category information. The texture information includes the texture type corresponding to each vertex in the three-dimensional model of the object belonging to the category.
[0083] In the embodiments of the present application, the computer device obtains the texture information corresponding to the category information based on the category to which the three-dimensional model belongs. The texture information corresponding to the category information refers to the typical texture features that different categories of three-dimensional models usually have, including color, pattern, material attribute, etc. These features are closely related to the semantic classification or functional classification of the model. For example, the typical texture features of a tree are rough bark texture, green gradient + leaf vein details; the typical texture features of a metal appliance are high light reflection + wear marks (such as scratches, rust marks). The texture information includes the texture type corresponding to each vertex in the three-dimensional model of the object belonging to the category. For example, basic color, material attribute, and special mapping effect, etc. The three-dimensional model of the object belonging to the category refers to a general three-dimensional model of the object belonging to the category. The general three-dimensional model refers to a three-dimensional model with wide applicability, which is not designed for a specific scene or special needs, but meets the basic requirements of multiple applications. For example, if the object is a person, the three-dimensional model to be generated for the texture image can be a person model in a running posture, and the general three-dimensional model can be a person model in a standing posture. The texture type corresponding to the vertex is used to represent the texture presented by the vertex on the surface of the general three-dimensional model. The texture type can be skin texture, cloth texture, hair texture, leather texture, etc., which is not limited in the embodiments of the present application.
[0084] The computer device performs permutation and combination on the texture types corresponding to the plurality of vertices in the general three-dimensional model to obtain a texture image. Optionally, the computer determines the manner of generating the texture image can be: the computer device maps the vertices of the general three-dimensional model to a 2D texture control to generate UV coordinates. Then, the texture is generated by noise, algorithm or AI. Finally, the texture image is sampled and applied to the surface of the general three-dimensional model according to the UV coordinates to obtain the texture image. Since the three-dimensional model and the general three-dimensional model belong to the same category, the texture image can be used as the initial texture image of the three-dimensional model. Wherein, the initial texture image refers to the basic texture map automatically generated by the computer device based on the category information (such as semantic classification, functional classification) of the three-dimensional model, which serves as the starting point for subsequent fine texture editing or optimization.
[0085] Optionally, the computer device performs permutation and combination on the texture types corresponding to the plurality of vertices in the general three-dimensional model based on the UV coordinates of each vertex in the general three-dimensional model to obtain the texture image.
[0086] 203、The computer device obtains a feature map of the initial texture image.
[0087] In the embodiments of the present application, the feature map is a structured data representation for describing the local and global features of the initial texture image, which is usually stored in the form of a multi-channel matrix (such as a 2D image or a tensor) and contains semantic, geometric and material attribute information of the texture. That is, the feature map is used to describe the local and global features of the initial texture image. The local feature refers to the feature of a local region in the initial texture image. The global feature refers to the overall feature of the initial texture image.
[0088] Optionally, the computer device can obtain the feature map of the initial texture image through a neural network model. The neural network model is a model for feature extraction of an image, such as a convolutional neural network model, a graph neural network model, etc.
[0089] 204、The computer device decodes the feature map based on the contour information to obtain a target texture image of the three-dimensional model, so that the contour of the target texture image matches the contour information.
[0090] In the embodiment of the present application, since the initial texture image is a texture image generated based on the texture type corresponding to each vertex in the general three-dimensional model, the initial texture image is a texture image matching the contour of the general three-dimensional model. That is, the initial texture image can fit the model surface of the general three-dimensional model, but does not match the contour of the three-dimensional model. In order to obtain a texture image matching the contour of the three-dimensional model, the computer device decodes the feature map of the initial texture image based on the contour information of the three-dimensional model, so that the contour of the target texture image obtained by decoding matches the contour indicated by the contour information, that is, matches the contour of the three-dimensional model. That is, the target texture image is the final available texture map generated by decoding, optimization or synthesis based on the initial texture feature map and the contour information by the computer device.
[0091] The embodiment of the present application provides a texture image generation method, which can accurately extract categories and contour information from three-dimensional model grid data, ensure model structure recognition accuracy, automatically generate initial texture images through category-associated texture libraries, improve texture map and model category matching efficiency, and realize high-precision alignment of texture images and model contours through feature map extraction and contour-guided decoding technology. The above-mentioned scheme can quickly generate a texture image matching the category and contour of a three-dimensional model based on the grid data of the three-dimensional model, without the need for manual generation of the texture image by an art engineer, thereby greatly improving the generation efficiency of the texture image. Since the generated texture image matches the category and contour of the three-dimensional model, the texture image can be guaranteed to fit the surface of the three-dimensional model, thereby ensuring the quality of the texture image.
[0092] The above embodiment is a brief description of the process of generating a target texture image. Based on the above embodiment, another texture image generation method is provided in the embodiment of the present application, and the process of generating a texture image is described in detail. FIG. 3 is a flowchart of another texture image generation method provided by the embodiment of the present application, as shown in FIG. 3, the embodiment of the present application is executed by a computer device. The method comprises the following steps:
[0093] 301. The computer device performs convolution processing on the grid data of the three-dimensional model to obtain local feature maps corresponding to multiple parts of the three-dimensional model, and the grid data is used to indicate the structure of the three-dimensional model.
[0094] In the embodiment of the present application, the three-dimensional model comprises multiple parts, and the convolution processing is used to extract local features of the three-dimensional model, that is, to extract features of the multiple parts of the three-dimensional model. Taking a three-dimensional model as a person model as an example, the multiple parts of the person model can include a head, a neck, an arm, a leg, a torso, etc., and the features of any of the above parts are local features of the person model.
[0095] The grid data is three-dimensional data, and the convolution processing includes multiple three-dimensional convolution operations. Each pair of three-dimensional model grid data is subjected to a three-dimensional convolution operation, and a local feature map corresponding to a part of the three-dimensional model is obtained. Therefore, the computer device can obtain multiple local feature maps corresponding to multiple parts of the three-dimensional model by performing convolution processing on the grid data of the three-dimensional model. The local feature map is a digital representation of the part-level details of the three-dimensional model. The local feature map is used to describe the three-dimensional model locally.
[0096] 302. The computer device performs pooling processing on the multiple local feature maps to obtain multiple pooled local feature maps.
[0097] In the embodiments of the present application, the pooling processing is a calculation operation for reducing the dimension of the data space and enhancing the robustness of the features by aggregating the feature values in the local region (such as taking the maximum value, the average value). The pooling processing is used to reduce the size of the feature map. The computer device can reduce the size of the multiple local feature maps by performing pooling processing on the multiple local feature maps of the three-dimensional model. The pooling processing can be maximum pooling processing or average pooling processing, and the embodiments of the present application do not limit this. The maximum pooling processing is used to select the maximum value in the local region of the feature map as the feature value of the local region after pooling, so as to reduce the size of the feature map. The average pooling processing is used to calculate the average value of all values in the local region of the feature map as the feature value of the local region after pooling, so as to reduce the size of the feature map.
[0098] 303. The computer device performs fully connected processing on the multiple pooled local feature maps to obtain a global feature map.
[0099] In the embodiments of the present application, the fully connected processing is a calculation operation for connecting each element of the input data to all nodes of the output layer through weights and performing nonlinear transformation. Through the fully connected processing, the computer device can combine the multiple pooled local features to obtain the global feature map of the three-dimensional model. The global feature map is used to describe the three-dimensional model globally and can reflect the overall structure of the three-dimensional model.
[0100] Optionally, the computer device combines the multiple pooled local feature maps corresponding to the multiple parts according to the relative positional relationship of the multiple parts to obtain the global feature map. The global feature map is an abstract representation of the macroscopic properties of the three-dimensional model.
[0101] 304. The computer device determines the category information and the contour information of the three-dimensional model based on the global feature map. The category information is used to indicate the category to which the three-dimensional model belongs, and the contour information is used to indicate the contour of the three-dimensional model.
[0102] In the embodiments of the present application, the global feature is unique, that is, three-dimensional models of different categories have different global features. The global feature of the three-dimensional model can reflect the category to which the three-dimensional model belongs, so that the computer device can perform category prediction on the three-dimensional model based on the global feature map, and obtain the category information of the three-dimensional model.
[0103] Three-dimensional models of different contours also have different global features. The global feature of the three-dimensional model can also reflect the contour of the three-dimensional model, so that the computer device can perform contour prediction on the three-dimensional model based on the global feature map, and obtain the contour information of the three-dimensional model.
[0104] Optionally, the global feature map is a high-level semantic encoding of the overall property of the three-dimensional model, which is usually extracted by a neural network (such as CNN, Transformer), and includes the following information: geometric features, spatial structure, symmetry, scale, etc. of the model; texture features, color distribution, material type (metal / fabric, etc.); statistical features, vertex / face density, curvature distribution, etc. The computer device first decodes the global feature using a classification module (such as a fully connected layer or a classification head), and outputs the semantic category to which the model belongs. Then, the global feature map is reconstructed into a spatial mask (Mask) through deconvolution (Deconvolution) or transposed convolution (Transposed Conv), to obtain an accurate 3D boundary or 2D projection contour. Finally, the contour clarity is optimized through adversarial training.
[0105] 305. The computer device generates an initial texture image of the three-dimensional model based on texture information corresponding to the category information, wherein the texture information includes the texture type corresponding to each vertex in the three-dimensional model of the object belonging to the category.
[0106] In the embodiments of the present application, step 305 is the same as step 202 described above, and will not be described here.
[0107] 306. The computer device performs convolution processing on the initial texture image to obtain a local feature map corresponding to each of a plurality of regions of the initial texture image.
[0108] In the embodiments of the present application, the initial texture image includes a plurality of regions, and the convolution processing is used to extract the local features of the initial texture image, that is, to extract the features of each of the plurality of regions of the initial texture image.
[0109] The initial texture image is two-dimensional data, and the convolution processing includes multiple two-dimensional convolution operations. Each two-dimensional convolution operation on the initial texture image will obtain a local feature map corresponding to a region of the initial texture image. Therefore, the computer device performs convolution processing on the initial texture image to obtain a local feature map corresponding to each of a plurality of regions of the initial texture image. The local feature map is used to describe the initial texture image from a local perspective.
[0110] 307. The computer device performs batch normalization processing on the plurality of local feature maps to obtain a plurality of batch-normalized local feature maps.
[0111] In the embodiments of the present application, the batch normalization processing (Batch Normalization) is a technique for accelerating training and improving model stability by standardizing the mean and variance of the input of each layer of the neural network. The batch normalization processing is used to regulate the data distribution of the plurality of feature maps. The computer device performs batch normalization processing on the plurality of local feature maps of the initial texture image, which can make the plurality of local feature maps maintain the same data distribution, so as to improve the processing efficiency of the computer device on the plurality of local feature maps.
[0112] 308. The computer device performs feature extraction on the plurality of batch-normalized local feature maps to obtain a feature map of the initial texture image.
[0113] In the embodiments of the present application, the computer device performs feature extraction on the plurality of local feature maps, which can obtain the feature fusion weights corresponding to the plurality of local feature maps. The feature fusion weights are used to indicate the contribution size of the local feature map to the feature map of the initial texture image. The computer device performs weighted fusion on the plurality of local feature maps based on the feature fusion weights corresponding to the plurality of local feature maps to obtain the feature map of the initial texture image.
[0114] Optionally, the computer device can perform feature extraction on the plurality of local feature maps based on an attention mechanism to obtain the feature fusion weights corresponding to the plurality of local feature maps. The attention mechanism is used to calculate the contribution size of the input data to the output data.
[0115] 309. The computer device decodes the feature map based on the contour information to obtain a target texture image of the three-dimensional model, so that the contour of the target texture image matches the contour information.
[0116] In the embodiments of the present application, step 309 is the same as step 204 described above, and will not be described here.
[0117] In some embodiments, the above steps 301-309 can be performed by a texture generation model. FIG. 4 is an architecture diagram of a texture generation model according to an embodiment of the present application. As shown in FIG. 4, the texture generation model includes a three-dimensional data processing network, a first texture generation network, a feature extraction network, and a second texture generation network.
[0118] The three-dimensional data processing network comprises a three-dimensional convolution layer, a three-dimensional pooling layer, and a full connection layer. The three-dimensional convolution layer is a neural network layer for extracting local features of voxelized data (such as CT scans or video sequences), and outputs a feature map that retains spatial-temporal correlation by calculating a weighted sum through sliding a three-dimensional kernel in the length, width, and depth (height / time) dimensions of an input tensor. Optionally, the three-dimensional convolution layer comprises N kernels, where N is a positive integer. The three-dimensional convolution layer is configured to perform convolution processing on the grid data through the N kernels to obtain N local feature maps corresponding to N parts of the three-dimensional model. The three-dimensional pooling layer is an operation for reducing the sampling of a three-dimensional feature map, and compresses the data dimension by taking a maximum value (Max Pooling) or an average value (Average Pooling) in a cubic window (such as 2x2x2), thereby reducing the amount of calculation and enhancing the feature translation invariance. The three-dimensional pooling layer is configured to perform pooling processing on the N local feature maps to obtain N pooled local feature maps. The full connection layer is a neural network layer for performing linear transformation on a one-dimensional vector obtained by flattening the input features through a weight matrix and a bias. The full connection layer is configured to perform full connection processing on the N pooled local feature maps to obtain a global feature map, and determine the class information and contour information of the three-dimensional model based on the global feature map.
[0119] In a possible implementation, the three-dimensional convolution layer performs convolution processing on the grid data according to the following formula (I).
[0120] Formula (I):
[0121] wherein Conv3D(x) represents a three-dimensional convolution operation, k represents the size of the convolution kernel in the three-dimensional convolution layer, w ijl represents the weight of the convolution kernel, x i,j,l represents the vertex coordinates of the vertices in the grid data of the three-dimensional model, i, j, and l respectively represent the row coordinates, column coordinates, and vertical coordinates of the vertices in the convolution window.
[0122] In a possible implementation, the three-dimensional pooling layer performs maximum pooling processing on the local feature map according to the following formula (II).
[0123] Formula (II):
[0124] wherein Pool3D(x) represents a three-dimensional pooling operation, k represents the size of the pooling window, x i,j,l represents the local feature map obtained by performing convolution processing on the grid data of the three-dimensional model. i, j, and l respectively represent the row coordinates, column coordinates, and vertical coordinates of the pixel points in the pooling window in the local feature map.
[0125] The first texture generation network includes a linear layer, which is configured to generate an initial texture image of the three-dimensional model based on texture information corresponding to the category information. The linear layer is a basic component of a neural network that realizes linear transformation from input to output through a learnable weight matrix W and a bias vector b, also known as a fully connected layer.
[0126] The feature extraction network includes M two-dimensional convolution layers, M batch normalization layers, and a transformer encoding layer. Each two-dimensional convolution layer includes X convolution kernels, and M and X are positive integers. The two-dimensional convolution layer is a neural network layer that extracts local features by sliding the convolution kernel (Kernel) in the height (H) and width (W) of the input image. The batch normalization layer is a layer that normalizes the distribution of input data of each layer of the neural network (zero mean, unit variance). The transformer encoding layer is a module constructed based on a self-attention mechanism (Self-Attention) and a feed-forward neural network (FFN), which is used to model the long-range dependencies between elements in the input sequence.
[0127] Optionally, the first two-dimensional convolution layer is configured to perform convolution processing on the initial texture image through the X convolution kernels to obtain local feature maps corresponding to X regions of the initial texture image; the first batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the first two-dimensional convolution layer to obtain X batch-normalized local feature maps; the i-th two-dimensional convolution layer is configured to perform convolution processing on the X local feature maps output by the (i-1)-th batch normalization layer through the X convolution kernels to obtain X convolution-processed local feature maps, i is a positive integer greater than 1 and less than or equal to M; the i-th batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the i-th two-dimensional convolution layer to obtain X batch-normalized local feature maps; and the transformer encoding layer is configured to perform feature extraction on the X local feature maps output by the M-th batch normalization layer to obtain a feature map of the initial texture image.
[0128] In one possible implementation, the two-dimensional convolution layer performs convolution processing on the initial texture image according to the following formula three.
[0129] Formula three:
[0130] In formula three, Conv(x) represents a two-dimensional convolution operation, k represents the size of the convolution kernel in the two-dimensional convolution layer, w ij represents the weight of the convolution kernel, x i,j represents the pixel value of the initial texture image, and i and j represent the row coordinate and column coordinate of the pixel point in the initial texture image within the convolution window, respectively.
[0131] In a possible implementation, the batch normalization layer performs batch normalization processing on the local feature map according to the following formula four.
[0132] Formula four:
[0133] where BN(x) represents the batch normalization operation, x represents a pixel value of the local feature map of the initial texture image, μ and σ 2 respectively represent the mean and variance, and ε is a constant.
[0134] The feature extraction network adopts a convolution-Transformer hybrid structure. In a possible implementation, the feature extraction network can be represented as the following formula five.
[0135] Formula five: Hybrid(x) = Transformer(Conv(x))
[0136] where Hybrid(x) is an output of the feature extraction network, that is, a feature map of the initial texture image. Transformer represents a transformer encoding layer, and Conv(x) is a local feature map of the initial texture image after convolution processing.
[0137] In a possible implementation, the transformer encoding layer is configured to perform feature extraction on the plurality of local feature maps based on an attention mechanism. The attention mechanism can be represented as the following formula six.
[0138] Formula six:
[0139] where Q, K, and V respectively represent a query vector, a key vector, and a value vector, d k represents a dimension of K.
[0140] where the second texture generation network includes a transformer decoding layer, and the transformer decoding layer is configured to decode the feature map based on the contour information to obtain the target texture image of the three-dimensional model.
[0141] For example, FIG. 5 is a schematic diagram of a texture rendering process provided by an embodiment of the present application. As shown in FIG. 5, the computer device can input mesh data of a three-dimensional model into a texture generation model, and the texture generation model obtains a texture image of the three-dimensional model by processing the mesh data. The computer device renders the three-dimensional model based on the texture image to obtain a rendered three-dimensional model.
[0142] The embodiment of the present application provides a texture image generation method, which can quickly generate a texture image matched with the category and contour of a three-dimensional model based on grid data of the three-dimensional model, and does not need an art engineer to manually draw the texture image, thereby greatly improving the generation efficiency of the texture image. Since the texture image is matched with the category and contour of the three-dimensional model, the texture image can be guaranteed to be surface-adhered to the three-dimensional model, thereby guaranteeing the quality of the texture image.
[0143] Further, by sequentially performing convolution processing, pooling processing and full connection processing on the grid data of the three-dimensional model, the computer device can effectively learn the local features and global features of the three-dimensional model, and further accurately predict the category information and contour information of the three-dimensional model based on the global feature map extracted from the grid data, thereby improving the accuracy of the predicted category information and contour information.
[0144] Further, by sequentially performing convolution processing, batch normalization processing and feature extraction on the initial texture image of the three-dimensional model, the computer device can effectively learn the local features and global features of the initial texture image, thereby improving the quality of the target texture image obtained by decoding the feature map of the initial texture image.
[0145] FIG. 6 is a flowchart of a training method of a texture generation model provided by an embodiment of the present application, which is executed by a computer device, as shown in FIG. 6, and the method comprises the following steps:
[0146] 601. The computer device pre-processes a sample image set, and the sample image set comprises a plurality of sample texture images with different materials.
[0147] In the embodiment of the present application, the sample image set can comprise sample texture images corresponding to a plurality of materials, and the plurality of materials can comprise metal, wood, cloth and the like. In the sample image set, the sample texture images corresponding to one kind of material can be one or more, which is not limited in the embodiment of the present application.
[0148] After the server obtains the sample image set, the sample image set can be pre-processed to optimize the sample image set. The pre-processing comprises at least one of the following processing:
[0149] (1) The computer device performs normalization processing on the plurality of sample texture images, and the normalization processing is used to map the pixel values of the pixel points in the plurality of sample texture images to a preset value range.
[0150] In one possible implementation, for any sample texture image, the computer device performs normalization processing on the sample texture image by using the following Formula Seven.
[0151] Formula Seven:
[0152] wherein T' represents the pixel value of each pixel point in the normalized sample texture image, T represents the pixel value of each pixel point in the original sample texture image, min(T) represents the minimum pixel value in the sample texture image, and max(T) represents the maximum pixel value in the sample texture image.
[0153] (2) The computer device adjusts the size of the plurality of sample texture images to a preset size.
[0154] In a possible implementation, for any sample texture image, the computer device performs cropping on the sample texture image to adjust the size of the sample texture image by using the following formula eight.
[0155] Formula eight: T" = crop(T, w, h)
[0156] wherein T" represents the cropped sample texture image, T represents the original sample texture image, w and h respectively represent the width and height in the preset size, and crop() is a cropping function.
[0157] (3) The computer device performs data augmentation processing on the plurality of sample texture images, and adds the plurality of sample texture images after the data augmentation processing to the sample image set, the data augmentation processing including at least one of rotation, translation, and scaling.
[0158] In a possible implementation, for any sample texture image, the computer device performs rotation on the sample texture image by using the following formula nine.
[0159] Formula nine: T'" = rotate(T, θ)
[0160] wherein T'" represents the rotated sample texture image, T represents the original sample texture image, θ represents a rotation angle, and rotate() is a rotation function.
[0161] In a possible implementation, for any sample texture image, the computer device performs translation on the sample texture image by using the following formula ten.
[0162] Formula ten: T"" = translate(T, Δx, Δy)
[0163] wherein T"" represents the translated sample texture image, T represents the original sample texture image, Δx and Δy respectively represent the horizontal distance and the vertical distance of the translation, and translate() is a translation function.
[0164] In a possible implementation, for any sample texture image, the computer device performs scaling on the sample texture image by using the following formula eleven.
[0165] Formula eleven: T"'" = scale(T, s)
[0166] wherein T"'" represents the scaled sample texture image, T represents the original sample texture image, s represents the scaling ratio, and scale() is a scaling function.
[0167] The computer device can standardize the image sizes of the plurality of sample texture images by performing the above preprocessing on the plurality of sample texture images in the sample image set, facilitating the texture generation model to process. Moreover, since the sample image set includes not only the original sample texture images but also the sample texture images processed by data augmentation, the data diversity of the sample image set is increased, and the generalization capability of the texture generation model is enhanced.
[0168] In another embodiment, after the computer device obtains the sample image set, the computer device no longer performs preprocessing on the sample image set.
[0169] 602. The computer device obtains mesh data of a sample three-dimensional model, the mesh data being used to indicate a structure of the sample three-dimensional model.
[0170] In the embodiments of the present application, the computer device can obtain the mesh data of the sample three-dimensional model from the database, and can also obtain the mesh data of the sample three-dimensional model uploaded by the terminal, which is not limited in the embodiments of the present application. The mesh data of the sample three-dimensional model includes the same content as the mesh data of the three-dimensional model in the above embodiments, which is not described herein again.
[0171] 603. The computer device processes the mesh data by using a texture generation model to obtain a predicted texture image of the sample three-dimensional model, the predicted texture image including predicted texture region images corresponding to a plurality of surface regions of the sample three-dimensional model, wherein the material in each surface region is the same.
[0172] The step 603 is the same as the process of generating the target texture image by using the texture generation model in the above embodiments.
[0173] Optionally, the texture generation model includes a three-dimensional data processing network, a first texture generation network, a feature extraction network, and a second texture generation network. The three-dimensional data processing network includes a three-dimensional convolution layer, a three-dimensional pooling layer, and a fully connected layer, and the three-dimensional convolution layer includes N convolution kernels, where N is a positive integer. The first texture generation network includes a linear layer. The feature extraction network includes M two-dimensional convolution layers, M batch normalization layers, and a transformer encoding layer, each two-dimensional convolution layer includes X convolution kernels, and M and X are positive integers. The second texture generation network includes a transformer decoding layer.
[0174] Firstly, the computer device processes the mesh data through a three-dimensional data processing network in the texture generation model to obtain prediction category information and contour information of the sample three-dimensional model. The prediction category information is used to indicate the prediction category to which the sample three-dimensional model belongs, and the contour information is used to indicate the contour of the sample three-dimensional model.
[0175] Then, the computer device generates an initial texture image of the sample three-dimensional model based on texture information corresponding to the prediction category information through a first texture generation network in the texture generation model. The texture information includes a texture type corresponding to each vertex in a three-dimensional model of an object belonging to the prediction category.
[0176] Then, the computer device obtains a feature map of the initial texture image through a feature extraction network in the texture generation model.
[0177] Finally, the computer device decodes the feature map based on the contour information of the sample three-dimensional model through a second texture generation network in the texture generation model to obtain a prediction texture image of the sample three-dimensional model, so that the contour of the prediction texture image matches the contour information.
[0178] The prediction texture image includes a plurality of prediction texture region images corresponding to a plurality of surface regions of the sample three-dimensional model, and the material in each surface region is the same, that is, the prediction texture region image is used to represent the texture presented by a surface region of the sample three-dimensional model.
[0179] 604. For any prediction texture region image in the prediction texture image, the computer device determines a sample texture image conforming to the material corresponding to the prediction texture region image from the sample image set.
[0180] In the embodiments of the present application, the sample image set includes a plurality of sample texture images with different materials, and the materials corresponding to different prediction texture region images are different. Therefore, in order to evaluate the quality of each prediction texture region image in the prediction texture image generated by the texture generation model, the computer device can determine a plurality of sample texture images conforming to the material corresponding to each prediction texture region image from the sample image set.
[0181] 605. The computer device determines a first loss based on the plurality of prediction texture region images and the plurality of sample texture images, and the first loss is used to indicate the difference between the plurality of prediction texture images and the corresponding sample texture images.
[0182] In the embodiments of the present application, the first loss is used to indicate the difference between the plurality of predicted texture images and the corresponding sample texture images. The smaller the first loss is, the smaller the difference between the plurality of predicted texture images and the corresponding sample texture images is, and the higher the quality of the predicted texture images generated by the texture generation model is. Accordingly, the computer device can evaluate the quality of the predicted texture images generated by the texture generation model, that is, evaluate the performance of the texture generation model, according to the first loss.
[0183] In a possible implementation, the computer device determines the first loss by the following Formula Twelve.
[0184] Formula Twelve:
[0185] wherein, The first loss, that is, the perceptual loss, is denoted by φ, and φ represents a pre-trained feature extraction network, such as VGG (a convolutional neural network), ResNet (a residual network), etc. The i-th predicted texture region image is denoted by yi, i is any integer in the interval [1, N], N represents the number of predicted texture region images, and |. |2 represents the L2 distance. i The sample texture image corresponding to the i-th predicted texture region image is denoted by yi, i is any integer in the interval [1, N], N represents the number of predicted texture region images, and |. |2 represents the L2 distance.
[0186] 606. The computer device updates the model parameters of the texture generation model based on the first loss.
[0187] In the embodiments of the present application, the computer device updates the model parameters of the texture generation model based on the first loss, so as to reduce the loss value of the texture generation model and obtain an updated texture generation model. If the updated texture generation model meets the training end condition, such as the training times being the target times or the first loss being in the target range, the updated texture generation model is taken as the trained texture generation model. If the updated texture generation model does not meet the training end condition, the texture generation model is updated again in the manner of steps 603 to 606 until the updated texture generation model meets the training end condition, and the trained texture generation model is obtained.
[0188] In a possible implementation, the computer device updates the model parameters of the texture generation model by the following Formula Thirteen.
[0189] Formula Thirteen:
[0190] wherein, t The model parameters of the t-th iteration are denoted by θt, and the model parameters of the t+1-th iteration are denoted by θt+1. t+1 The model parameters of the t-th iteration are denoted by θt, and the model parameters of the t+1-th iteration are denoted by θt+1. and respectively represent the momentum estimation and the second-order momentum estimation. The momentum term is introduced to accelerate the update of the model parameters. ε is a constant.
[0191] In a possible implementation, the computer device adjusts the learning rate of the texture generation model through the following Formula Fourteen.
[0192] Formula Fourteen:
[0193] where t represents the iteration number, α t represents the learning rate of the t-th iteration, α0 represents the initial learning rate, and λ represents the decay coefficient.
[0194] In some embodiments, the computer device can further obtain real class information of the sample three-dimensional model, the real class information being used to indicate a real class to which the sample three-dimensional model belongs; determine a second loss based on the predicted class information output by the three-dimensional data processing network in the texture generation model and the real class information, the second loss being used to indicate a difference between the predicted class information and the real class information. Accordingly, the step 606 can be replaced by: updating the model parameters of the texture generation model based on the first loss and the second loss. Optionally, the computer device performs weighted summation on the first loss and the second loss to obtain a total loss of the texture generation model, and then updates the model parameters of the texture generation model based on the total loss. By introducing the second loss, the class prediction capability of the texture generation model for the three-dimensional model can be improved, and thus the accuracy of the initial texture image generated for the three-dimensional model can be improved.
[0195] In a possible implementation, the computer device determines the second loss through the following Formula Fifteen.
[0196] Formula Fifteen:
[0197] where, represents the second loss, that is, the cross-entropy loss. represents the predicted class information, y i represents the real class information, and i is any integer in the interval [1, N], where N represents the number of sample three-dimensional models.
[0198] The embodiment of the present application provides a training method of a texture generation model, which trains the texture generation model based on a sample image set and mesh data of a sample three-dimensional model, so that the texture generation model learns the capability of generating a texture image of a three-dimensional model based on mesh data of the three-dimensional model.
[0199] And by updating the model parameters of the texture generation model based on the first loss, the accuracy of the texture image generated by the texture generation model for the three-dimensional model can be improved, that is, the quality of the texture image is improved.
[0200] And by updating the model parameters of the texture generation model based on the first loss and the second loss, not only the accuracy of the texture image generated by the texture generation model for the three-dimensional model can be improved, but also the accuracy of the category information predicted by the texture generation model for the three-dimensional model is improved, and further the accuracy of the initial texture image corresponding to the category information is improved, so that the accuracy of the texture image is further improved.
[0201] And by performing the above preprocessing on the plurality of sample texture images in the sample image set, not only the image sizes of the plurality of sample texture images can be standardized, but also the generalization ability of the texture generation model is enhanced because the sample image set includes not only the original sample texture images but also the sample texture images after data enhancement processing.
[0202] FIG. 7 is a flowchart of another method for generating a texture image according to an embodiment of the present application. The embodiment of the present application is executed by a computer device. Referring to FIG. 7, the method includes the following steps:
[0203] 701. The computer device performs preprocessing on the three-dimensional model.
[0204] In the embodiment of the present application, the preprocessing includes at least one of the following:
[0205] (1) For any vertex of the three-dimensional model, if the vertex is not connected to any vertex, the computer device removes the vertex. If the vertex is not connected to any vertex, it means that the vertex is an isolated vertex in the three-dimensional model, that is, the vertex can be regarded as a redundant vertex of the three-dimensional model. The computer device can remove the vertex to reduce the number of vertices, simplify the structure of the three-dimensional model, and improve the rendering efficiency of the three-dimensional model.
[0206] In one possible implementation manner, the computer device determines whether the vertex is an isolated vertex by using the following Formula Sixteen.
[0207] Formula Sixteen: V isolated = {v e V | degree (v) = 0}
[0208] wherein V represents a vertex set of the three-dimensional model, v represents any vertex in the vertex set of the three-dimensional model, and degree(v) represents a connection degree of the vertex v, i.e., a connection condition of the vertex v with other vertices in the vertex set. degree(v) = 0 means that the vertex v is not connected with any vertex, i.e., the vertex v is an isolated vertex to be removed. isolated represents a vertex set of the three-dimensional model.
[0209] (2) In a case where a distance between any two vertices not connected in the three-dimensional model is less than a distance threshold, the computer device merges the two vertices into one vertex. In a case where a distance between any two vertices not connected is less than a distance threshold, it is indicated that the two vertices are very close in position, i.e., the two vertices can be regarded as overlapping vertices of the three-dimensional model. The computer device can merge the two vertices into one vertex to reduce the number of vertices, simplify the structure of the three-dimensional model, and improve the rendering efficiency of the three-dimensional model.
[0210] In a possible implementation, the computer device determines whether the two vertices are overlapping vertices by using the following formula seventeen.
[0211] Formula seventeen: V merged = {v i ≈v j ∣v i ,v j ∈V,|v i -v j |<ε}
[0212] wherein V represents a vertex set of the three-dimensional model, |v i -v j | represents a distance between the vertex v i and the vertex v j in the vertex set, ∈ represents a distance threshold, and in a case where |v i -v j |<∈, it is considered that v i ≈v j , i.e., the vertex v i and the vertex v j are overlapping vertices. V merged represents a vertex set of the three-dimensional model. i and j are both positive integers, and i≠j.
[0213] (3) For any one of the plurality of edges of the three-dimensional model, in a case where the edge satisfies an edge collapse condition, the computer device collapses the edge by merging the edge and two vertices connected to the edge into one vertex. The edge collapse condition can be that the edge is a common edge of two faces, that is, the edge is a common edge. In this way, by collapsing the edge, some vertices in the three-dimensional model are not lost. By collapsing the edge, the number of faces in the three-dimensional model can be reduced, the structure of the three-dimensional model can be simplified, and the rendering efficiency of the three-dimensional model can be improved.
[0214] In a possible implementation, the computer device collapses the edge by using the following eighteenth formula.
[0215] Eighteenth formula: E collapsed = {(v i , v j ) | collapse(v i , v j )}
[0216] wherein v i and v j are two vertices connected to the edge that satisfies the edge collapse condition in the three-dimensional model, collapse() is an edge collapse function, and is used to merge v i and v j connected to the edge into one vertex. E collapsed represents a set of edges that need to be collapsed in the three-dimensional model. i and j are positive integers, and i≠j.
[0217] (4) For any one of the plurality of faces in the three-dimensional model, in a case where vertices of the face are collinear, the computer device removes the face. In the case where the vertices of the face are collinear, it means that the area of the face is 0, that is, the face can be regarded as a redundant face of the three-dimensional model. The computer device can remove the face to reduce the number of faces, simplify the structure of the three-dimensional model, and improve the rendering efficiency of the three-dimensional model.
[0218] In a possible implementation, the computer device determines that the face is a redundant face by using the following nineteenth formula.
[0219] Nineteenth formula: F redundant = {f | area(f) = 0}
[0220] wherein F represents a face set, f represents any one of the faces in the face set of the three-dimensional model, area(f) represents an area of the face f, and area(f) = 0 means that the area of the face f is 0, that is, the face f is a redundant face. F redundant represents a set of faces that need to be removed in the three-dimensional model.
[0221] 702、The computer device performs UV unwrapping on the three-dimensional model to obtain a UV unwrapping diagram of the three-dimensional model, the UV unwrapping diagram being a two-dimensional image carrying UV coordinate information, the UV coordinate information including UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent coordinates of the vertex on a UV plane.
[0222] In the embodiments of the present application, the surface of the three-dimensional model is a mesh composed of triangles or polygons. UV unwrapping is a parameterization process of unwrapping the geometry of the surface of the three-dimensional model to a two-dimensional plane, which establishes a mapping relationship between the model surface and a texture map by assigning two-dimensional texture coordinates (U, V) to each three-dimensional vertex, so that the two-dimensional texture can be accurately fitted to the three-dimensional model. That is, UV unwrapping is used to unwrap the surface of the three-dimensional model into a two-dimensional plane, which is referred to as a UV plane, the coordinates of the vertex on the two-dimensional plane are referred to as UV coordinates, and the two-dimensional image formed by displaying the three-dimensional model on the two-dimensional plane is referred to as a UV unwrapping diagram. Among them, U and V represent two directions on the two-dimensional image respectively. Each vertex in the three-dimensional model has a coordinate (X, Y, Z) in the three-dimensional space, and also has a corresponding coordinate (U, V) on the UV unwrapping diagram after UV unwrapping. By performing UV unwrapping on the three-dimensional model, subsequent texture mapping on the three-dimensional model based on the UV coordinates can be facilitated.
[0223] In some embodiments, the computer device can segment the three-dimensional model into several parts before performing UV unwrapping. Accordingly, step 702 includes: the computer device segments the three-dimensional model based on the mesh data of the three-dimensional model to obtain a plurality of three-dimensional sub-models corresponding to a plurality of parts; the computer device respectively performs UV unwrapping on the plurality of three-dimensional sub-models to obtain a plurality of UV unwrapping diagrams, each UV unwrapping diagram corresponding to a three-dimensional sub-model, that is, obtaining the UV unwrapping diagrams of the plurality of three-dimensional sub-models; and the computer device splices the plurality of UV unwrapping diagrams to obtain the UV unwrapping diagram of the three-dimensional model. Among them, different three-dimensional sub-models correspond to different parts of the three-dimensional model. The UV unwrapping diagram of the three-dimensional sub-model is the UV unwrapping diagram corresponding to a part of the three-dimensional model. By splicing the plurality of three-dimensional sub-models, the UV unwrapping diagrams corresponding to the plurality of parts of the three-dimensional model can be spliced to obtain the UV unwrapping diagram of the three-dimensional model.
[0224] The computer device can perform more detailed UV unwrapping on the three-dimensional model by respectively performing UV unwrapping on the plurality of three-dimensional sub-models. For a three-dimensional model with complex structure, the difficulty of UV unwrapping can be reduced, and the accuracy of the UV coordinates corresponding to the vertex can be improved, thereby improving the rendering effect of the three-dimensional model.
[0225] In some embodiments, the computer device can perform UV unwrapping on the three-dimensional sub-model based on the angles corresponding to the vertices. Accordingly, for any three-dimensional sub-model, the computer device determines, based on the mesh data of the three-dimensional sub-model, a first angle corresponding to each vertex, the first angle corresponding to the vertex being an angle between a line connecting the vertex and two adjacent vertices in the three-dimensional sub-model; the computer device randomly assigns a UV coordinate to each vertex in the three-dimensional sub-model; the computer device determines a second angle corresponding to each vertex, the second angle corresponding to the vertex being an angle between a line connecting the vertex and two adjacent vertices in the UV unwrapping diagram of the three-dimensional sub-model; the computer device determines an energy value corresponding to the three-dimensional sub-model based on the first angle and the second angle corresponding to each vertex, the energy value being used to simulate a distortion energy generated by an angle change of the three-dimensional sub-model before and after unwrapping; in a case where the energy value is not less than a preset threshold, the UV coordinate of each vertex is adjusted until, in a case where the energy value determined after the adjustment is less than the preset threshold, a UV unwrapping diagram of the three-dimensional sub-model is generated based on the adjusted UV coordinate of each vertex. In a case where the vertex is a vertex constituting any face of the surface of the three-dimensional sub-model, the first angle corresponding to the vertex is an angle between a line connecting the vertex and two adjacent vertices in the face. The computer device can determine, based on the UV coordinates assigned to the vertex and the two adjacent vertices of the vertex, relative positions of the vertex and the two adjacent vertices of the vertex in the UV unwrapping diagram, and further determine the angle between the line connecting the vertex and the two adjacent vertices in the UV unwrapping diagram, i.e., the second angle. The distortion energy is an index used to quantify the degree of angle distortion in the UV unwrapping process of the three-dimensional model. The distortion energy is a sum (or weighted sum) of squares of differences between 3D angles and UV angles of all vertices, and is used to measure the overall distortion.
[0226] The computer device performs the above UV unwrapping operation, and gradually adjusts the UV coordinate of the vertex until the generated energy value is less than the preset threshold, to determine the UV unwrapping diagram in a case where the energy value is less than the preset threshold. This way can more finely control the process of UV unwrapping, to obtain a better unwrapping effect, better maintain the angle relationship between points, lines and faces in the three-dimensional model, and enable the texture image to more accurately fit the shape of the three-dimensional model when the texture image is mapped to the surface of the three-dimensional model based on the UV coordinate, to reduce the distortion of the texture.
[0227] In one possible implementation manner, the computer device determines the energy value corresponding to the three-dimensional sub-model by the following formula twenty.
[0228] Formula twenty:
[0229] In the formula, F represents a face set, f represents any face in the face set of the three-dimensional sub-model, and θ irepresents the angle between the line connecting the vertex in the face f and its two adjacent vertices in the three-dimensional submodel, i.e., the first angle. i represents the angle between the line connecting the vertex in the face f and its two adjacent vertices in the UV unfolding diagram, i.e., the second angle. ABF is the energy value corresponding to the three-dimensional submodel.
[0230] 703. The computer device determines category information and contour information of the three-dimensional model based on mesh data of the three-dimensional model, the mesh data being used to indicate a structure of the three-dimensional model, the category information being used to indicate a category to which the three-dimensional model belongs, and the contour information being used to indicate a contour of the three-dimensional model.
[0231] In the embodiments of the present application, step 703 is the same as step 201 described above, and thus will not be described herein again.
[0232] 704. The computer device generates an initial texture image of the three-dimensional model based on texture information corresponding to the category information, the texture information including a texture type corresponding to each vertex in a three-dimensional model of an object belonging to the category.
[0233] In the embodiments of the present application, step 704 is the same as step 202 described above, and thus will not be described herein again.
[0234] 705. The computer device acquires a feature map of the initial texture image.
[0235] In the embodiments of the present application, step 705 is the same as step 203 described above, and thus will not be described herein again.
[0236] 706. The computer device decodes the feature map based on the contour information to obtain a target texture image of the three-dimensional model, so that a contour of the target texture image matches the contour information.
[0237] In the embodiments of the present application, step 706 is the same as step 204 described above, and thus will not be described herein again.
[0238] 707. The computer device acquires a texture optimization coefficient of the three-dimensional model,
[0239] In the embodiments of the present application, the texture optimization coefficient includes at least one of a detail enhancement factor, a brightness adjustment factor, a contrast adjustment factor, and a color balance factor. The detail enhancement factor is a scalar parameter that enhances the micro-expression of the texture by amplifying local gradients or high-frequency components (e.g., by Laplacian filtering or wavelet transform). The detail enhancement factor is used to enhance the texture of the texture image of the three-dimensional model. The brightness adjustment factor is an offset parameter that directly acts on the brightness channel of the RGB or HSV space. The brightness adjustment factor is used to adjust the brightness of the texture image of the three-dimensional model. The contrast adjustment factor is used to adjust the contrast of the texture image of the three-dimensional model. The color balance factor is a set of three-channel scaling parameters used to independently adjust the intensity of the red (R), green (G), and blue (B) channels of the texture image to correct color bias or match artistic style. That is, the color balance factor is used to adjust the color balance of the texture image of the three-dimensional model.
[0240] 708、The computer device optimizes the target texture image based on the texture optimization coefficient.
[0241] In the embodiments of the present application, the target texture image is optimized based on the detail enhancement factor, which can enhance the texture of the target texture image and make the target texture image clearer. The target texture image is optimized based on the brightness adjustment factor, which can adjust the brightness of the target texture image and make the target texture image more consistent with the lighting conditions of the virtual scene. The target texture image is optimized based on the contrast adjustment factor, which can adjust the contrast of the target texture image and enhance the visual effect of the target texture image. The target texture image is optimized based on the color balance factor, which can adjust the color balance of the target texture image and make the color of the target texture image more rich and natural.
[0242] In some embodiments, the computer device optimizes the target texture image based on the detail enhancement factor by the following Formula Twenty-one.
[0243] Formula Twenty-one: T enhance = T final + a · Laplacian(T final )
[0244] wherein a is the detail enhancement factor, T final represents the target texture image, Laplacian(T final ) represents Laplacian operator processing of the target texture image, and T enhance represents the optimized target texture image.
[0245] In some embodiments, the computer device optimizes the target texture image based on a brightness adjustment coefficient by using the following Formula Twenty-Two.
[0246] Formula Twenty-Two: T brightness = β · (T final - μbrightness) + μbrightness
[0247] wherein β is the brightness adjustment coefficient, T final represents the target texture image, μbrightnessrepresents the brightness mean value of the target texture image, and T brightness represents the optimized target texture image.
[0248] In some embodiments, the computer device optimizes the target texture image based on a contrast adjustment coefficient by using the following Formula Twenty-Three.
[0249] Formula Twenty-Three: T contrast = γ · (T final - μbrightness) + μbrightness
[0250] wherein γ is the contrast adjustment coefficient, T final represents the target texture image, μbrightnessrepresents the brightness mean value of the target texture image, and T contrast represents the optimized target texture image.
[0251] In some embodiments, the computer device optimizes the target texture image based on a color balance coefficient by using the following Formula Twenty-Four.
[0252] Formula Twenty-Four: T color = T final + δ · ColorShift(T final )
[0253] wherein δ is the color balance coefficient, T final represents the target texture image, ColorShift(T final ) represents a color shift operation on the target texture image, and T color represents the optimized target texture image.
[0254] 709、The computer device acquires UV coordinate information from a UV unwrapping diagram of the three-dimensional model.
[0255] In the embodiments of the present application, the computer device acquires the UV coordinate corresponding to each vertex from the UV unwrapping diagram of the three-dimensional model. The UV coordinate corresponding to the vertex is: U = {u i |u i = (u i , v i ), i = 1, 2,... N v}, wherein u iand v i denotes the number of vertices in the three-dimensional model. i denotes the number of vertices in the three-dimensional model. v denotes the number of vertices in the three-dimensional model. v denotes the number of vertices in the three-dimensional model.
[0256] 710、The computer device maps the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model.
[0257] In the embodiments of the present application, the computer device determines the corresponding pixel of the vertex in the target texture image based on the UV coordinate corresponding to each vertex in the UV coordinate information. Therefore, the computer device can map each pixel on the target texture image to each vertex in the three-dimensional model respectively to realize the rendering of the surface texture of the three-dimensional model. Specifically, the UV coordinate (range [0, 1]) stored by each three-dimensional vertex defines the sampling position of the vertex on the two-dimensional texture image. In the rendering process, the graphics pipeline will perform interpolation calculation based on the UV coordinate of the triangular facet vertex to determine the texture color value corresponding to each segment (pixel) of the model, and finally realize the seamless fitting of the texture image to the surface of the three-dimensional model.
[0258] In a possible implementation manner, the computer device performs texture mapping on the three-dimensional model through the following Formula Twenty-Five.
[0259] Formula Twenty-Five: c(v i )=T final (u i ,v i )
[0260] wherein T final denotes the target texture image, c(v i ) denotes the color of the vertex v i in the three-dimensional model, and u i and v i denote the UV coordinate corresponding to the vertex v i .
[0261] The embodiments of the present application provide a texture image generation method, which can quickly generate a texture image matching the category and contour of a three-dimensional model based on the mesh data of the three-dimensional model, without manually drawing the texture image by an art engineer, thereby greatly improving the generation efficiency of the texture image. Since the texture image matches the category and contour of the three-dimensional model, the texture image can be guaranteed to be fitted to the surface of the three-dimensional model, thereby guaranteeing the quality of the texture image.
[0262] And, by respectively performing UV unfolding on the plurality of three-dimensional sub-models, more accurate UV unfolding of the three-dimensional model can be performed, and for a three-dimensional model with complex structure, the difficulty of UV unfolding can be reduced, and the accuracy of the UV coordinates corresponding to the vertices can be improved, thereby improving the rendering effect of the three-dimensional model.
[0263] And, by performing the above UV unfolding operation, and gradually adjusting the UV coordinates of the vertices until the condition that the energy value is less than the preset threshold is met, the UV unfolding map is determined, thereby the process of UV unfolding can be more accurately controlled to obtain a better unfolding effect, and the angle relationship between the points, lines and surfaces in the three-dimensional model can be better maintained, and when the texture image is mapped to the surface of the three-dimensional model based on the UV coordinates, the texture image can be more accurately fitted to the shape of the three-dimensional model, and the deformation of the texture can be reduced.
[0264] And, by performing the above UV unfolding operation, and gradually adjusting the UV coordinates of the vertices until the condition that the energy value is less than the preset threshold is met, the UV unfolding map is determined, thereby the process of UV unfolding can be more accurately controlled to obtain a better unfolding effect, and the angle relationship between the points, lines and surfaces in the three-dimensional model can be better maintained, and when the texture image is mapped to the surface of the three-dimensional model based on the UV coordinates, the texture image can be more accurately fitted to the shape of the three-dimensional model, and the deformation of the texture can be reduced.
[0265] And, by performing the above UV unfolding operation, and gradually adjusting the UV coordinates of the vertices until the condition that the energy value is less than the preset threshold is met, the UV unfolding map is determined, thereby the process of UV unfolding can be more accurately controlled to obtain a better unfolding effect, and the angle relationship between the points, lines and surfaces in the three-dimensional model can be better maintained, and when the texture image is mapped to the surface of the three-dimensional model based on the UV coordinates, the texture image can be more accurately fitted to the shape of the three-dimensional model, and the deformation of the texture can be reduced.
[0266] The texture image generation method provided by the embodiments of the present application can be applied in various scenes, and the following takes the game production scene as an example for description. FIG. 8 is a flowchart of a three-dimensional model production method provided by an embodiment of the present application, and referring to FIG. 8, the method comprises:
[0267] 801, the game production terminal acquires the mesh data of the three-dimensional model.
[0268] The game client includes a virtual scene and a virtual object that can be arranged in the virtual scene. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictional environment, or a purely fictional environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene, and the dimension of the virtual scene is not limited by the embodiments of the present application. For example, the virtual scene can include the sky, land, ocean, etc., and the land can include desert, city, etc. The user can control the virtual character to move in the virtual scene. Optionally, the virtual scene can provide a battle environment for the virtual object. The virtual scene has virtual resources available for the virtual object. For example, the virtual resources include virtual props required for battle, virtual medicines required for treatment, virtual props required for upgrading, virtual gold coins required for trading, etc.
[0269] In addition, the virtual object includes a virtual character, a virtual building, a virtual prop, etc. The virtual character can be a virtual person, a virtual animal, a virtual spirit, an animation character, etc. The virtual character can be a virtual image in the virtual scene representing a user. The virtual scene can include multiple virtual characters, each virtual character having its own shape and volume in the virtual scene, occupying a part of the space in the virtual scene. The three-dimensional model of the virtual character can be a three-dimensional character constructed based on three-dimensional human skeleton technology. The same virtual character can be displayed in different external images by wearing different skins. In some embodiments, the virtual character can also be implemented in 2.5D or 2D model, which is not limited in the embodiments of the present application.
[0270] There can be various virtual characters in the virtual scene. For example, the virtual character can include a player character controlled by operation on the client, or an artificial intelligence (AI) set in a virtual scene battle, or a non-player character (NPC) set in a virtual scene interaction. Alternatively, the virtual character can be a virtual person participating in a competition in the virtual scene. Alternatively, the number of virtual characters participating in the interaction in the virtual scene can be pre-set or dynamically determined according to the number of clients joining the interaction.
[0271] Therefore, in the process of making a game client, a three-dimensional model of a virtual object needs to be made, a texture image of the three-dimensional model needs to be generated, and the three-dimensional model needs to be rendered based on the texture image to obtain a rendered three-dimensional model.
[0272] First, the game making terminal obtains mesh data of the three-dimensional model, wherein the mesh data can be uploaded to the game making terminal by a game maker or downloaded from a game server by the game making terminal.
[0273] 802. The game making terminal sends a texture generation request to the game server, and the texture generation request carries the mesh data of the three-dimensional model.
[0274] 803. The game server determines the category information and the contour information of the three-dimensional model based on the mesh data, generates an initial texture image based on the texture information corresponding to the category information, obtains a feature map of the initial texture image, decodes the feature map based on the contour information, and obtains a target texture image of the three-dimensional model.
[0275] Step 807 is the same as the above embodiments, which will not be repeated here.
[0276] 804. The game server sends the target texture image to the game making terminal.
[0277] 805、The game production terminal receives the target texture image, renders the three-dimensional model based on the target texture image, obtains a rendered three-dimensional model, and displays the rendered three-dimensional model.
[0278] 806、The game production terminal uploads the rendered three-dimensional model or the target texture image to the game server in response to a confirmation operation on the rendered three-dimensional model.
[0279] The game production terminal displays the rendered three-dimensional model, and the game producer can preview the rendering effect of the three-dimensional model and determine whether the rendering effect of the three-dimensional model meets the requirements. If the rendering effect of the three-dimensional model is satisfactory, a confirmation operation can be triggered to indicate that the three-dimensional model is rendered.
[0280] In another embodiment, if the game producer is not satisfied with the rendering effect of the three-dimensional model, a rejection operation can also be triggered to generate a new target texture image for the three-dimensional model and re-render the three-dimensional model.
[0281] 807、The game server adds the rendered three-dimensional model or the target texture image as game resources of the three-dimensional model to a game resource package of the game client.
[0282] The game server creates a game resource package of the game client, which includes various game resources required for installation or running of the game client. The game server adds the rendered three-dimensional model to the game resource package or adds the target texture image to the game resource package. After the game server publishes the game client, a terminal downloading the game client can install and run the game client based on the game resource package, so as to display the rendered three-dimensional model of the virtual object in the game client.
[0283] Of course, the method provided in the embodiments of the present application can also be applied to other scenarios of generating texture images, which is not limited in the embodiments of the present application.
[0284] FIG. 9 is a structural schematic diagram of a texture image generation apparatus provided in an embodiment of the present application. Referring to FIG. 9, the apparatus includes a determination module 901, a generation module 902, an acquisition module 903, and a decoding module 904.
[0285] The determination module 901 is configured to determine category information and contour information of the three-dimensional model based on mesh data of the three-dimensional model, the mesh data being used to indicate a structure of the three-dimensional model, the category information being used to indicate a category to which the three-dimensional model belongs, and the contour information being used to indicate a contour of the three-dimensional model.
[0286] The generation module 902 is configured to generate an initial texture image of the three-dimensional model based on texture information corresponding to the category information, wherein the texture information includes a texture type corresponding to each vertex in the three-dimensional model of an object belonging to the category.
[0287] The acquisition module 903 is configured to acquire a feature map of the initial texture image.
[0288] The decoding module 904 is configured to decode the feature map based on the contour information to obtain a target texture image of the three-dimensional model, so that the contour of the target texture image matches the contour information.
[0289] In a possible implementation, the determination module 901 is configured to perform convolution processing on the mesh data to obtain a plurality of local feature maps corresponding to a plurality of parts of the three-dimensional model; perform pooling processing on the plurality of local feature maps to obtain a plurality of pooled local feature maps; perform full connection processing on the plurality of pooled local feature maps to obtain a global feature map; and determine the category information and the contour information of the three-dimensional model based on the global feature map.
[0290] In a possible implementation, the texture generation model includes a three-dimensional convolution layer, a three-dimensional pooling layer, and a full connection layer, the three-dimensional convolution layer includes N convolution kernels, N is a positive integer;
[0291] The three-dimensional convolution layer is configured to perform convolution processing on the mesh data by using the N convolution kernels to obtain a plurality of local feature maps corresponding to a plurality of parts of the three-dimensional model;
[0292] The three-dimensional pooling layer is configured to perform pooling processing on the plurality of local feature maps to obtain a plurality of pooled local feature maps;
[0293] The full connection layer is configured to perform full connection processing on the plurality of pooled local feature maps to obtain a global feature map, and determine the category information and the contour information of the three-dimensional model based on the global feature map.
[0294] In a possible implementation, the texture generation model includes a linear layer.
[0295] The linear layer is configured to generate an initial texture image of the three-dimensional model based on texture information corresponding to the category information.
[0296] In a possible implementation, the acquisition module 903 is configured to perform convolution processing on the initial texture image to obtain a plurality of local feature maps corresponding to a plurality of regions of the initial texture image; perform batch normalization processing on the plurality of local feature maps to obtain a plurality of batch-normalized local feature maps; and perform feature extraction on the plurality of batch-normalized local feature maps to obtain a feature map of the initial texture image.
[0297] In a possible implementation, the texture generation model comprises M two-dimensional convolution layers, M batch normalization layers, and a transformer encoding layer, each of the two-dimensional convolution layers comprises X convolution kernels, and M and X are positive integers;
[0298] The first two-dimensional convolution layer is configured to perform convolution processing on the initial texture image by using the X convolution kernels to obtain local feature maps corresponding to X regions of the initial texture image;
[0299] The first batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the first two-dimensional convolution layer to obtain X batch-normalized local feature maps;
[0300] The i-th two-dimensional convolution layer is configured to perform convolution processing on the X local feature maps output by the (i-1)-th batch normalization layer by using the X convolution kernels to obtain X convolution-processed local feature maps, i is a positive integer greater than 1 and less than or equal to M;
[0301] The i-th batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the i-th two-dimensional convolution layer to obtain X batch-normalized local feature maps;
[0302] The transformer encoding layer is configured to perform feature extraction on the X local feature maps output by the M-th batch normalization layer to obtain a feature map of the initial texture image.
[0303] In a possible implementation, the texture generation model comprises a transformer decoding layer;
[0304] The transformer decoding layer is configured to decode the feature map based on the contour information to obtain a target texture image of the three-dimensional model.
[0305] In a possible implementation, the device further comprises:
[0306] The obtaining module 903 is further configured to obtain a texture optimization coefficient of the three-dimensional model;
[0307] The optimization module is configured to optimize the target texture image based on the texture optimization coefficient;
[0308] The texture optimization coefficient comprises at least one of a detail enhancement coefficient, a brightness adjustment coefficient, a contrast adjustment coefficient, and a color balance coefficient.
[0309] The detail enhancement coefficient is used to enhance the texture of the texture image of the three-dimensional model, the brightness adjustment coefficient is used to adjust the brightness of the texture image of the three-dimensional model, the contrast adjustment coefficient is used to adjust the contrast of the texture image of the three-dimensional model, and the color balance coefficient is used to adjust the color balance of the texture image of the three-dimensional model.
[0310] In a possible implementation, the apparatus further includes:
[0311] The rendering module is configured to perform UV unfolding on the three-dimensional model to obtain a UV unfolded diagram of the three-dimensional model, the UV unfolded diagram being a two-dimensional image carrying UV coordinate information, the UV coordinate information including UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded diagram of the three-dimensional model; and mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain the rendered three-dimensional model.
[0312] In a possible implementation, the rendering module is configured to perform segmentation on the three-dimensional model based on mesh data of the three-dimensional model to obtain a plurality of three-dimensional sub-models corresponding to a plurality of parts; perform UV unfolding on the plurality of three-dimensional sub-models respectively to obtain a plurality of UV unfolded diagrams, each UV unfolded diagram corresponding to a three-dimensional sub-model; and splice the UV unfolded diagrams of the plurality of three-dimensional sub-models to obtain the UV unfolded diagram of the three-dimensional model.
[0313] In a possible implementation, the rendering module is configured to, for any three-dimensional sub-model, determine a first angle corresponding to each vertex based on mesh data of the three-dimensional sub-model, the first angle corresponding to the vertex being an included angle between lines connecting the vertex and two adjacent vertices in the three-dimensional sub-model; randomly allocate a UV coordinate to each vertex in the three-dimensional sub-model; determine a second angle corresponding to each vertex, the second angle corresponding to the vertex being an included angle between lines connecting the vertex and two adjacent vertices in the UV unfolded diagram of the three-dimensional sub-model; determine an energy value corresponding to the three-dimensional sub-model based on the first angle and the second angle corresponding to each vertex, the energy value being used to simulate deformation energy generated by angle changes of the three-dimensional sub-model before and after unfolding; in a case where the energy value is not less than a preset threshold, adjust the UV coordinate of each vertex, and in a case where the determined energy value after the adjustment is less than the preset threshold, generate the UV unfolded diagram of the three-dimensional sub-model based on the adjusted UV coordinate of each vertex.
[0314] In a possible implementation, the apparatus further includes:
[0315] The processing module is configured to, for any vertex of the three-dimensional model, remove the vertex in a case where the vertex is not connected with any vertex; merge two vertices into one vertex in a case where a distance between any two vertices that are not connected in the three-dimensional model is less than a distance threshold; for any edge of the three-dimensional model, merge the edge and two vertices connected by the edge into one vertex in a case where the edge satisfies an edge folding condition; and for any face in the three-dimensional model, remove the face in a case where vertices constituting the face are collinear.
[0316] In a possible implementation, the apparatus further includes:
[0317] The training module is configured to obtain mesh data of a sample three-dimensional model; process the mesh data by using a texture generation model to obtain a predicted texture image of the sample three-dimensional model, the predicted texture image including predicted texture region images corresponding to a plurality of surface regions of the sample three-dimensional model, wherein the material in each surface region is the same; for any predicted texture region image in the predicted texture image, determine a sample texture image conforming to the material of the predicted texture region image from a sample image set based on the material of the predicted texture region image, the sample image set including a plurality of sample texture images with different materials; determine a first loss based on the plurality of predicted texture region images and the plurality of sample texture images, the first loss being used to indicate a difference between the plurality of predicted texture images and the corresponding sample texture images; and update model parameters of the texture generation model based on the first loss.
[0318] In a possible implementation, the training module is further configured to perform normalization processing on the plurality of sample texture images, the normalization processing being used to map pixel values of pixel points in the plurality of sample texture images to a preset value range; adjust sizes of the plurality of sample texture images to preset sizes; and perform data enhancement processing on the plurality of sample texture images, and add the plurality of sample texture images after the data enhancement processing to the sample image set, the data enhancement processing including at least one of rotation, translation, and scaling.
[0319] In a possible implementation, the training module is further configured to obtain real class information of the sample three-dimensional model, the real class information being used to indicate a real class to which the sample three-dimensional model belongs; process the mesh data by using the texture generation model to obtain predicted class information of the sample three-dimensional model, the predicted class information being used to indicate a predicted class to which the sample three-dimensional model belongs; and update the model parameters of the texture generation model based on the first loss and the second loss.
[0320] The embodiments of the present application provide a texture image generation method, a texture image generation device, and a server. The texture image generation method comprises: obtaining mesh data of a three-dimensional model; determining a class to which the three-dimensional model belongs and an outline of the three-dimensional model based on the mesh data; generating an initial texture image of the three-dimensional model based on texture information corresponding to the class to which the three-dimensional model belongs; and optimizing the initial texture image based on the outline of the three-dimensional model to obtain a target texture image of the three-dimensional model.
[0321] It should be noted that the texture image generation apparatus provided in the above embodiments is only exemplified by the division of the above functional modules. In actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the texture image generation apparatus and the texture image generation method provided in the above embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0322] The embodiment of the present application further provides a terminal, which comprises a processor and a memory, and the memory stores at least one computer program, which is loaded and executed by the processor to implement the texture image generation method provided in the above embodiments.
[0323] FIG. 10 is a structural schematic diagram of a terminal provided in an embodiment of the present application.
[0324] The terminal 1000 comprises a processor 1001 and a memory 1002.
[0325] The processor 1001 can comprise one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1001 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field Programmable Gate Array), and a PLA (Programmable Logic Array).
[0326] The memory 1002 can comprise one or more computer-readable storage media, which can be non-transitory. The memory 1002 can further comprise a high-speed random access memory, and a non-volatile memory such as one or more disk storage devices, flash storage devices. In a possible implementation manner, the non-transitory computer-readable storage medium in the memory 1002 is used to store at least one computer program, which is used to be possessed by the processor 1001 to implement the texture image generation method provided in the method embodiments of the present application.
[0327] In a possible implementation, the terminal 1000 can further include a peripheral device interface 1003 and at least one peripheral device. The processor 1001, the memory 1002, and the peripheral device interface 1003 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 1003 through a bus, a signal line, or a circuit board. Optionally, the peripheral device includes at least one of a radio frequency circuit 1004, a display screen 1005, a camera component 1006, an audio circuit 1007, and a power supply 1008.
[0328] The peripheral device interface 1003 can be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1001 and the memory 1002.
[0329] The radio frequency circuit 1004 is used to receive and send RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1004 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1004 converts electrical signals into electromagnetic signals for sending, or converts received electromagnetic signals into electrical signals.
[0330] The display screen 1005 is used to display a UI (User Interface). The UI can include graphics, text, icons, videos, and any combination thereof. When the display screen 1005 is a touch display screen, the display screen 1005 also has the capability of collecting touch signals on or above the surface of the display screen 1005. The touch signals can be input to the processor 1001 as control signals for processing. At this time, the display screen 1005 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or soft keyboard.
[0331] The camera component 1006 is used to collect images or videos. Optionally, the camera component 1006 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal 1000, and the rear camera is arranged on the back of the terminal 1000.
[0332] The audio circuit 1007 can include a microphone and a speaker. The microphone is used to collect sound waves of a user and an environment, and convert the sound waves into electrical signals input to the processor 1001 for processing, or input to the radio frequency circuit 1004 to realize voice communication.
[0333] The power supply 1008 is used to supply power to each component in the terminal 1000. The power supply 1008 can be alternating current, direct current, a disposable battery, or a rechargeable battery. When the power supply 1008 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0334] In a possible implementation, the terminal 1000 further includes one or more sensors 1009. The one or more sensors 1009 include, but are not limited to, an acceleration sensor 1010, a gyroscope sensor 1011, a pressure sensor 1012, an optical sensor 1013, and a proximity sensor 1014.
[0335] Those skilled in the art can understand that the structure shown in FIG. 10 does not constitute a limitation on the terminal 1000, and can include more or fewer components than those shown, or combine certain components, or adopt a different component arrangement.
[0336] The embodiment of the present application further provides a server, the terminal includes a processor and a memory, the memory stores at least one computer program, the at least one computer program is loaded and executed by the processor, to realize the texture image generation method provided by the above-mentioned embodiment.
[0337] FIG. 11 is a structural schematic diagram of a server provided by an embodiment of the present application. The server 1100 can be quite different due to different configurations or performances, and can include one or more processors (Central Processing Units, CPU) 1101 and one or more memories 1102. The memory 1102 stores at least one computer program, which is loaded and executed by the processor 1101 to realize the texture image generation method provided by the above-mentioned various method embodiments, or to realize the training method of the texture image generation provided by the above-mentioned various method embodiments. Of course, the server can also have a wired or wireless network interface, a keyboard, and an input and output interface, and other components for realizing the functions of the device, which are not described here in detail.
[0338] The embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium stores at least one computer program, the at least one computer program is loaded and executed by the processor, to realize the texture image generation method provided by the above-mentioned embodiment.
[0339] The embodiment of the present application further provides a computer program product, including a computer program, the computer program is loaded and executed by the processor, to realize the texture image generation method provided by the above-mentioned embodiment.
[0340] Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by programs instructing relevant hardware to complete. The above-mentioned programs can be stored in a computer readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk or an optical disk, etc.
[0341] The above merely provides the optional embodiments of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for generating a texture image, executed by a computer device, the method comprising: determining category information and contour information of a three-dimensional model based on mesh data of the three-dimensional model, the mesh data being used to indicate a structure of the three-dimensional model, the category information being used to indicate a category to which the three-dimensional model belongs, and the contour information being used to indicate a contour of the three-dimensional model; generating an initial texture image of the three-dimensional model based on texture information corresponding to the category information, the texture information comprising a texture type corresponding to each vertex in a three-dimensional model of an object belonging to the category; obtaining a feature map of the initial texture image; and decoding the feature map based on the contour information to obtain a target texture image of the three-dimensional model, so that a contour of the target texture image matches the contour information. The determining of the category information and the contour information of the three-dimensional model based on the mesh data of the three-dimensional model comprises: performing convolution processing on the mesh data to obtain local feature maps corresponding to a plurality of parts of the three-dimensional model; performing pooling processing on the plurality of local feature maps to obtain pooled local feature maps; performing fully connected processing on the pooled local feature maps to obtain a global feature map; and determining the category information and the contour information of the three-dimensional model based on the global feature map. The texture generation model comprises a three-dimensional convolution layer, a three-dimensional pooling layer, and a fully connected layer, the three-dimensional convolution layer comprising N convolution kernels, N being a positive integer; the three-dimensional convolution layer is configured to perform convolution processing on the mesh data by using the N convolution kernels to obtain local feature maps corresponding to N parts of the three-dimensional model; the three-dimensional pooling layer is configured to perform pooling processing on the N local feature maps to obtain pooled local feature maps; and the fully connected layer is configured to perform fully connected processing on the pooled local feature maps to obtain a global feature map, and determine the category information and the contour information of the three-dimensional model based on the global feature map. The texture generation model comprises a linear layer; and the linear layer is configured to generate the initial texture image of the three-dimensional model based on the texture information corresponding to the category information. The obtaining of the feature map of the initial texture image comprises: performing convolution processing on the initial texture image to obtain local feature maps corresponding to a plurality of regions of the initial texture image; performing batch normalization processing on the plurality of local feature maps to obtain batch-normalized local feature maps; and performing feature extraction on the batch-normalized local feature maps to obtain the feature map of the initial texture image.
2. The method of claim 1, wherein, The texture generation model comprises M two-dimensional convolution layers, M batch normalization layers, and a transformer encoding layer, each of the two-dimensional convolution layers comprising X convolution kernels, M and X being positive integers; a first two-dimensional convolution layer is configured to perform convolution processing on the initial texture image by using the X convolution kernels to obtain local feature maps corresponding to X regions of the initial texture image; a first batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the first two-dimensional convolution layer to obtain batch-normalized local feature maps; and the transformer encoding layer is configured to perform feature extraction on the batch-normalized local feature maps to obtain the feature map of the initial texture image. 3. The method of claim 2, wherein, 4. The method of claim 1, wherein, 5. The method of claim 1, wherein, 6. The method of claim 5, wherein, The i-th two-dimensional convolutional layer is configured to perform convolution processing on the X local feature maps output by the i-1-th batch normalization layer through X convolution kernels, to obtain X local feature maps after convolution processing, where i is a positive integer greater than 1 and less than or equal to M; The i-th batch normalization layer is configured to perform batch normalization processing on the X local feature maps output by the i-th two-dimensional convolutional layer, to obtain X local feature maps after batch normalization processing. The transformer encoding layer is configured to perform feature extraction on the X local feature maps output by the M-th batch normalization layer, to obtain a feature map of the initial texture image.
7. The method of claim 1, wherein, The texture generation model comprises a transformer decoding layer. The transformer decoding layer is configured to decode the feature map based on the contour information, to obtain a target texture image of the three-dimensional model.
8. The method of claim 1, wherein, The method further comprises: obtaining a texture optimization coefficient of the three-dimensional model; optimizing the target texture image based on the texture optimization coefficient; wherein the texture optimization coefficient comprises at least one of a detail enhancement coefficient, a brightness adjustment coefficient, a contrast adjustment coefficient, and a color balance coefficient; the detail enhancement coefficient is used to enhance the texture of the texture image of the three-dimensional model, the brightness adjustment coefficient is used to adjust the brightness of the texture image of the three-dimensional model, the contrast adjustment coefficient is used to adjust the contrast of the texture image of the three-dimensional model, and the color balance coefficient is used to adjust the color balance of the texture image of the three-dimensional model.
9. The method of claim 1, wherein, The method further comprises: performing UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information comprising UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent the coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded image of the three-dimensional model; mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model.
10. The method of claim 9, wherein, The method further comprises: performing UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information comprising UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent the coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded image of the three-dimensional model; mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model.
11. The method of claim 10, wherein, The method further comprises: performing UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information comprising UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent the coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded image of the three-dimensional model; mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model. The method further comprises: performing UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information comprising UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent the coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded image of the three-dimensional model; mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model. The method further comprises: performing UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information comprising UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent the coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded image of the three-dimensional model; mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model. The method further comprises: performing UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information comprising UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent the coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded image of the three-dimensional model; mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model. The method further comprises: performing UV unfolding on the three-dimensional model to obtain a UV unfolded image of the three-dimensional model, the UV unfolded image being a two-dimensional image carrying UV coordinate information, the UV coordinate information comprising UV coordinates corresponding to each vertex in the three-dimensional model, the UV coordinates being used to represent the coordinates of the vertex on a UV plane; obtaining the UV coordinate information from the UV unfolded image of the three-dimensional model; mapping the target texture image onto the three-dimensional model based on the UV coordinate information to obtain a rendered three-dimensional model. determining a second angle corresponding to each vertex, the second angle corresponding to the vertex being an angle between a line connecting the vertex and two adjacent vertices in a UV unwrapping diagram of the three-dimensional sub-model; determining an energy value corresponding to the three-dimensional sub-model based on the first angle and the second angle corresponding to each vertex, the energy value being used to simulate deformation energy generated by angle changes of the three-dimensional sub-model before and after unwrapping; in a case where the energy value is not less than a preset threshold, adjusting the UV coordinates of each vertex, and in a case where the energy value determined after the adjustment is less than the preset threshold, generating a UV unwrapping diagram of the three-dimensional sub-model based on the adjusted UV coordinates of each vertex.
12. The method of any one of claims 1-11, wherein, The method further includes at least one of the following: for any vertex of the three-dimensional model, in a case where the vertex is not connected to any vertex, removing the vertex; in a case where a distance between any two vertices not connected in the three-dimensional model is less than a distance threshold, merging the two vertices into one vertex; for any edge of the three-dimensional model, in a case where the edge satisfies an edge folding condition, merging the edge and two vertices connected by the edge into one vertex; for any face in the three-dimensional model, in a case where vertices constituting the face are collinear, removing the face.
13. The method of any one of claims 3 or 6, wherein, The training process of the texture generation model includes: obtaining mesh data of a sample three-dimensional model; processing the mesh data by using the texture generation model to obtain a predicted texture image of the sample three-dimensional model, the predicted texture image including predicted texture region images corresponding to a plurality of surface regions of the sample three-dimensional model, wherein materials in each surface region are the same; for any predicted texture region image in the predicted texture image, based on a material corresponding to the predicted texture region image, determining a sample texture image conforming to the material from a sample image set, the sample image set including a plurality of sample texture images with different materials; based on a plurality of predicted texture region images and a plurality of sample texture images, determining a first loss, the first loss being used to indicate a difference between the plurality of predicted texture images and corresponding sample texture images; based on the first loss, updating model parameters of the texture generation model.
14. The method of claim 13, wherein, The method further includes at least one of the following: performing normalization processing on the plurality of sample texture images, the normalization processing being used to map pixel values of pixel points in the plurality of sample texture images to a preset value range; adjusting sizes of the plurality of sample texture images to preset sizes; performing data enhancement processing on the plurality of sample texture images, and adding the plurality of sample texture images after the data enhancement processing to the sample image set, the data enhancement processing including at least one of rotation, translation, and scaling.
15. The method of claim 13, wherein, The method further includes: obtaining real class information of the sample three-dimensional model, the real class information being used to indicate a real class to which the sample three-dimensional model belongs. The texture generation model is used to process the mesh data to obtain predicted category information of the sample three-dimensional model, the predicted category information being used to indicate a predicted category to which the sample three-dimensional model belongs; Based on the predicted category information and the real category information, a second loss is determined, the second loss being used to indicate a difference between the predicted category information and the real category information; The model parameters of the texture generation model are updated based on the first loss, including: The model parameters of the texture generation model are updated based on the first loss and the second loss.
16. A texture image generation apparatus configured in a computer device, the apparatus comprising: a determination module configured to determine category information and contour information of a three-dimensional model based on mesh data of the three-dimensional model, the mesh data being used to indicate a structure of the three-dimensional model, the category information being used to indicate a category to which the three-dimensional model belongs, and the contour information being used to indicate a contour of the three-dimensional model; a generation module configured to generate an initial texture image of the three-dimensional model based on texture information corresponding to the category information, the texture information including a texture type corresponding to each vertex in a three-dimensional model of an object belonging to the category; an acquisition module configured to acquire a feature map of the initial texture image; a decoding module configured to decode the feature map based on the contour information to obtain a target texture image of the three-dimensional model, so that a contour of the target texture image matches the contour information.
17. A computer device, wherein, The computer device comprises a processor and a memory, and the memory stores at least one computer program, which is loaded and executed by the processor to implement the texture image generation method according to any one of claims 1 to 15.
18. A computer readable storage medium, wherein, The computer readable storage medium stores at least one computer program, which is loaded and executed by the processor to implement the texture image generation method according to any one of claims 1 to 15.
19. A computer program product comprising a computer program, wherein, The computer program is loaded and executed by the processor to implement the texture image generation method according to any one of claims 1 to 15.
Citation Information
Patent Citations
Texture image generation method and device, equipment, storage medium and product
CN115830091A
Sample distribution awareness denoising and rendering
CN116091300A
Three-dimensional model conversion method and device, electronic equipment and storage medium
CN116977570A
Generative latent textured proxies for object category modeling
US20220051485A1
Motion generation using one or more neural networks
US20230274472A1