Method, device, electronic device and storage medium for generating three-dimensional hair model
By obtaining and processing the geometric information of the projection diagram and basic shape model in the hair plane template, a three-dimensional hair model is generated, which solves the problem of inefficient three-dimensional hair modeling in the existing technology, and achieves a more efficient modeling process.
Patent Information
- Application Number
- CN202010800874.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-11
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2040-10-02
AI Technical Summary
The existing three-dimensional hair modeling methods are inefficient and take a lot of time.
By obtaining the hair plane template, selecting the target projection map, obtaining the drawn hair cluster, and determining the geometric information of the hair cluster based on its position information and the geometric information of the basic shape model, thereby generating a three-dimensional hair model.
It improves the generation efficiency of three-dimensional hair modeling, and reduces the difficulty and time consumption of modeling.
Smart Images

Figure CN114078180B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of three-dimensional image processing, and in particular to a method, device, electronic device and storage medium for generating a three-dimensional hair model. Background Art
[0002] With the development of computer vision technology, 3D reconstruction technology has emerged. 3D reconstruction technology depicts real scenes into mathematical models that conform to computer logic expression through processes such as depth data acquisition, preprocessing, point cloud registration and fusion, and surface generation. Since the creation of hair can significantly enhance the realism of virtual images or virtual characters, and 3D reconstruction technology is a key technology for establishing virtual reality that expresses the objective world in computers, how to use 3D reconstruction technology to construct a realistic hair model is an urgent problem to be solved.
[0003] In the related art, hair is modeled based on multi-directional constraints, mainly using the hair surface geometry, hair surface direction and head model geometry reconstructed from the image to reconstruct a complete hair model.
[0004] However, current 3D hair modeling methods are time-consuming and have technical problems of low efficiency. Summary of the invention
[0005] The present disclosure provides a method, device, electronic device and storage medium for generating a three-dimensional hair model, so as to at least solve the technical problem of low efficiency in generating a three-dimensional hair model in the related art. The technical solution of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a method for generating a three-dimensional hair model is provided, comprising:
[0007] Acquire a hair plane template, wherein the hair plane template includes a plurality of projection images, and the projection images are obtained by projecting a basic shape model in a plurality of preset view directions, wherein the basic shape model is a three-dimensional model representing the shape of a basic hairstyle;
[0008] Selecting a target projection image from the hair plane template, and obtaining a drawn hair cluster through the target projection image;
[0009] Determine geometric information of the hair cluster according to position information of the hair cluster in the target projection image and geometric information of a basic shape model corresponding to the target projection image;
[0010] A three-dimensional hair model is generated according to the geometric information of the hair cluster.
[0011] In one embodiment, determining the geometric information of the hair cluster according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image includes:
[0012] From the edge contour of the hair cluster, a preset number of points are obtained as vertices of the hair cluster, and position information of each vertex is obtained, where the position information of each vertex is the position of the vertex in the target projection image;
[0013] The geometric information of each of the vertices is determined according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each of the vertices, where the geometric information of the vertex is the geometric information of the vertex in the basic shape model corresponding to the target projection image.
[0014] Generating a three-dimensional hair model according to the geometric information of the hair cluster comprises:
[0015] The three-dimensional hair model is generated according to the geometric information of each vertex.
[0016] In one embodiment, the geometric information of the basic shape model includes texture coordinates and three-dimensional coordinates of the basic shape model; and determining the geometric information of each vertex according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex includes:
[0017] According to the geometric information of the basic shape model corresponding to the target projection image and the position information of each of the vertices, the texture coordinates of each of the vertices are obtained, where the texture coordinates of the vertex are the texture coordinates of the vertex in the basic shape model corresponding to the target projection image;
[0018] According to the texture coordinates of each vertex and the correspondence between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model, the three-dimensional coordinates of each vertex are obtained, and the three-dimensional coordinates of the vertex are the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image.
[0019] In one embodiment, generating the three-dimensional hair model according to the geometric information of each vertex includes:
[0020] According to the three-dimensional coordinates of each vertex, the vertices are connected according to a preset rule to generate a triangular face;
[0021] The triangular facet is rendered according to the texture coordinates of each of the vertices to generate the three-dimensional hair model.
[0022] In one embodiment, the method of generating the hair plane template includes:
[0023] Acquire the basic shape model;
[0024] Projecting the basic shape model in each of the preset view directions to obtain a projection image of the basic shape model in the preset view direction;
[0025] The hair plane template is generated according to the projection image of the basic shape model in the preset view direction.
[0026] In one embodiment, the preset view directions include a front view direction, a rear view direction, a left view direction and a right view direction.
[0027] According to a second aspect of an embodiment of the present disclosure, there is provided a device for generating a three-dimensional hair model, comprising:
[0028] A plane template acquisition module is configured to acquire a hair plane template, wherein the hair plane template includes a plurality of projection images, and the projection images are obtained by projecting a basic shape model in a plurality of preset view directions, wherein the basic shape model is a three-dimensional model representing the shape of a basic hairstyle;
[0029] A hair cluster acquisition module is configured to select a target projection image from the hair plane template and acquire the drawn hair cluster through the target projection image;
[0030] a hair cluster geometric information determination module, configured to determine the geometric information of the hair cluster according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image;
[0031] The hair model generation module is configured to generate a three-dimensional hair model according to the geometric information of the hair cluster.
[0032] In one of the embodiments, the hair cluster geometric information determination module includes a vertex position information acquisition unit, a vertex geometric information acquisition unit and a hair model generation unit;
[0033] The vertex position information acquisition unit is configured to acquire a preset number of points from the edge contour of the hair cluster as vertices of the hair cluster, and acquire position information of each vertex, wherein the vertex position information is the position of the vertex in the target projection image;
[0034] The vertex geometric information acquisition unit is configured to determine the geometric information of each vertex according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex, wherein the geometric information of the vertex is the geometric information of the vertex in the basic shape model corresponding to the target projection image;
[0035] The hair model generating unit is configured to generate the three-dimensional hair model according to the geometric information of each vertex.
[0036] In one of the embodiments, the geometric information of the basic shape model includes texture coordinates and three-dimensional coordinates of the basic shape model;
[0037] The vertex geometry information acquisition unit is further configured to execute, based on the geometry information of the basic shape model corresponding to the target projection image and the position information of each of the vertices, to obtain the texture coordinates of each of the vertices, the texture coordinates of the vertex being the texture coordinates of the vertex in the basic shape model corresponding to the target projection image; and to obtain, based on the texture coordinates of each of the vertices and the correspondence between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model, the three-dimensional coordinates of each of the vertices, the three-dimensional coordinates of the vertex being the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image.
[0038] In one of the embodiments, the hair model generation unit is further configured to connect each of the vertices according to a preset rule based on the three-dimensional coordinates of each of the vertices to generate a triangular face patch; and render the triangular face patch according to the texture coordinates of each of the vertices to generate the three-dimensional hair model.
[0039] In one of the embodiments, the three-dimensional hair model generation device further includes a hair plane template generation module;
[0040] The hair plane template generation module is configured to execute the acquisition of the basic shape model; project the basic shape model in each of the preset view directions to obtain a projection image of the basic shape model in the preset view direction; and generate the hair plane template according to the projection image of the basic shape model in the preset view direction.
[0041] In one embodiment, the preset view directions include a front view direction, a rear view direction, a left view direction and a right view direction.
[0042] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the method for generating a three-dimensional hair model as described in any one of the first aspects.
[0043] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the method for generating a three-dimensional hair model as described in any one of the first aspects.
[0044] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, the program product comprising a computer program, the computer program being stored in a readable storage medium, at least one processor of a device reading and executing the computer program from the readable storage medium, so that the device executes the method for generating a three-dimensional hair model as described in any one of the embodiments of the first aspect.
[0045] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0046] By obtaining a hair plane template, selecting a target projection image from the hair plane template, and obtaining the drawn hair cluster through the target projection image; determining the geometric information of the hair cluster according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image; thereby generating a three-dimensional hair model according to the geometric information of the hair cluster. Therefore, the scheme of the present disclosure realizes the use of a plane template to complete the three-dimensional hair modeling work, and the scheme of the present disclosure can not only improve the generation efficiency of three-dimensional hair modeling, but also reduce the difficulty of three-dimensional hair modeling.
[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0049] Figure 1 The figure is an application environment diagram of a method for generating a three-dimensional hair model according to an exemplary embodiment.
[0050] Figure 2 The present invention is a flowchart of a method for generating a three-dimensional hair model according to an exemplary embodiment.
[0051] Figure 3 The figure is a flowchart of a method for generating a three-dimensional hair model according to an exemplary embodiment.
[0052] Figure 4 is a flowchart of step S320 in a method for generating a three-dimensional hair model according to an exemplary embodiment.
[0053] Figure 5 is a flowchart of step S330 in a method for generating a three-dimensional hair model according to an exemplary embodiment.
[0054] Figure 6a The figure is a schematic diagram of a projection image list in a hair plane template according to an exemplary embodiment.
[0055] Figure 6b is a schematic diagram of a projection image in a hair plane template according to an exemplary embodiment.
[0056] Figure 7 The figure is a flow chart showing a method for generating a hair plane template according to an exemplary embodiment.
[0057] Figure 8a The present invention is a flowchart of a method for generating a three-dimensional hair model according to an exemplary embodiment.
[0058] Figure 8b to Figure 8d FIG. 4 is a schematic diagram of a hair cluster drawn on a projection image according to an exemplary embodiment.
[0059] Figure 8e to Figure 8g is a schematic diagram of a three-dimensional hair model according to an exemplary embodiment.
[0060] Fig. 9 The invention is a block diagram of a device for generating a three-dimensional hair model according to an exemplary embodiment.
[0061] Fig.10 The figure is a diagram showing the internal structure of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0062] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0063] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0064] The method for generating a three-dimensional hair model provided by the present disclosure can be applied to Figure 1In the application environment shown. The terminal 110 exchanges data with the server 120 through the network, selects a target projection map from the hair plane template, and displays the selected target projection map; in response to the drawing instruction on the target projection map, generates a corresponding hair cluster on the target projection map. The terminal 110 sends the hair plane template and the hair cluster on the target projection map to the server 120. The server 120 obtains the hair plane template, which includes a plurality of projection maps, which are obtained by projecting a basic shape model in a plurality of preset view directions, wherein the basic shape model is a three-dimensional model representing the shape of the basic hairstyle; obtains the drawn hair cluster through the target projection map; determines the geometric information of the hair cluster according to the position information of the hair cluster in the target projection map and the geometric information of the basic shape model corresponding to the target projection map; generates a three-dimensional hair model according to the geometric information of the hair cluster. It can be seen that the scheme of the present disclosure realizes the completion of the three-dimensional hair modeling work by using a plane template, and the scheme of the present disclosure can not only improve the generation efficiency of the three-dimensional hair modeling, but also reduce the difficulty of the three-dimensional hair modeling.
[0065] The terminal 110 may be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0066] Figure 2 is a flow chart of a method for generating a three-dimensional hair model according to an exemplary embodiment. Figure 2 As shown, the method for generating a three-dimensional hair model can be applied to the server 120 or the terminal 110, and includes the following steps:
[0067] In step S210, a hair plane template is obtained.
[0068] Among them, the three-dimensional hair model is a three-dimensional model corresponding to hair with a certain hairstyle, for example, the three-dimensional hair model can be a three-dimensional model corresponding to two-dimensional hair. The hair plane template can be a plane template used to guide graphic designers to design the three-dimensional hair model. Graphic designers can design the plane material of the three-dimensional hair model through the hair plane template. The hair plane template includes multiple projections, and the projections are obtained by projecting the basic shape model in multiple preset view directions. The basic shape model is a three-dimensional model that characterizes the shape of the basic hairstyle. For example, the basic shape model can be a three-dimensional model obtained by summarizing and abstracting the characteristics and shapes of common hairstyles, and common hairstyles can be long hair, short hair, bangs, back hair, ponytail, bun, etc. The surface of the basic shape model is the curved surface attached to the hair of various basic hairstyles. The view direction is the direction in which the light is projected from one side of the basic shape model to the opposite side, and can also be understood as the direction in which the line of sight is projected from one side of the basic shape model to the opposite side, such as projecting from the front of the basic shape model to the back, from the left side of the basic shape model to the right side, and from the top of the basic shape model to the bottom. The preset view direction includes the main view direction, the rear view direction, the left view direction, and the right view direction. The projection image refers to the view obtained by projecting light from one side of an object to its opposite side. Specifically, the hair plane template is obtained from a local computer or loaded from another computer device connected to the computer network.
[0069] In step S220, a target projection image is selected from the hair plane template, and the drawn hair cluster is obtained through the target projection image.
[0070] The hair is composed of several groups of hair clusters, and the three-dimensional hair model is also composed of several hair clusters. The drawn hair clusters are the plane images of the hair clusters constituting the three-dimensional hair model in the target projection map. On the target projection map, the designer draws the shape and texture of each hair cluster from the view direction corresponding to the target projection map to design the three-dimensional hair model. Specifically, after obtaining the hair plane template, the multiple projection maps included in the hair plane template can be displayed, and the designer selects the target projection map from the hair plane template in combination with the actual design requirements. After the designer completes the drawing of the hair clusters on the target projection map, the drawn hair clusters can be immediately sent to the server or the current computer background, so that the server or the computer background obtains the hair clusters drawn on the target projection map. In addition, the drawn hair clusters can also be stored in advance in the local computer, and the hair clusters drawn on the target projection map are obtained from the local computer. The hair clusters drawn on the target projection map can also be stored in advance in another computer device connected to the local network of the computer, and the hair clusters drawn on the target projection map are obtained from another computer device connected to the local network of the computer.
[0071] In step S230, the geometric information of the hair cluster is determined according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image.
[0072] The position information of the hair cluster in the target projection image refers to the position information of the hair cluster drawn by the designer on the projection image relative to the target projection image. The geometric information is information or data used to characterize the texture features, spatial structure, and spatial position of the three-dimensional model. Each basic shape model has corresponding geometric information, which is used to characterize the spatial structure of the basic shape model, the spatial position of each vertex, etc. Specifically, at least one hair cluster is drawn on the target projection image, and the position information of the drawn hair cluster in the target projection image is known, so that the position information of the drawn hair cluster in the target projection image can be obtained. In order to accurately and quickly generate a three-dimensional hair model, the geometric information of the basic shape model corresponding to the target projection image is obtained. Furthermore, the drawn hair cluster is attached to the projection contour of the basic shape model, and there is a projection relationship between the projection of the basic shape model and the basic shape model corresponding to the target projection image. Then, the geometric information of the hair cluster can be determined by using the position information of the drawn hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image.
[0073] In step S240, a three-dimensional hair model is generated according to the geometric information of the hair cluster.
[0074] As mentioned above, hair is composed of several groups of hair clusters, and the three-dimensional hair model is also composed of several hair clusters. Specifically, the geometric information of the hair cluster includes the texture information and three-dimensional information of the hair cluster. The spatial structure of the hair cluster is generated according to the three-dimensional information of the hair cluster, and the surface of the spatial structure of the hair cluster is rendered according to the texture information of the hair cluster. Finally, the three-dimensional hair model is constructed using the rendered several hair clusters.
[0075] In the above-mentioned method for generating a three-dimensional hair model, a hair plane template is obtained, a target projection image is selected from the hair plane template, and the drawn hair cluster is obtained through the target projection image; the geometric information of the hair cluster is determined according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image; thus, a three-dimensional hair model is generated according to the geometric information of the hair cluster. Therefore, this embodiment realizes the use of a plane template to complete the three-dimensional hair modeling work, and according to this embodiment, not only the generation efficiency of the three-dimensional hair modeling can be improved, but also the difficulty of the three-dimensional hair modeling can be reduced.
[0076] In an exemplary embodiment, if Figure 3As shown, in step S230, the geometric information of the hair cluster is determined according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image, which can be specifically achieved by the following steps:
[0077] In step S310, a preset number of points are obtained from the edge contour of the hair cluster as vertices of the hair cluster, and position information of each vertex is obtained.
[0078] Among them, the position information of the vertex is the position of the vertex in the target projection image. The edge contour refers to the boundary line of the outer edge of the drawn hair cluster. The target projection image has a hair cluster drawn, and the edge contour of the hair cluster can be identified by binarization, and the position information of each point in the edge contour is known. Exemplarily, for example, the target projection image with the hair cluster drawn can be first gray-scaled and then binarized to extract the edge contour of the drawn hair cluster. For another example, the target projection image and the drawn hair cluster are placed in different layers, and the transparency of the target projection image and the drawn hair cluster is set respectively, and the edge contour of the drawn hair cluster is displayed, thereby extracting the edge contour of the drawn hair cluster. The basic shape model is composed of many triangular facets, and the vertices of the basic shape model are the vertices of each triangular facet.
[0079] Specifically, the basic shape model is projected in each preset view direction, and the vertices of the basic shape model are projected in the projection image, and there is a corresponding relationship between the selected preset number of points and the vertices of the basic shape model. In order to generate a three-dimensional hair model using the hair clusters in the target projection image, a preset number of points are selected as vertices. In order to use these vertices to reconstruct the three-dimensional hair model, it is necessary to obtain the position information of these vertices in the target projection image.
[0080] In step S320, the geometric information of each vertex is determined according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex.
[0081] The geometric information of the vertex is the geometric information of the vertex in the basic shape model corresponding to the target projection image. Specifically, since the projection image is obtained by projecting the basic shape model in a preset view direction, there is a mapping relationship between each point in the projection image and each vertex on the basic shape model, and the selected preset number of points can find corresponding vertices in the basic shape model. Then, according to the position information of each vertex on the edge contour of the hair cluster in the corresponding projection image, the vertex corresponding to each vertex on the edge contour of the hair cluster in the basic shape model can be determined, and then the geometric information of these vertices in the basic shape model can be determined in combination with the geometric information of the basic shape model.
[0082] In step S240, a three-dimensional hair model is generated according to the geometric information of the hair cluster, which can be specifically achieved by the following steps:
[0083] In step S330, a three-dimensional hair model is generated according to the geometric information of each vertex.
[0084] The three-dimensional hair model includes a plurality of groups of hair clusters, and the reconstruction of the three-dimensional hair model is the reconstruction of each hair cluster. The reconstruction of each hair cluster is completed by using the plane hair cluster drawn by the target projection map. Specifically, the mesh structure of the hair cluster is generated according to the three-dimensional information of each vertex, and the surface of the spatial structure of the hair cluster is rendered according to the texture information of each vertex to obtain the three-dimensional hair model.
[0085] In the above-mentioned method for generating a three-dimensional hair model, a preset number of points are obtained from the edge contour of the hair cluster as the vertices of the hair cluster, and the position information of each vertex is obtained, thereby determining the geometric information of each vertex according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex, and then generating a three-dimensional hair model according to the geometric information of each vertex. It can be seen that the present disclosure can quickly generate a three-dimensional hair model by determining the vertices of the reconstructed three-dimensional model of the hair cluster in the plane projection image, so that it can not only help designers complete the three-dimensional design work through a two-dimensional plane template, but also reduce the learning cost of designers and the time spent on design.
[0086] In an exemplary embodiment, the geometric information of the basic shape model includes texture coordinates and three-dimensional coordinates of the basic shape model. Figure 4 As shown, in step S320, the geometric information of each vertex is determined according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex, which can be specifically achieved by the following steps:
[0087] In step S410, the texture coordinates of each vertex are obtained according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex.
[0088] In step S420, the three-dimensional coordinates of each vertex are obtained according to the texture coordinates of each vertex and the correspondence between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model.
[0089] Among them, the texture coordinates of the vertex are the texture coordinates of the vertex in the basic shape model corresponding to the target projection map. The three-dimensional coordinates of the vertex are the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection map. Texture is the most important factor affecting the realism of the three-dimensional model. The role of texture coordinates is to render the model. Texture coordinates have two coordinate axes, U and V, so they are called UV coordinates. U represents the distribution on the horizontal coordinate and V represents the distribution on the vertical coordinate. The three-dimensional coordinates are used to represent the position information of the basic shape model in the world coordinate system. There is a corresponding relationship between texture coordinates and three-dimensional coordinates.
[0090] Specifically, since the basic shape model is projected in a preset view direction to obtain a projection image, each vertex on the edge contour of the hair cluster in the target projection image can find a corresponding vertex in the basic shape model corresponding to the target projection image. Since there is a mapping relationship between each point in the projection image and each vertex on the basic shape model, the vertex corresponding to each vertex on the edge contour of the hair cluster can be determined in the basic shape model corresponding to the target projection image according to the position information of each vertex on the edge contour of the hair cluster in the corresponding projection image. Since the geometric information of the basic shape model corresponding to the target projection image is known, the texture coordinates of these vertices can be determined, that is, the texture coordinates of these vertices in the basic shape model corresponding to the target projection image. Since there is a one-to-one correspondence between texture coordinates and three-dimensional coordinates, the three-dimensional coordinates of each vertex can be determined according to the texture coordinates of each vertex, that is, the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image.
[0091] In the above-mentioned method for generating a three-dimensional hair model, the texture coordinates of each vertex are obtained according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex; thus, the three-dimensional coordinates of each vertex are obtained according to the texture coordinates of each vertex and the correspondence between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model. This embodiment realizes the design of a three-dimensional hair model using a two-dimensional projection image, and provides the designer with sufficient degrees of freedom, including the shape, texture and overall perspective of each tuft of hair, to complete the design of the hairstyle.
[0092] In an exemplary embodiment, if Figure 5 As shown, in step S330, a three-dimensional hair model is generated according to the geometric information of each vertex, which can be specifically achieved by the following steps:
[0093] In step S510, the vertices are connected according to the three-dimensional coordinates of each vertex according to a preset rule to generate a triangular face.
[0094] In step S520, the triangular patch is rendered according to the texture coordinates of each vertex to generate a three-dimensional hair model.
[0095] Among them, the triangular face is the smallest component unit of the three-dimensional model. Specifically, based on the projection relationship between the basic shape model and the target projection image, several vertices corresponding to the vertices on the edge contour of the hair cluster are determined in the basic shape model corresponding to the target projection image. These vertices are the vertices constituting the three-dimensional hair model. Since the vertex connection rules have been set in advance, these vertices are connected according to the three-dimensional coordinates of these vertices according to the preset rules to generate several triangular face. It can be understood that when these vertices are connected, there must be a connection relationship between the triangular face. The texture coordinates of these vertices are known, and the texture coordinates of these vertices are used to fill the texture map in the generated triangular face for rendering to obtain a three-dimensional hair model.
[0096] In the above-mentioned method for generating a three-dimensional hair model, the vertices are connected according to the three-dimensional coordinates of each vertex according to a preset rule to generate a triangular face patch; and the triangular face patch is rendered according to the texture coordinates of each vertex to generate a three-dimensional hair model. It can be seen that the three-dimensional hair model generated according to this embodiment can more realistically represent various hairstyles.
[0097] In an exemplary embodiment, obtaining the drawn hair clusters through the target projection map can be specifically achieved through the following steps: displaying the target projection map selected from the hair plane template; and generating corresponding hair clusters on the target projection map in response to the drawing instructions on the target projection map.
[0098] Specifically, Figure 6a As shown in the figure, the hair plane template includes projections in the main view direction, projections in the back view direction, projections in the left view direction, and projections in the right view direction. According to actual needs, select a suitable viewing angle and select a target projection from the hair plane template to display the selected target projection (such as Figure 6b ). On the displayed target projection image, the designer can trigger a drawing instruction to draw hair clusters on the target projection image, and the designer can draw the shape and texture of each hair cluster. It can be seen that this embodiment not only increases the flexibility of the three-dimensional hair model design, but also greatly reduces the workload of the designer.
[0099] Figure 7 FIG. 1 is a flow chart showing a method for generating a hair plane template according to an exemplary embodiment. Figure 7 As shown, the following steps are included:
[0100] In step S710, a basic shape model is obtained.
[0101] In step S720, the basic shape model is projected in each preset view direction to obtain a projection image of the basic shape model in the preset view direction.
[0102] In step S730, a hair plane template is generated according to the projection image of the basic shape model in the preset view direction.
[0103] Specifically, the features and shapes of common hairstyles are summarized and abstracted to obtain a basic shape model, and the obtained basic shape model is saved. When a hair cluster needs to be drawn, the basic shape model can be obtained from a local computer, or obtained from another computer device through a network and loaded to a local computer. In order to facilitate graphic designers to design three-dimensional models, the basic shape model is projected in each preset view direction to obtain a projection diagram of the basic shape model in the preset view direction; a hair plane template is generated according to the projection diagram of the basic shape model in each preset view direction.
[0104] The above-mentioned method for generating a hair plane template provides a new way for graphic designers to design three-dimensional hair models, so that graphic designers can complete the design of three-dimensional hair models by drawing a two-dimensional hair cluster image on the projection map of the basic shape model. This embodiment not only reduces the learning cost of designers, but also helps graphic designers to complete the three-dimensional design work. Furthermore, when actually designing a three-dimensional hair model, the designer can select a suitable basic shape model and a suitable viewing angle to generate a hair plane template according to the needs of a specific hairstyle. In the hair plane template, select a suitable position, a suitable shape, and a suitable texture to draw the corresponding hair cluster. When drawing hair clusters through the hair plane template, the entire process is directly controllable for the designer, which not only improves the designer's work efficiency, but also improves the design effect of the three-dimensional hair model.
[0105] Figure 8a The present invention is a flowchart of a method for generating a three-dimensional hair model according to an exemplary embodiment, comprising the following steps:
[0106] In step S810, a hair plane template is obtained.
[0107] The projection image is obtained by projecting the basic shape model in multiple preset view directions, wherein the basic shape model is a three-dimensional model that characterizes the shape of the basic hairstyle. Exemplarily, the hair plane template can be in PSD image format.
[0108] In step S820, a target projection image is selected from the hair plane template, and the drawn hair cluster is obtained through the target projection image.
[0109] Specifically, the terminal can display the target projection image selected from the hair plane template, and generate corresponding hair clusters on the target projection image in response to the drawing instruction on the target projection image. Figure 8b , 8cAs shown in 8d, the hair clusters are drawn through the target projection image.
[0110] In step S830, a preset number of points are obtained from the edge contour of the hair cluster as vertices of the hair cluster, and position information of each vertex is obtained.
[0111] The position information of the vertex is the position of the vertex in the target projection image.
[0112] In step S840, the texture coordinates of each vertex are obtained according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex.
[0113] The texture coordinates of the vertex are the texture coordinates of the vertex in the basic shape model corresponding to the target projection image.
[0114] In step S850, the three-dimensional coordinates of each vertex are obtained according to the texture coordinates of each vertex and the corresponding relationship between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model.
[0115] The three-dimensional coordinates of the vertex are the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image.
[0116] In step S860, the vertices are connected according to the three-dimensional coordinates of each vertex according to a preset rule to generate a triangular face.
[0117] In step S870, the triangular patch is rendered according to the texture coordinates of each vertex to generate a three-dimensional hair model.
[0118] For example, Figure 8e , 8f , 8g, are the results of observing the generated 3D hair model from different viewing directions.
[0119] In the above-mentioned method for generating a three-dimensional hair model, the hair plane template is exemplified by taking the PSD image format as an example. On the one hand, based on the graphic design template, the graphic designer is enabled to complete the design work of the three-dimensional hair model, taking into account the operating habits of the graphic designer; the drawing work of the designer in the present disclosure can be completed in PHOTOSHOP, the learning cost of the designer is very low, and the present disclosure can help the graphic designer complete the three-dimensional design work. On the other hand, when actually designing three-dimensional hair, the designer can select a suitable basic shape model and a suitable perspective to generate a PSD template according to the needs of the specific hairstyle. Select the target projection map in the PSD template, and use the appropriate shape and appropriate texture at the appropriate position to draw the corresponding hair cluster. It can be seen that the entire drawing process in the present disclosure is directly controllable for the designer, so the solution of the present disclosure is not only conducive to improving the work efficiency of the designer, but also can improve the design effect of the three-dimensional hair model.
[0120] It should be understood that, although the various steps in the above flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above flowchart may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0121] Fig. 9 is a device block diagram of a device for generating a three-dimensional hair model according to an exemplary embodiment. Fig. 9 The generating device 900 includes a plane template acquiring module 902 , a hair cluster acquiring module 904 , a hair cluster geometric information determining module 906 , and a hair model generating module 908 .
[0122] The plane template acquisition module 902 is configured to execute acquisition of a hair plane template, where the hair plane template includes a plurality of projection images, and the projection images are obtained by projecting a basic shape model in a plurality of preset view directions, wherein the basic shape model is a three-dimensional model representing the shape of a basic hairstyle;
[0123] The hair cluster acquisition module 904 is configured to select a target projection image from the hair plane template and acquire the drawn hair cluster through the target projection image;
[0124] The hair cluster geometric information determination module 906 is configured to determine the geometric information of the hair cluster according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image;
[0125] The hair model generation module 908 is configured to generate a three-dimensional hair model according to geometric information of the hair cluster.
[0126] In an exemplary embodiment, the hair cluster geometric information determination module 906 includes a vertex position information acquisition unit, a vertex geometric information acquisition unit and a hair model generation unit; wherein:
[0127] A vertex position information acquisition unit is configured to acquire a preset number of points as vertices of the hair cluster from the edge contour of the hair cluster, and acquire position information of each vertex, where the vertex position information is the position of the vertex in the target projection image;
[0128] A vertex geometric information acquisition unit is configured to determine the geometric information of each vertex according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex, wherein the geometric information of the vertex is the geometric information of the vertex in the basic shape model corresponding to the target projection image;
[0129] The hair model generating unit is configured to generate a three-dimensional hair model according to geometric information of each vertex.
[0130] In an exemplary embodiment, the geometric information of the base shape model includes texture coordinates and three-dimensional coordinates of the base shape model;
[0131] The vertex geometry information acquisition unit is further configured to execute, based on the geometry information of the basic shape model corresponding to the target projection image and the position information of each vertex, to obtain the texture coordinates of each vertex, the texture coordinates of the vertex being the texture coordinates of the vertex in the basic shape model corresponding to the target projection image; and to obtain the three-dimensional coordinates of each vertex based on the texture coordinates of each vertex and the correspondence between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model, the three-dimensional coordinates of the vertex being the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image.
[0132] In an exemplary embodiment, the hair model generation unit is further configured to connect each vertex according to a preset rule based on the three-dimensional coordinates of each vertex to generate a triangular patch; and render the triangular patch according to the texture coordinates of each vertex to generate a three-dimensional hair model.
[0133] In an exemplary embodiment, the device for generating a three-dimensional hair model also includes a module for generating a hair plane template; the module for generating a hair plane template is configured to execute the steps of acquiring a basic shape model; projecting the basic shape model in each preset view direction to obtain a projection image of the basic shape model in the preset view direction; and generating a hair plane template according to the projection image of the basic shape model in the preset view direction.
[0134] In an exemplary embodiment, the preset view directions include a front view direction, a rear view direction, a left view direction, and a right view direction.
[0135] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0136] Fig.10 1 is a block diagram of a device 1000 for generating a three-dimensional hair model according to an exemplary embodiment. For example, the device 1000 may be a server. Fig.10 The device 1000 includes a processing component 1020, which further includes one or more processors, and a memory resource represented by a memory 1022 for storing instructions executable by the processing component 1020, such as an application. The application stored in the memory 1022 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1020 is configured to execute the instructions to perform the above-mentioned method for generating a three-dimensional hair model.
[0137] The device 1000 may also include a power supply component 1024 configured to perform power management of the device 1000, a wired or wireless network interface 1026 configured to connect the device 1000 to a network, and an input / output (I / O) interface 1028. The device 1000 may operate based on an operating system stored in the memory 1022, such as Windows 10, 10erver, Mac OS X, Unix, Linux, FreeB10D, or the like.
[0138] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 1022 including instructions, and the instructions can be executed by a processor of the device 1000 to complete the above-mentioned method for generating a three-dimensional hair model. The storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0139] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0140] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for generating a three-dimensional hair model, characterized in that: include: Acquire a hair plane template, wherein the hair plane template includes a plurality of projection images, and the projection images are obtained by projecting a basic shape model in a plurality of preset view directions, wherein the basic shape model is a three-dimensional model representing the shape of a basic hairstyle; Selecting a target projection image from the hair plane template, and obtaining a drawn hair cluster through the target projection image; Determine geometric information of the hair cluster according to position information of the hair cluster in the target projection image and geometric information of the basic shape model corresponding to the target projection image, wherein the position information includes obtaining a preset number of vertices of the hair cluster from the edge contour of the hair cluster, the geometric information of the vertices is geometric information of the vertices in the basic shape model corresponding to the target projection image, and the geometric information of the basic shape model includes texture coordinates of the vertices in the basic shape model corresponding to the target projection image and three-dimensional coordinates of the vertices in the basic shape model corresponding to the target projection image; A three-dimensional hair model is generated according to the geometric information of the hair cluster.
2. The method for generating a three-dimensional hair model according to claim 1, characterized in that: The step of determining the geometric information of the hair cluster according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image comprises: From the edge contour of the hair cluster, a preset number of points are obtained as vertices of the hair cluster, and position information of each vertex is obtained, where the position information of each vertex is the position of the vertex in the target projection image; Determine the geometric information of each of the vertices according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each of the vertices, wherein the geometric information of the vertex is the geometric information of the vertex in the basic shape model corresponding to the target projection image; Generating a three-dimensional hair model according to the geometric information of the hair cluster comprises: The three-dimensional hair model is generated according to the geometric information of each vertex.
3. The method for generating a three-dimensional hair model according to claim 2, characterized in that: The geometric information of the basic shape model includes texture coordinates and three-dimensional coordinates of the basic shape model; and determining the geometric information of each vertex according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex includes: According to the geometric information of the basic shape model corresponding to the target projection image and the position information of each of the vertices, the texture coordinates of each of the vertices are obtained, where the texture coordinates of the vertex are the texture coordinates of the vertex in the basic shape model corresponding to the target projection image; According to the texture coordinates of each vertex and the correspondence between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model, the three-dimensional coordinates of each vertex are obtained, and the three-dimensional coordinates of the vertex are the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image.
4. The method for generating a three-dimensional hair model according to claim 3, characterized in that: Generating the three-dimensional hair model according to the geometric information of each vertex includes: According to the three-dimensional coordinates of each vertex, the vertices are connected according to a preset rule to generate a triangular face; The triangular facet is rendered according to the texture coordinates of each of the vertices to generate the three-dimensional hair model.
5. The method for generating a three-dimensional hair model according to any one of claims 1 to 4, characterized in that: The method for generating the hair plane template includes: Acquire the basic shape model; Projecting the basic shape model in each of the preset view directions to obtain a projection image of the basic shape model in the preset view direction; The hair plane template is generated according to the projection image of the basic shape model in the preset view direction.
6. The method for generating a three-dimensional hair model according to claim 1, characterized in that: The preset view directions include a front view direction, a rear view direction, a left view direction and a right view direction.
7. A device for generating a three-dimensional hair model, characterized in that: include: A plane template acquisition module is configured to acquire a hair plane template, wherein the hair plane template includes a plurality of projection images, and the projection images are obtained by projecting a basic shape model in a plurality of preset view directions, wherein the basic shape model is a three-dimensional model representing the shape of a basic hairstyle; A hair cluster acquisition module is configured to select a target projection image from the hair plane template and acquire the drawn hair cluster through the target projection image; a hair cluster geometric information determination module, configured to determine the geometric information of the hair cluster according to the position information of the hair cluster in the target projection image and the geometric information of the basic shape model corresponding to the target projection image, wherein the position information comprises obtaining a preset number of vertices of the hair cluster from the edge contour of the hair cluster, the geometric information of the vertex is the geometric information of the vertex in the basic shape model corresponding to the target projection image, and the geometric information of the basic shape model comprises the texture coordinates of the vertex in the basic shape model corresponding to the target projection image and the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image; The hair model generation module is configured to generate a three-dimensional hair model according to the geometric information of the hair cluster.
8. The device for generating a three-dimensional hair model according to claim 7, characterized in that: The hair cluster geometric information determination module includes a vertex position information acquisition unit, a vertex geometric information acquisition unit and a hair model generation unit; The vertex position information acquisition unit is configured to acquire a preset number of points from the edge contour of the hair cluster as vertices of the hair cluster, and acquire position information of each vertex, wherein the vertex position information is the position of the vertex in the target projection image; The vertex geometric information acquisition unit is configured to determine the geometric information of each vertex according to the geometric information of the basic shape model corresponding to the target projection image and the position information of each vertex, wherein the geometric information of the vertex is the geometric information of the vertex in the basic shape model corresponding to the target projection image; The hair model generating unit is configured to generate the three-dimensional hair model according to the geometric information of each vertex.
9. The device for generating a three-dimensional hair model according to claim 8, characterized in that: The geometric information of the basic shape model includes texture coordinates and three-dimensional coordinates of the basic shape model; The vertex geometry information acquisition unit is further configured to execute, based on the geometry information of the basic shape model corresponding to the target projection image and the position information of each of the vertices, to obtain the texture coordinates of each of the vertices, the texture coordinates of the vertex being the texture coordinates of the vertex in the basic shape model corresponding to the target projection image; and to obtain, based on the texture coordinates of each of the vertices and the correspondence between the three-dimensional coordinates of the basic shape model and the texture coordinates of the basic shape model, the three-dimensional coordinates of each of the vertices, the three-dimensional coordinates of the vertex being the three-dimensional coordinates of the vertex in the basic shape model corresponding to the target projection image.
10. The device for generating a three-dimensional hair model according to claim 9, characterized in that: The hair model generation unit is further configured to connect the vertices according to the three-dimensional coordinates of each vertex according to a preset rule to generate a triangular face patch; and render the triangular face patch according to the texture coordinates of each vertex to generate the three-dimensional hair model.
11. The device for generating a three-dimensional hair model according to any one of claims 7 to 10, characterized in that: The three-dimensional hair model generation device also includes a hair plane template generation module; The hair plane template generation module is configured to execute the acquisition of the basic shape model; project the basic shape model in each of the preset view directions to obtain a projection image of the basic shape model in the preset view direction; The hair plane template is generated according to the projection image of the basic shape model in the preset view direction.
12. The device for generating a three-dimensional hair model according to claim 7, characterized in that: The preset view directions include a front view direction, a rear view direction, a left view direction and a right view direction.
13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method for generating a three-dimensional hair model according to any one of claims 1 to 6.
14. A storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for generating a three-dimensional hair model as claimed in any one of claims 1 to 6.
15. A computer program product, comprising instructions, characterized in that: When the instruction is executed by a processor of an electronic device, the electronic device is enabled to execute the method for generating a three-dimensional hair model as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Three-dimensional gridding method of two-dimensional front view human face image
CN101739719A
Method and apparatus for obtaining 3D face model using portable camera
US20150279044A1