Virtual hair generation method and device, equipment and storage medium

By dividing the character hair generation surface into regions, the main hair and secondary hair are automatically generated and parameterized, which solves the problems of long cycle time and poor simulation effect of the virtual hair generation method, and achieves efficient and realistic hair dynamic simulation effects.

CN118628619APending Publication Date: 2024-09-10GUANGDONG STAR CREATIVE ANIMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410837264.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The existing virtual hair generation method has a long cycle, cannot save processes, has poor simulation effect, and cannot achieve real hair dynamic effects.

Method used

By dividing the character hair generation surface into regions, the main hair and secondary hair are automatically generated, and attribute parameters and motion parameters are added to them to achieve modeling, simulation constraints and rendering. The secondary hair inherits the main hair parameters through weighting to achieve dynamic simulation effects.

Benefits of technology

It greatly shortens the hair generation cycle, improves efficiency, achieves the authenticity of dynamic simulation effects, avoids wisps of strange movements, and improves user experience and picture beauty.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628619A
    Figure CN118628619A
Patent Text Reader

Abstract

The invention provides a virtual hair generation method and device, equipment and a storage medium. The method comprises the following steps: dividing a role hair generation surface to obtain a plurality of hair transplanting areas; then a main hair is automatically generated in each hair transplanting area; segmenting based on the length of the main engine to generate a plurality of nodes, and automatically adding preset attribute parameters and motion parameters for each node; the modeling, the simulation constraint and the rendering of the main hair are determined by adjusting the attribute parameters and the motion parameters; generating secondary hair in the hair transplanting area based on the primary hair, weighting the secondary hair to inherit the parameters of the primary hair, and obtaining the modeling, following constraint and rendering of the secondary hair. According to the method disclosed by the invention, the work of three stages of modeling, constraint simulation and rendering is fused and completed in a main hair design stage, so that high load cannot be caused to the operation of a terminal, the processing period of virtual hair can be shortened, and the manufacturing efficiency is effectively improved; and the auxiliary hair can inherit the main hair, so that the authenticity of the dynamic simulation effect of the virtual hair is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of three-dimensional virtual animation technology, and specifically to a virtual hair generation method, device, equipment and storage medium. Background Art

[0002] Hair is an important part of virtual characters. The realism and real-time simulation of the dynamic effect of hair will directly affect the quality of animation, comics or games. In order to achieve better real hair simulation effects, producers need to spend a lot of effort to process virtual hair. The processing process is generally divided into three stages: modeling-simulation constraints-rendering, that is, first modeling the hair in the character's hair generation area, and manually drawing the hair; then setting simulation constraints for the hair, including global shape constraints and local shape constraints; finally, rendering the hair in batches. However, due to efficiency and technical limitations, the existing hair processing method is not only too lengthy and inefficient, but also has a big difference between the virtual hair produced and the real hair, especially the simulation effect of long hair or curly hair, which greatly reduces the user experience and the aesthetics of the picture.

[0003] In order to shorten the production cycle of virtual hair, the invention patent application with publication number CN116503544A adopts a method that, by acquiring preset hair guide parameters, a hair generation node with preset hair generation parameters is called, and initial virtual hair is generated according to the hair guide parameters and the hair generation parameters; a hair styling node with preset hair styling parameters is called, and the styling of the initial virtual hair is adjusted according to the hair styling parameters to obtain the preset virtual hair, so that the preset virtual hair can be automatically generated according to the hair guide parameters, the preset hair generation parameters and the preset hair styling parameters; then, the hair generation parameters or the hair styling parameters can be adjusted according to the parameter adjustment instruction, and the preset virtual hair is updated according to the adjusted hair generation parameters or the hair styling parameters to obtain the target virtual hair. Since the preset virtual hair can be automatically generated, it is only necessary to adjust the hair generation parameters or the hair styling parameters according to actual needs to obtain the target virtual hair, without having to make virtual hair from scratch, thereby shortening the production cycle of virtual hair and improving the production efficiency of virtual hair. However, this processing method has the following problems: ① The virtual hair obtained will appear in wisps, which is quite different from the real hair effect; ② The simulation constraints cannot be achieved, and the simulation constraints require another engineering step to process, so this method only saves the project of manually drawing virtual hair.

[0004] Another example is the invention patent with publication number CN107221024B, which discloses a virtual object hair processing method as follows: establish a hair model of a virtual object, the hair model includes a plurality of main and auxiliary hair structures; and configure preset parameters for the main hair in the main and auxiliary hair structures, and the relative positions of the main hair and the auxiliary hair; wherein each of the main and auxiliary hair structures includes a main hair and a plurality of auxiliary hairs associated with the main hair; each of the main and auxiliary hair structures includes long hair and / or curly hair; simulate the position of the main hair according to the preset parameters, and determine the relative positions of each of the main and auxiliary hair according to the hair model. The relative position of the auxiliary hair and the main hair in the hair structure; wherein the preset parameters are configured by the length of each main hair and / or the shape of each main hair; the position of the auxiliary hair is determined according to the position of the main hair in each main and auxiliary hair structure and the relative position of the auxiliary hair and the main hair in each main and auxiliary hair structure, so as to ensure that the local position of the main and auxiliary hair remains unchanged, so that the shape of the main and auxiliary hair remains consistent; when the position of the main hair and the auxiliary hair is determined, the hair of the virtual object is divided into multiple regions and the hair of each region is rendered respectively using multiple colors. This method realizes the bundle simulation and motion constraint of the virtual object hair, greatly improves the authenticity of the virtual object hair in terms of simulation constraint, avoids the situation that the hair is elongated due to excessive movement, and has a better simulation effect on long hair or curly hair. However, this processing method has the following problems: ① The initial project still needs to establish a hair model, that is, the overall hair needs to be modeled and drawn before the processing method can be carried out; ② The hair rendering processing of this invention patent is also an independent process, so the engineering cycle is still long.

[0005] Another example is the invention patent with the publication number CN116152405B, which discloses a method for processing virtual object hair as follows: obtaining a hair root point cloud of a character, including the hair root points corresponding to multiple virtual hairs of the character; obtaining sampling control information of the sampling point distance during the sampling process of the hair root point cloud; generating a voxel grid set according to the sampling control information and the position range information of the hair root point cloud; sampling the hair root points belonging to the voxel grid in each voxel grid to obtain the sampling points of the voxel grid; determining the virtual hair corresponding to the sampling point as simulated virtual hair, and determining the virtual hair corresponding to other points in the hair root point cloud except the sampling point as interpolated virtual hair; wherein the simulated virtual hair adopts a physical simulation strategy to simulate dynamic effects during the execution of the business, and the simulated virtual hair is used to control the interpolated virtual hair to follow the movement of the simulated virtual hair during the execution of the business. This method also improves the motion simulation of the virtual object hair, while reducing the hardware operation overhead and improving efficiency. However, this processing method also has the following problems: ① It can only be processed after the entire hair is drawn, that is, the modeling step still needs to be completed before this method can be used; ② Another engineering step is still required for rendering processing, so the engineering cycle is still long and the efficiency is low.

[0006] Finally, as for the invention patent application with publication number CN116109721A, the virtual object hair processing method disclosed therein is as follows: determine the target hair based on the guide hair, wherein the guide hair is located on the scalp model; determine the interpolation position according to the hair root position of the target hair; generate the interpolation hair based on the guide hair particles on the target hair and the interpolation position. The method is to pre-construct part of the hair (guide hair) on the scalp model first, without drawing the whole hair, and then generate the rest of the hair (interpolation hair) based on these constructed part of the hair (target hair), and the interpolation hair is jointly determined by multiple target hairs, so that the generated hair will not show the problem of strands, and improve the overall effect of virtual hair. However, this method still has the following problems: ① The guide hair needs to be drawn manually and cannot be automatically generated; ② The hair processed by this method is only the part that has completed the modeling, which improves the speed of modeling, but it is necessary to process the constraint simulation and rendering in the later stage, so the processing cycle is relatively long. Summary of the invention

[0007] The purpose of the present invention is to provide a virtual hair generation method, device, equipment and storage medium to address the above-mentioned problems and shortcomings, so as to solve the technical problems of the existing virtual hair generation method having a long cycle, being unable to save process steps and having poor simulation effect.

[0008] The technical solution of the present invention is achieved in this way:

[0009] According to one aspect of the present invention, a method for generating virtual hair is provided, which is characterized in that it includes: creating a plurality of hair transplantation areas by dividing the area based on the hair generation surface of the character; automatically generating a main hair in each of the hair transplantation areas based on the created hair transplantation areas; generating a plurality of nodes by segmenting the length of the main hair, and automatically adding preset attribute parameters and motion parameters to each node; determining the shape, simulation constraints and rendering of the main hair based on the attribute parameters and motion parameters; generating secondary hair in the hair transplantation area where the main hair is located based on the main hair, and weightedly inheriting the attribute parameters and motion parameters of the main hair to obtain the shape, following constraints and rendering of the secondary hair.

[0010] In some embodiments, the creation of area division based on the character's hair growth surface includes the following steps: dividing the hair transplant area based on the differences in preset hair directions of the character.

[0011] In some embodiments, the automatic generation of a main hair in each hair transplantation area includes the following steps: generating a root point of the main hair on the surface of the hair transplantation area; determining a guide curve of the hair transplantation area based on the position of the root point and the center line position of the character's hair growth surface; generating corresponding deviation points after performing deviation constraint processing on several points of the guide curve, and sequentially connecting the root point with all the deviation points to form the main hair.

[0012] Furthermore, generating the root point of the main hair on the surface of the hair transplantation area includes the following steps: obtaining the intersection point of the center line of the character's hair growth surface and the character's hair growth surface, and taking the point as the origin of the local coordinate system; obtaining the local coordinate relationship of each vertex of the hair transplantation area based on the local coordinate system; obtaining the two vertices closest to the origin in relative position, and then obtaining the midpoint of the line connecting the two vertices; connecting the midpoint with the origin and extending it in the direction of the character's hair growth surface to obtain the point where the midpoint intersects with the character's hair growth surface as the root point of the main hair.

[0013] In some embodiments, the step of generating corresponding deviation points after performing deviation constraint processing on a plurality of points based on the guide curve, and sequentially connecting the hair root point with all the deviation points to form the main hair, comprises the following steps: calculating the constraint value using a deviation constraint formula, wherein the deviation constraint formula is:

[0014]

[0015] Among them, k is the constraint value, k(d n ) has a value range of [0,1], and a larger value indicates a stronger restraint, that is, the main hair is closer to the hair transplantation area; d nis the relative position distance between the nth point of the guide curve and the rooting point in the deviation direction; w is the constraint weight value, and α is used to control k with d n For positive values ​​of the speed of change, the relationship between w and α is: D is the distance between the guide curve and the root point in the deviation direction where the relative distance is the largest, that is, d n The maximum value of d thresh is a threshold close to but less than D; Δd n is the difference between the relative position distances of two adjacent points, i.e. Δd n =d n -d n-1 ; After the constraint value k is obtained by the above formula, the position information of the point on the guide curve after the nth point deviates by a distance of L in the deviation direction is obtained according to the deviation distance formula L=(1-k)*p, where p is the deviation weight value. Finally, all the obtained points are connected in sequence and the curve after curve smoothing is the main launch.

[0016] In some embodiments, the method of generating side hair based on the main hair in the hair transplantation area where the main hair is located, and weightedly inheriting the attribute parameters and motion parameters of the main hair to the side hair, includes the following steps: performing a first copy deviation on all nodes on the main hair to obtain corresponding inheritance points; based on the position information of the inheritance points and the corresponding nodes, using a weighted inheritance function to calculate and adjust the attribute parameters and motion parameters of the inheritance points; connecting all the adjusted inheritance points and performing curve smoothing to obtain the first side hair; after m times of copy deviation and calculation adjustment, the position and distance of each copy deviation are different, and finally m side hairs are generated in the hair transplantation area.

[0017] In some embodiments, the virtual hair generation method also includes: dividing the generation of the main hair into at least two generations, that is, dividing the character's hair generation surface into regions to create a first hair transplantation region, automatically generating a first main hair in each of the first hair transplantation regions, and the first main hair is located in the middle of the first hair transplantation region; then dividing the first hair transplantation region into three second hair transplantation regions, and generating a second main hair again in the second hair transplantation region that does not contain the first main hair; wherein the second main hair is automatically generated based on the node attribute parameters and motion parameters of two adjacent and closer first main hairs combined with the matching degree.

[0018] According to one aspect of the present application, a virtual hair generation device is also provided, including: a division module, used to divide and create areas based on the character's hair generation surface to obtain multiple hair transplantation areas; a main hair generation module, used to automatically generate a main hair in each hair transplantation area based on the created hair transplantation area; a node generation module, used to generate multiple nodes based on the length of the main hair in segments, and automatically add preset attribute parameters and motion parameters to each node; a parameter adjustment module, used to determine the shape, simulation constraints and rendering of the main hair based on the attribute parameters and motion parameters; a secondary hair generation module, based on the main hair, generates secondary hair in the hair transplantation area where the main hair is located, and weightedly inherits the attribute parameters and motion parameters of the main hair to obtain the shape, following constraints and rendering of the secondary hair.

[0019] According to one aspect of the present application, a virtual hair generation computer device is also provided, comprising: a memory and a processor; executable computer instructions are stored in the memory; when the processor executes the computer instructions in the memory, the above-mentioned virtual hair generation method is implemented.

[0020] According to one aspect of the present application, a virtual hair generation storage medium is also provided, wherein the storage medium is used to store computer instructions, and the computer instructions are loaded by a processor to execute the above-mentioned virtual hair generation method.

[0021] The present invention at least includes the following beneficial effects:

[0022] 1. After dividing the character's hair growth surface into regions, the system automatically generates a main hair in each hair transplantation area based on the divided hair transplantation areas. Therefore, there is no need to manually perform preliminary drawing of the hair, which not only reduces the technical requirements for hair modelers, but also greatly improves the speed of hair modeling.

[0023] 2. After the main hair is generated, it will automatically generate multiple nodes in segments and automatically add preset parameters for the nodes. The parameters include the modeling attribute settings of the main hair (i.e. the content of the modeling process), motion parameter settings (i.e. the content of the simulation constraint process), and color attribute settings (i.e. the content of the rendering process). Therefore, when the parameters of the main hair are set, the three processes of the single main hair are completed, and the secondary hair generated by the main hair also inherits these parameters. Therefore, after the overall hair is generated, the entire hair processing process can be completed, which greatly shortens the processing cycle and improves the production efficiency.

[0024] 3. Since the secondary hair inherits the parameters of the main hair in a weighted manner, the parameters of the secondary hair and the main hair, and between the secondary hair and the secondary hair are different, and the strange effect of synchronous movement of strands will not be presented; and there is a mutual constraint relationship between the secondary hair generated by the same main hair, so there are both constraint simulation effects of bundling (such as braids and curls) and dynamic simulation effects of motion following, which effectively improves the authenticity of the dynamic simulation effect of virtual hair.

[0025] The present invention will be further described below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a schematic diagram of a first embodiment of the method for generating virtual hair according to the present invention;

[0027] Figure 2 A schematic diagram of an optional regional division layout of the character hair generation surface of the present invention;

[0028] Figure 3 An optional schematic layout diagram of generating main hair in a certain hair transplantation area for the present invention;

[0029] Figure 4 A schematic diagram of a structure in which multiple nodes are generated on a main generator according to the present invention;

[0030] Figure 5 A schematic diagram of an optional structure for generating secondary hair in a certain hair transplantation area according to the present invention;

[0031] Figure 6 is a schematic diagram of a second embodiment of the virtual hair generation method of the present invention;

[0032] Figure 7 A schematic diagram of an optional layout for generating a guide curve in a certain hair transplantation area according to the present invention;

[0033] Figure 8 is a schematic diagram of a third embodiment of the virtual hair generation method of the present invention;

[0034] Fig. 9 An optional layout schematic diagram of generating main hair root points in a certain hair transplantation area according to the present invention;

[0035] Fig.10 is a schematic diagram of a fourth embodiment of the method for generating virtual hair according to the present invention;

[0036] Fig.11 Another optional structural schematic diagram of the present invention for generating secondary hair in a certain hair transplantation area;

[0037] Fig.12 is a schematic diagram of a fifth embodiment of the method for generating virtual hair according to the present invention;

[0038] Fig.13 A schematic diagram of an optional process structure for generating a first main hair and a second main hair in a certain hair transplantation area according to the present invention;

[0039] Fig.14 It is a schematic diagram of a first embodiment of a virtual lip shape generating device of the present invention;

[0040] Fig.15 It is a schematic diagram of the structure of the server of the present invention. DETAILED DESCRIPTION

[0041] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0042] The terms "first", "second", "third", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, rather than 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 described herein can be implemented in an order other than that illustrated or described in the drawings. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0043] In the description of the present invention, unless otherwise specified, "plurality" means two or more.

[0044] The virtual hair generation method, device, equipment and storage medium of the present invention are described below in conjunction with the accompanying drawings. The description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0045] like Figure 1 As shown, Figure 1 : is a flow chart of a virtual hair generation method provided in Embodiment 1 of the present invention. The virtual hair generation method may include:

[0046] S101, creating and dividing regions based on the character's hair growth surface to obtain multiple hair transplantation regions.

[0047] The character is mainly a virtual character in cartoons, animations or games that needs to be processed with virtual hair. The character can be a 3D character, a 2.5D character or a 2D character, etc. The character is not limited to a human character, but can also include animals, plants, alien objects, etc. This embodiment does not limit this.

[0048] The character hair generation surface of the present application is a preset surface, which can be planned and set by the technicians who create the character when creating the character, or can be planned and set in the fur creation stage after the character is created. The hair generation surface can be the whole body, head, face, chest or limbs of the character. This embodiment does not limit this.

[0049] The area division method in this embodiment can be to use professional software to create curves on the hair growth surface for division, that is, by drawing multiple curves to separate the hair growth surface into multiple areas, and then cutting the enclosed curves in a certain area to make the area form a hair transplant area. For example, multiple curves can be established using professional software such as Maya, and these curves are bound to the hair growth surface. The use of professional software such as Maya to establish curves and bind are common operations in 3D modeling, which will not be described here. In addition to using curves to divide the area, it is also possible to directly select and divide the small curved surfaces on the hair growth surface. Because most virtual characters are composed of small curved surfaces (three-sided or four-sided surfaces), a hair transplant area can be formed by selecting multiple adjacent small curved surfaces. Of course, other methods can also be used to divide the hair transplant area. This embodiment does not limit this.

[0050] It can be understood that adjacent hair transplantation areas may partially overlap or may not overlap at all, and this embodiment does not limit this.

[0051] When dividing the hair transplant area in this embodiment, the hair growth direction and the characteristics of different hair areas can be considered, which can effectively improve the accuracy of the automatically generated main hair and reduce the time for adjusting the main hair in the later stage. The area division creation based on the character's hair growth surface is preferred, and the following steps can be included: dividing the hair transplant area based on the difference in the preset hair direction of the character. For example, Figure 2 In the example shown, the hair growth surface in this example is the head of the character. When dividing the hair growth surface of the head, based on the different directions of the hair, it can be basically divided into the forehead, left side, right side, back of the head, and temples. If the character has a braid at the back of his hair, the back of the head area can be further divided into a braid hair transplant area and a non-braid hair transplant area. Of course, this embodiment can also adopt other division methods.

[0052] S102: Based on the created hair transplantation areas, a main hair is automatically generated in each hair transplantation area.

[0053] The specific position of the main hair generated by the terminal in the hair transplantation area in this embodiment is not limited. It can be located in the middle of the hair transplantation area, such as Figure 3 The example shown in the figure may also be located at the edge of the hair transplant area. The terminal may automatically generate the main hair according to the setting of the program.

[0054] It is understandable that the main message is automatically generated by the terminal and the position can be arbitrary, but the position of the main message has an impact on the subsequent generation of the secondary message. Therefore, in some embodiments, after the terminal generates the main message, the producer can freely adjust the position of the main message to meet the needs of the subsequent generation of the secondary message.

[0055] S103, segmenting and generating a plurality of nodes based on the length of the main shot, and automatically adding preset attribute parameters and motion parameters to each node.

[0056] Since the sizes of the divided hair transplant areas are different, the lengths of the main hairs generated in the hair transplant areas will also be different. The terminal segments the hair according to the distance range between the two nodes set and the length of the main hairs. For example, if the distance between the two nodes set by the terminal is 2cm, then if the length of one of the main hairs is 8cm, then the main hair will generate 4 nodes; if the length of the other main hair is 21cm, then the main hair will generate 11 nodes.

[0057] In some embodiments, when a node is activated, a parameter list box is generated next to the node, such as Figure 4 The example shown in the figure. The parameter list box contains the initial data of attribute parameters and motion parameters. By adjusting the data in the list box, the attribute parameters and motion parameters of the main engine can be changed.

[0058] The attribute parameters in this embodiment at least include the position attribute, size attribute, bend attribute, style attribute and color attribute of the node. The position attribute is used to adjust the position of the node, so that the distance between the node and the adjacent node is no longer a set distance, but can be adjusted as needed, and the distance between the node and the hair generation surface is realized; when the position attribute of the node at the end of the main hair is adjusted, the length of the main hair can be changed. The size attribute is used to adjust the thickness of the hair at the node position. The bend attribute is used to adjust the curliness of the hair at the node position. When the bend attribute value is 0, the hair is straight hair. When the bend attribute value is larger, the curliness of the hair is larger. The style attribute is used to select the style of the hair where the node is located, such as long hair, short hair, straight hair, curly hair, plush, etc. According to the selected style, the terminal will automatically change the overall style of the hair where the node is located and automatically adjust the position attribute, size attribute and bend attribute of the node and other nodes. The attribute values, so the style attribute belongs to the attribute parameter that is adjusted first. The color attribute is used to adjust the color value of the node where the hair is located. By setting the color value of each node of the main hair, the rendering setting of the main hair can be completed. This embodiment can also include other attribute parameters, such as noise attribute, light and dark attribute, etc. This embodiment does not limit this.

[0059] The motion parameters in this embodiment include at least constraint attributes, motion attributes, follow attributes and contact attributes. The constraint attributes include global shape constraints and local shape constraints. The global shape constraint can be defined as: the degree to which the moving hair maintains the original bending degree when only rigid body motion is performed; the local shape constraint can be defined as: the degree to which a single hair maintains the original bending degree. The motion attribute is used to set the motion-related settings such as the motion shape of the hair and the motion intensity. The motion shape of the hair is, for example, long hair flying backwards against the wind, and the hair rising upwards when falling at high speed; and the motion intensity is the amplitude that affects the motion of the hair, such as the angle and range of flying backwards, the height and number of rising upwards, etc. The follow attribute is mainly used to follow the secondary hair generated by the main hair or the degree of following the motion, including sub-attribute parameters such as the following threshold and the following attenuation. The contact attribute refers to the interactive relationship between the hair and the preset skeletal part. Specifically, the preset skeletal part is bound with a collision body, and the interaction is realized when the hair contacts the collision body. This embodiment does not specifically limit the preset skeletal part, which can be other parts of the character itself or objects outside the character.

[0060] S104: Determine the shape, simulation constraints and rendering of the main hair based on the attribute parameters and the motion parameters.

[0061] According to the general style of the hair in the hair transplantation area where the main hair is located, the attribute parameters of each node are adjusted to finally obtain the modeling and rendering of the main hair; then the motion parameters of each node are adjusted to finally obtain the simulation constraints of the main hair. At this point, the adjustment of the main hair can be completed, which is equivalent to completing the adjustment settings of all hair. The present invention only adjusts and sets the parameters of the main hair, and there is no need to set the overall hair, so it can greatly reduce the operating load of the terminal and improve the operating efficiency of the terminal. Moreover, in the main hair parameter adjustment stage, the processing engineering of the three stages of modeling - simulation constraints - rendering is completed. Therefore, compared with the existing method of first drawing the overall hair, then simulating the constraints on the overall hair, and finally rendering in batches, the processing cycle is much shorter, which greatly improves the hair processing efficiency.

[0062] S105, generating secondary hair in the hair transplantation area where the primary hair is located, weightedly inheriting the attribute parameters and motion parameters of the primary hair for the secondary hair, and obtaining the modeling, following constraints and rendering of the secondary hair.

[0063] In this embodiment, the processing method for generating secondary hairs based on the main hair in the hair transplantation area where it is located can be that the terminal provides a random vector before the main hair generates secondary hairs each time, and the main hair is copied and moved with the random vector, and the copied main hair is moved to the position where the random vector is located to obtain the first secondary hair; then the terminal generates another random vector again, and then copies and moves the main hair to obtain the second secondary hair; and so on to obtain all the secondary hairs in the hair transplantation area. The value of the random vector is different each time, and the random vector can be controlled by a program segment or a formula to realize the change of the random vector and the control of the change range and the number of random vectors. For example, a program segment can be set up in Python language, which contains two variables of the random vector, namely, the size value variable and the direction value variable. An increment counter is assigned to each of the two variables, and the two increment counters increment a random number each time; then the randomly generated direction value variable value is converted into a unit vector, and then the x and y components of the random vector are calculated to obtain the random vector value; then it is determined whether the random vector value is in the hair transplantation area. If it is, the main hair is copied and moved to the location of the random vector value. If not, the copy and move is not performed, but the next random vector value is generated again. In this embodiment, the processing method for generating secondary hair based on the main hair in the hair transplantation area where the main hair is located can also be to copy and deviate a random vector for all nodes on the main hair to obtain corresponding inheritance points, and then connect all inheritance points to obtain secondary hair. The above two implementation methods of this embodiment are to first copy and move the main hair to obtain the secondary hair, and then weightedly inherit the attribute parameters and motion parameters of the main hair for the secondary hair.

[0064] Of course, if this embodiment adopts the method of obtaining the inheritance point by copying and deviating the node of the main issue, then when the inheritance point is obtained, the corresponding inheritance point can be weighted to inherit the attribute parameters and motion parameters of the corresponding node, and finally the inheritance points that have completed the weighted inheritance are connected to form the secondary issue, such as Figure 5 The specific steps are as follows: perform the first replication deviation on all nodes on the main hair to obtain the corresponding inheritance point; based on the position information of the inheritance point and the corresponding node, use the weighted inheritance function to calculate and adjust the attribute parameters and motion parameters of the inheritance point; connect all the adjusted inheritance points and perform curve smoothing to obtain the first secondary hair; after m replication deviations and calculation adjustments, the position and distance of each replication deviation are different, and finally generate m secondary hairs in the hair transplantation area.

[0065] The method of this embodiment can complete the three stages of modeling, simulation constraints, and rendering when designing a single main hair, thereby greatly improving the hair modeling speed, shortening the processing cycle of virtual hair, and effectively improving the production efficiency; the virtual hair generation method is suitable for various virtual hairstyle designs such as short hair, long straight hair, and curly hair, and has strong applicability; and the hair generated by this method has a more realistic simulation effect in terms of motion following and dynamic constraints, and is closer to the effect of real hair, which greatly improves the user experience and the beauty of the picture.

[0066] like Figure 6 As shown, Figure 6 2 is a flow chart of a virtual hair generation method provided by the second embodiment of the present invention. The virtual hair generation method may include:

[0067] S201, based on the character's hair growth surface, based on the difference in the preset hair direction of the character, regional division is performed to obtain multiple hair transplantation areas.

[0068] This embodiment divides the character's hair growth surface into regions based on the differences in the preset hair directions of the character. For example, the hair growth surface is divided into the forehead, left side, right side, back of the head, and temples based on the different directions of the hair. Figure 2 If the character has a braid at the back of his hair, the back of the head can be further divided into a braided hair transplant area and a non-braided hair transplant area.

[0069] S202: generating a main hair root point on the surface of the hair transplantation area.

[0070] The hair root point of this embodiment can be automatically generated, that is, a point is randomly determined on the surface of the hair transplant area, and the point is used as the hair root point of the main hair. The maker can move the hair root point to a desired position later. The hair root point of this embodiment can also be manually generated, that is, after the hair transplant area is divided, the maker can generate the hair root point by drawing a point on the hair transplant area.

[0071] S203, determining a guide curve of the hair transplantation area based on the position of the hair root point and the center line position of the character's hair growth surface.

[0072] The center line position of this embodiment can be set by the character maker when setting the character's hair generation surface; of course, it can also be set by the hair maker later. The center line can be set in the following way: Since the character's hair generation surface is generally bilaterally symmetrical, the left-right symmetry line of the character's hair generation surface can be easily determined. The left-right symmetry line is a curve, and then the midpoint of the curve is found on the curve, and the center line is formed by extending the midpoint of the curve vertically upward or downward or both upward and downward from the horizontal plane.

[0073] After the center line is determined in this embodiment, a plane can be determined through the center line and the hair root point obtained in the previous step. The plane passes through the center line and the hair root point. At this time, the plane intersects with the hair transplant area, and the curve formed by the intersection is the guide curve of the hair transplant area. Figure 7 Example shown.

[0074] S204, generating corresponding deviation points after deviation constraint processing based on a number of points of the guide curve, and sequentially connecting the hair root point with all the deviation points to form the main hair.

[0075] This embodiment divides the guide curve into segments to form several points on the guide curve, and then performs deviation constraint processing on these points to generate corresponding deviation points, wherein the deviation constraint value can be calculated and obtained by a nonlinear function, or by an exponential function, or by a Gaussian function. After obtaining the deviation constraint value, the position information of the point after the nth point on the guide curve deviates by a distance of L in the deviation direction can be obtained according to the deviation distance formula L = (1-k) * p, where p is the deviation weight value and k is the deviation constraint value. Finally, all the obtained points are connected in sequence and the curve is smoothed to obtain the main emission. Similarly, the deviation distance formula can also use a nonlinear function.

[0076] S205, generating multiple nodes by segmentation based on the length of the main shot, and automatically adding preset attribute parameters and motion parameters to each node;

[0077] S206, determining the shape, simulation constraints and rendering of the main hair based on the attribute parameters and the motion parameters;

[0078] S207, generating secondary hair in the hair transplantation area where the primary hair is located based on the primary hair, weighting the secondary hair to inherit the attribute parameters and motion parameters of the primary hair, and obtaining the modeling, following constraints and rendering of the secondary hair.

[0079] This embodiment, based on the first embodiment, describes in detail the process of generating main hair in the hair transplantation area. The main hair automatically generated by the method of this embodiment is closer to the needs of the hair maker, so it can reduce the modification and adjustment of the subsequent nodes of the main hair by the hair maker, thereby further reducing the processing cycle time; this virtual hair generation method is suitable for various virtual hairstyle designs such as short hair, long straight hair, curly hair, etc., and has strong applicability; and the hair generated by this method has a more realistic simulation effect in terms of motion following and dynamic constraints, which is closer to the effect of real hair, greatly improving the user experience and the beauty of the picture.

[0080] like Figure 8 As shown, Figure 8 : is a flow chart of a virtual hair generation method provided by the third embodiment of the present invention. The virtual hair generation method may include:

[0081] S301, based on the character's hair growth surface, based on the difference in the preset hair direction of the character, regional division is performed to obtain multiple hair transplantation areas.

[0082] Each hair transplantation area divided in this embodiment is composed of four curves, that is, the hair transplantation area is a four-sided curved surface.

[0083] S302, obtaining the intersection point between the center line of the character's hair generation surface and the character's hair generation surface, and taking the point as the origin of the local coordinate system.

[0084] The center line position of this embodiment is set in the following way: since the character's hair generation surface is generally bilaterally symmetrical, the bilateral symmetry line of the character's hair generation surface can be easily determined, and the bilateral symmetry line is a curve, and then the midpoint of the curve is found on the curve, and the midpoint of the curve is perpendicular to the horizontal plane and extends upward or downward or both upward and downward to form the center line. At the same time, the midpoint of the curve is also the intersection point of the center line and the character's hair generation surface. This point is used as the origin of the local coordinate system to establish a local coordinate system. The front-to-back direction of the character can be used as the X-axis direction of the local coordinate system, and the left-to-right direction of the character can be used as the Y-axis direction of the local coordinate system, and the direction of the center line can be used as the Z-axis direction of the local coordinate system.

[0085] S303: Acquire the local coordinate relationship of each vertex in the hair transplantation area based on the local coordinate system.

[0086] After the local coordinate system and the origin are determined, the local coordinate values ​​of the four vertices of the hair transplant area can be obtained. Fig. 9 In the example shown, the coordinates of the four vertices of the hair transplantation area in this example are obtained by the local coordinate system as D 1 (X 1 , Y 1 , Z 1 )、D 2 (X 2 , Y 2 , Z 2 )、D 3 (X 3 , Y 3 , Z 3 )、D 4 (X 4 , Y 4 , Z 4 ).

[0087] S304, obtaining two vertices that are closest to the origin in relative position, and then obtaining the midpoint of the line connecting the two vertices.

[0088] exist Fig. 9 In the example, vertex D 1 (X 1 , Y 1 , Z 1 ) and D 2 (X 2 , Y 2 , Z 2 ) is closest to the origin, so connect these two vertices and get the midpoint D of the line m .

[0089] S305, connecting the midpoint of the connecting line with the origin and extending the line toward the direction of the character's hair growth surface, and the point where the line intersects with the character's hair growth surface is used as the root point of the main hair.

[0090] exist Fig. 9 In the example, the origin and the midpoint D of the line m After being connected, the ray extends toward the direction of the hair transplantation area so that the ray and the hair transplantation area have an intersection point D f , the intersection point D f That is the root point of the main hair.

[0091] S306, determining a guide curve for the hair transplantation area based on the position of the hair root point and the center line position of the character's hair growth surface;

[0092] S307. Calculate the constraint value using the deviation constraint formula.

[0093] The constraint value of this embodiment is the constraint expression between a number of points on the guide curve and the deviation points after the deviation based on the guide curve. In this embodiment, the constraint value can be obtained by the following deviation constraint formula, which is:

[0094]

[0095] Among them, k is the constraint value, k(d n ) is in the range of [0,1]. The larger the value, the stronger the restraint, that is, the closer the main hair is to the transplant area; d n is the relative position distance between the nth point of the guiding curve (n is a natural number greater than 0) and the rooting point in the deviation direction; w is the constraint weight value, and α is used to control the k to follow d n For positive values ​​of the speed of change, the relationship between w and α is: D is the distance between the guide curve and the root point in the deviation direction where the relative distance is the largest, that is, d n The maximum value of d thresh is a threshold close to but less than D; Δd n is the difference between the relative position distances of two adjacent points, i.e. Δd n =d n -d n-1 .

[0096] Since the root point overlaps with the endpoint T(0) of the guide curve, the first point on the guide curve starting from the endpoint T(0) is T(1), then d n It is the distance between point T(1) and point T(0) in the deviation direction. The deviation direction of this embodiment can be the Y-axis direction set in step S302, or the extension direction of the plane passing through the hair root point and the center line position of the character's hair generation surface, or other set directions. This embodiment does not impose specific restrictions on the deviation direction. The D value in the formula is a preset value, which can be adjusted by the maker. n When the D value is equal, the distance of the deviation point in the deviation direction remains unchanged. At this time, the main hair segment generated by these deviation points is vertically downward, that is, this main hair segment simulates the hair away from the hair growth surface and close to the hair tip.

[0097] S308. Obtain the position information of the deviation point according to the deviation distance formula.

[0098] In this embodiment, after the constraint value k is obtained by the above formula, the position information of the point on the guide curve after the nth point deviates by a distance of L in the deviation direction is obtained according to the deviation distance formula L=(1-k)*p, where p is the deviation weight value. Finally, all the obtained points are connected in sequence and the curve after curve smoothing is obtained, which is the main launch.

[0099] S309, sequentially connecting the hair root point and all the deviation points to form the main hair;

[0100] S310, generating multiple nodes by segmentation based on the length of the main shot, and automatically adding preset attribute parameters and motion parameters to each node;

[0101] S311, determining the shape, simulation constraints and rendering of the main hair based on the attribute parameters and the motion parameters;

[0102] S312, generating secondary hair in the hair transplantation area where the primary hair is located based on the primary hair, weighting the secondary hair to inherit the attribute parameters and motion parameters of the primary hair, and obtaining the modeling, following constraints and rendering of the secondary hair.

[0103] Based on the second embodiment, this embodiment describes in detail how to generate the main hair root point in the hair transplant area, then obtain the guide curve according to the hair root point and the center line, and then describes in detail the process of obtaining the position information of the deviation point by using the deviation constraint formula and the deviation distance formula of the point on the guide curve, and finally obtains the main hair curve. The main hair automatically generated by the method of this embodiment is closer to the style of real hair than the second embodiment, so it can reduce the modification and adjustment of the subsequent nodes of the main hair by the hair maker, and further improve the production efficiency; and this method does not need to manually adjust the lip shape of various virtual characters, and does not need to train and learn the lip shape of each virtual character, so it greatly saves the process and time of virtual lip shape production.

[0104] like Fig.10 As shown, Fig.10 4 is a flow chart of a method for generating virtual hair according to a fourth embodiment of the present invention. The method for generating virtual hair may include:

[0105] S401, dividing and creating regions based on the character's hair growth surface to obtain multiple hair transplantation regions;

[0106] S402, based on the created hair transplantation area, automatically generating a main hair in each hair transplantation area;

[0107] S403, generating multiple nodes by segmentation based on the length of the main shot, and automatically adding preset attribute parameters and motion parameters to each node;

[0108] S404, determining the shape, simulation constraints and rendering of the main hair based on the attribute parameters and the motion parameters;

[0109] S405: Perform the first replication deviation on all nodes on the main source to obtain corresponding inheritance points.

[0110] This embodiment uses a uniform deviation of a certain offset vector value for all nodes of the main issue to obtain all the inheritance points, and then performs weighted inheritance adjustment on these inheritance points. That is, the inheritance points after the copy deviation in this step are not the final positions, and these inheritance points may be adjusted after the weighted inheritance function is calculated in the subsequent steps.

[0111] S406: Based on the position information of the inheritance point and the corresponding node, the attribute parameters and motion parameters of the inheritance point are calculated and adjusted using a weighted inheritance function.

[0112] In this embodiment, according to the value of the offset vector between the main transmitting node and the inheritance point, a Gaussian kernel or a radial basis function (RBF) can be used to calculate and obtain the offset matching degree between the main transmitting node and the inheritance point, and then the orientation matching degree, the color matching degree and the motion matching degree are calculated in combination with the offset matching degree, so as to finally obtain the attribute parameters and motion parameters of the adjusted inheritance point, such as Fig.11 shown.

[0113] Specifically, the offset matching degree can be calculated by the following formula 1:

[0114]

[0115] Where D(z) represents the location information of the main sending node, D(f) represents the location information of the inheritance point formed after the main sending node is copied and offset, and ||D(Z)-D(F)|| represents the Euclidean distance between the two points. Its mathematical formula is: ‖D(z)-D(f)‖ 2 =(x z -x f ) 2 +(y z -y f ) 2 +(z z -z f ) 2 , σ D Indicates how fast the similarity decays with distance. Match(P) describes the similarity between D(z) and D(f). When the distance between the two points is closer, the similarity is higher (the value is closer to 1), and vice versa, the similarity is lower (the value is closer to 0).

[0116] After obtaining the offset matching degree, the matching degree between the deviation point and the main sending node can be obtained according to the weighted inheritance function (Formula 2 below). Formula 2 is as follows:

[0117]

[0118] Among them, Match(O), Match(C), and Match(M) represent orientation matching, color matching, and motion matching, respectively. Their specific calculation methods depend on the representation and measurement methods of this information. For example, for information represented by vectors (such as orientation information and motion information), the dot product or cosine similarity of the vectors can be used; for color information (such as RGB or HSV values), the distance in the color space (such as Euclidean distance) can be used. And ω O ,ω C ,ω M It represents the weight parameter, which is used to adjust the importance of orientation, rendering and motion information in the matching degree calculation. These weights can be adjusted according to specific needs. The calculation result of formula 2 can be used to obtain the matching constraints of the deviation points corresponding to each main node, and then adjust the attribute parameters and motion parameters of the inherited point. It can be seen from formula 2 that the closer the distance between the node and the deviation point, the more similar their orientation, rendering and motion are.

[0119] S407, connecting all the adjusted inheritance points and performing curve smoothing processing to obtain the first secondary hair.

[0120] After completing this step, the embodiment can generate the first secondary hair, and then repeat the above three steps S405 to S407 to generate the second secondary hair again. After completing the second secondary hair, repeat the above steps S405 to S407 to generate the third secondary hair, and so on. Before each copy and deviation from the main hair, the terminal will randomly generate an offset vector. The value of the offset vector is different each time. The offset vector can be controlled by a program segment or a formula to achieve the change of the offset vector and the control of the change range and the number of offset vectors. Moreover, each time the main hair is copied and deviated through the offset vector, it will determine whether these deviation points are within the hair transplant area. If all the deviation points are not within the hair transplant area, these deviation points will be automatically deleted, and the next offset vector value will be generated again.

[0121] S408. After m times of replication deviation and calculation adjustment, the position and distance of each replication deviation are different, and finally m secondary hairs are generated in the hair transplantation area.

[0122] In this embodiment, how to determine the number of secondary hairs generated in the hair transplant area can be manually set and adjusted through a set numerical attribute; or it can be determined by the terminal itself. The method of self-determination can be to automatically calculate the number of secondary hairs based on the surface area of ​​the hair transplant area and the hair density value, or it can be, for example, to let the offset vector slowly increase randomly from the minimum value until the terminal determines that the deviation points copied and deviated by the offset vectors generated multiple times in succession are beyond the hair transplant area, then stop generating secondary hairs.

[0123] Based on the first embodiment, this embodiment describes in detail how to copy and deviate the nodes of the main hair to form inheritance points, and then connect the obtained inheritance points to form a secondary hair. Finally, after repeated operations, all the secondary hairs of the main hair are obtained. This embodiment method will not easily cause the terminal to be overloaded and the program to fail to respond when the main hair generates secondary hair, thereby effectively improving the efficiency of generating secondary hair; and this method completes the three stages of modeling - simulation constraints - rendering when designing a single main hair. This virtual hair generation method is suitable for various virtual hairstyle designs such as short hair, long straight hair, curly hair, etc., and has strong applicability; and the hair generated by this method has more realistic simulation effects in terms of motion following and dynamic constraints, and is closer to the effect of real hair, which greatly improves the user experience and the beauty of the picture.

[0124] like Fig.12 As shown, Fig.12 : is a flow chart of a method for generating virtual hair provided by a fifth embodiment of the present invention. The method for generating virtual hair may include:

[0125] S501, performing regional division and creation based on the character's hair growth surface to obtain a plurality of first hair transplantation areas;

[0126] S502, based on the created first hair transplantation area, automatically generating a first main hair in each first hair transplantation area, where the first main hair is located in the middle of the first hair transplantation area;

[0127] In this embodiment, the generated first main hair is limited to the middle position of the first hair transplantation area. The specific method is that the first hair transplantation area is enclosed by four curves, that is, the first hair transplantation area is a quadrilateral surface, and then the terminal respectively obtains the midpoints of the two curves closest and farthest from the top of the character's hair growth surface, and uses the curve where the normal plane formed by these two intersects with the surface as the guide curve, thereby generating the first main hair.

[0128] S502, dividing the first hair transplantation area into three second hair transplantation areas, and generating second main hair again in the second hair transplantation areas that do not contain the first main hair.

[0129] The second main shooter is automatically generated based on the node attribute parameters and motion parameters of the two adjacent first main shooters and the matching degree.

[0130] The second main hair generated in this embodiment has a matching constraint relationship with the main hair in the first hair-implantation area, and also has a matching constraint relationship with the main hair in another adjacent first hair-implantation area, that is, the orientation, rendering and motion information of the second main hair is between the orientation, rendering and motion information of the two main hairs, wherein the closer the second main hair is to one of the two main hairs, the more its orientation, rendering and motion information is biased towards the main hair. Taking the orientation information as an example, if Fig.13 In the example shown, the first main hair A61 is located in the first hair-implantation area 71 on the left side, and three second hair-implantation areas 711, 712, and 713 are provided in the first hair-implantation area 71 on the left side, and the first main hair A61 is located in the middle second hair-implantation area 712. In addition, the example also shows the first forehead hair-implantation area 72 adjacent to the first hair-implantation area 71 on the left side, and the generated second main hair 60 is located in the second hair-implantation area 711 in the first hair-implantation area 71 on the left side, close to the first forehead hair-implantation area 72. Therefore, the orientation of the second main hair 60 is between the first main hair A61 and the first main hair B62, and because the second main hair 60 is closer to the first main hair A61, its orientation is more biased towards the first main hair A61.

[0131] S503, generating a plurality of nodes by segmenting based on the lengths of the first main shot and the second main shot, and automatically adding preset attribute parameters and motion parameters to each node;

[0132] S504, determining the shape, simulation constraints and rendering of the main hair based on the attribute parameters and the motion parameters;

[0133] S505, generating secondary hair in the hair transplantation area where the primary hair is located based on the primary hair, weighting the secondary hair to inherit the attribute parameters and motion parameters of the primary hair, and obtaining the modeling, following constraints and rendering of the secondary hair.

[0134] Based on the first embodiment, this embodiment describes in detail the main hair generation process, and divides the generation of the main hair into two steps, so as to better control the transition of hair between two adjacent first hair transplantation areas, further improve the overall hair distribution effect, and ensure that it is closer to the real hair effect. The method of this embodiment is more suitable for situations where the character's hair generation surface area is large (such as hair set on the whole body) or when the effect is not good after the initial hair transplantation area division. Therefore, the applicability of this virtual hair generation method is stronger; and the hair generated by this method has more realistic simulation effects in terms of motion following and dynamic constraints, which is closer to the effect of real hair, greatly improving the user experience and the beauty of the picture.

[0135] In order to better implement the virtual hair generation method provided by the present invention, the present invention also provides a device based on the virtual hair generation method. The meanings of the terms are the same as those in the virtual hair generation method, and the specific implementation details can refer to the description in the method embodiment.

[0136] like Fig.14 , Fig.14 Schematic diagram of the structure of a virtual lip shape generation device according to one embodiment of the present invention. The virtual lip shape generation device includes a division module 81, a main generation module 82, a node generation module 83, a parameter adjustment module 84 and a secondary generation module 85.

[0137] The division module 81 is used to divide and create regions based on the character's hair growth surface to obtain multiple hair transplantation regions;

[0138] A main hair generation module 82 is used to automatically generate a main hair in each hair transplantation area based on the created hair transplantation area;

[0139] A node generation module 83 is used to generate multiple nodes based on the length of the main shot, and automatically add preset attribute parameters and motion parameters to each node;

[0140] A parameter adjustment module 84, for determining the shape, simulation constraints and rendering of the main hair based on the attribute parameters and the motion parameters;

[0141] The secondary hair generation module 85 generates secondary hair in the hair transplantation area where the primary hair is located based on the primary hair, and weights the secondary hair to inherit the attribute parameters and motion parameters of the primary hair to obtain the shape, follow-up constraints and rendering of the secondary hair.

[0142] In some embodiments, the main hair generation module 82 further includes a hair root point generation module and a center line generation module, wherein the hair root point generation module is used to generate the hair root point of the main hair on the surface of the hair transplantation area; and the center line generation module is used to generate the center line on the character hair generation surface. Furthermore, the main hair generation module also includes a coordinate system establishment module, which is used to generate a local coordinate system at the intersection of the center line of the character hair generation surface and the character hair generation surface.

[0143] In some other embodiments, the main hair generation module 82 includes a hair root point generation module, a center line generation module and a deviation point generation module, wherein the hair root point generation module is used to generate the root point of the main hair on the surface of the hair transplantation area, the center line generation module is used to generate a center line on the character's hair generation surface to obtain a guide curve, and the deviation point generation module is used to generate corresponding deviation points after performing deviation constraint processing based on several points on the guide curve.

[0144] In the embodiment of the present invention, the character's hair generation surface can be divided into hair transplantation areas by the division module 81; the main hair of each hair transplantation area can be obtained by the main hair generation module 82; then the node generation module 83 generates nodes with preset attribute parameters and motion parameters on the main hair; the parameter adjustment module 84 is used to adjust the attribute parameters and motion parameters; finally, the secondary hair generation module 85 generates the secondary hair to complete the hair processing process. The method of this embodiment integrates the work of modeling, simulation constraints and rendering in the main hair design stage, so it will not cause high load on the operation of the terminal, and can shorten the processing cycle of virtual hair, effectively improving the production efficiency; and the secondary hair can inherit the main hair to form a follow-up constraint, so the authenticity of the dynamic simulation effect of virtual hair is effectively improved.

[0145] The present application also provides a computer device, which may be a server. Fig.15 As shown, it shows a schematic diagram of the structure of the server involved in the embodiment of the present invention, specifically:

[0146] The server may include one or more processing core processors 91, one or more computer-readable storage media memories 92, a power supply 93, a display unit 94 and other components. Those skilled in the art will appreciate that Fig.15The server structure shown in the figure does not constitute a limitation on the server, and may include more or less components than shown in the figure, or combine certain components, or arrange components differently. For example, the server may also include a display unit, etc., which will not be repeated here. Among them: the processor 91 is the control center of the server, and uses various interfaces and lines to connect various parts of the entire server. By running or executing computer instructions and / or modules stored in the memory 92, and calling data stored in the memory 92, it executes various functions of the server and processes data, thereby monitoring the server as a whole. The memory 92 can be used to store computer instructions and modules, and the processor 91 executes various functional applications and data processing by running computer instructions and modules stored in the memory 92. The memory 92 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created according to the use of the server, such as attribute parameters and motion parameters of the main and secondary transmitters. In addition, the memory 92 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 92 may also include a memory controller to provide the processor 91 with access to the memory 92. The display unit 94 may be used to display the display of hair during the virtual hair processing process, so that the creator can adjust and modify the virtual hair at any time according to the visual effect, thereby improving the processing efficiency of the virtual hair.

[0147] Specifically in this embodiment, the processor 91 in the server will load the executable files corresponding to the processes of one or more applications into the memory 92 according to the following instructions, and the processor 91 will run the applications stored in the memory 92, thereby realizing the following functions:

[0148] Based on the character's hair generation surface, the area is divided and created to obtain multiple hair transplantation areas; based on the created hair transplantation areas, a main hair is automatically generated in each hair transplantation area; based on the length of the main hair, multiple nodes are generated by segmentation, and preset attribute parameters and motion parameters are automatically added to each node; based on the attribute parameters and motion parameters, the shape, simulation constraints and rendering of the main hair are determined; based on the main hair, secondary hair is generated in the hair transplantation area where the main hair is located, and the secondary hair is weighted to inherit the attribute parameters and motion parameters of the main hair to obtain the shape, follow-up constraints and rendering of the secondary hair, and finally the overall virtual hair processing process is completed.

[0149] According to one aspect of the present invention, a virtual hair generation storage medium is provided, and the storage medium is used to store computer instructions. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned embodiments. It can be understood by ordinary technicians in this field that all or part of the steps in the methods of the above-mentioned embodiments can be completed by computer instructions, or by controlling related hardware through computer instructions. The specific implementation of the above methods can be referred to the previous embodiments, which will not be repeated here. Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc.

[0150] Since the program stored in the storage medium can execute the steps in any virtual hair generation method provided in the embodiments of the present invention, the beneficial effects that can be achieved by any virtual hair generation method provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0151] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit them. Although the embodiments of the present invention have been shown and described, it should be understood by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and purpose of the present invention. The scope of the present invention is defined by the claims and their equivalents.

Claims

1. A method for generating virtual hair, It is characterized in that include: Based on the character's hair growth surface, the area is divided and created to obtain multiple hair transplant areas; Based on the created hair transplantation areas, automatically generating a main hair in each of the hair transplantation areas; Based on the length of the main shot, multiple nodes are generated by segmentation, and preset attribute parameters and motion parameters are automatically added to each node; Determine the shape, simulation constraints and rendering of the main hair based on the attribute parameters and the motion parameters; Based on the main hair, secondary hair is generated in the hair transplantation area where the main hair is located, and the secondary hair is weighted to inherit the attribute parameters and motion parameters of the main hair to obtain the shape, follow-up constraints and rendering of the secondary hair.

2. The virtual hair generation method according to claim 1, It is characterized in that The process of creating a region based on the character's hair generation surface includes the following steps: The hair transplant area is divided based on the difference in preset hair directions of the characters.

3. The virtual hair generation method according to claim 1, It is characterized in that The method of automatically generating a main hair in each hair transplantation area comprises the following steps: Generating the root point of the main hair on the surface of the hair transplantation area; Determining a guide curve of the hair transplantation area based on the position of the hair root point and the center line position of the character's hair growth surface; Corresponding deviation points are generated after deviation constraint processing is performed on a plurality of points of the guide curve, and the hair root point is sequentially connected with all the deviation points to form the main hair.

4. The virtual hair generation method according to claim 3, It is characterized in that Generating the root point of the main hair on the surface of the hair transplantation area comprises the following steps: Obtaining the intersection point between the center line of the character's hair generation surface and the character's hair generation surface, and taking the point as the origin of the local coordinate system; Acquire the local coordinate relationship of each vertex of the hair transplantation area based on the local coordinate system; Obtain two vertices that are closest to the origin, and then obtain the midpoint of the line connecting the two vertices; The midpoint is connected to the origin and extended toward the direction of the character's hair growth surface, and the point where the midpoint intersects with the character's hair growth surface is used as the hair root point of the main hair.

5. The virtual hair generation method according to claim 3, It is characterized in that The step of generating corresponding deviation points after performing deviation constraint processing on a plurality of points on the guide curve, and sequentially connecting the hair root point with all the deviation points to form the main hair, comprises the following steps: The constraint value is obtained using the deviation constraint formula; The position information of the deviation point is obtained according to the deviation distance formula; Specifically, the deviation constraint formula is: Among them, k is the constraint value, k(d n ) has a value range of [0,1], and a larger value indicates a stronger restraint, that is, the main hair is closer to the hair transplantation area; d n is the relative position distance between the nth point of the guide curve and the rooting point in the deviation direction; w is the constraint weight value, and α is used to control k with d n For positive values ​​of the speed of change, the relationship between w and α is: D is the distance between the guide curve and the root point in the deviation direction where the relative distance is the largest, that is, d n The maximum value of d thresh is a threshold close to but less than D; Δd n is the difference between the relative position distances of two adjacent points, i.e. Δd n =d n -d n-1 ; After the constraint value k is obtained by the above formula, the position information of the point on the guide curve after the nth point deviates from the distance L in the deviation direction is obtained according to the deviation distance formula L=(1-k)*p, where p is the deviation weight value. Finally, all the obtained points are connected in sequence and the curve after curve smoothing is the main launch.

6. The virtual hair generation method according to claim 1, It is characterized in that The method of generating secondary hair in the hair transplantation area where the primary hair is located based on the primary hair, and weighting the secondary hair to inherit the attribute parameters and motion parameters of the primary hair, comprises the following steps: Performing a first replication deviation on all nodes on the primary source to obtain corresponding inheritance points; Based on the position information of the inheritance point and the corresponding node, the attribute parameters and motion parameters of the inheritance point are calculated and adjusted by using a weighted inheritance function; The first secondary hair is obtained by connecting all the inherited points after adjustment and performing curve smoothing processing; After m times of replication deviation and calculation adjustment, the position and distance of each replication deviation are different, and finally m secondary hairs are generated in the hair transplantation area.

7. The virtual hair generation method according to claim 1, It is characterized in that The virtual hair generation method further comprises: The generation of the main hair is divided into at least two generations, that is, the character's hair generation surface is divided into regions to create a first hair transplantation region, and a first main hair is automatically generated in each of the first hair transplantation regions, and the first main hair is located in the middle of the first hair transplantation region; the first hair transplantation region is then divided into three second hair transplantation regions, and the second main hair is generated again in the second hair transplantation region that does not contain the first main hair; The second main shoot is automatically generated based on the node attribute parameters and motion parameters of two adjacent first main shoots combined with the matching degree.

8. A virtual hair generation device, It is characterized in that include: A division module is used to divide and create regions based on the character's hair growth surface to obtain multiple hair transplantation regions; A main hair generation module, used for automatically generating a main hair in each hair transplantation area based on the created hair transplantation area; A node generation module, used for segmentally generating a plurality of nodes based on the length of the main shot, and automatically adding preset attribute parameters and motion parameters to each node; A parameter adjustment module, used for determining the shape, simulation constraints and rendering of the main hair based on attribute parameters and motion parameters; The secondary hair generation module generates secondary hair in the hair transplantation area where the primary hair is located based on the primary hair, and weights the secondary hair to inherit the attribute parameters and motion parameters of the primary hair to obtain the shape, follow-up constraints and rendering of the secondary hair.

9. A virtual hair generating computer device, It is characterized in that include: Memory and processor; The memory stores executable computer instructions; When the processor executes the computer instructions in the memory, the virtual hair generating method according to any one of claim 17 is implemented.

10. A virtual hair generation storage medium, It is characterized in that The storage medium is used to store computer instructions, and the computer instructions are loaded by the processor to execute the virtual hair generating method according to any one of claim 17.