Hair model processing method and device, computer equipment and storage medium
By generating the surrounding body and adjusting the vertices of the hair model, the problem of interspersing when the virtual character's hair and hat is solved, and the efficient adaptation of the hair model and hat model is achieved, reducing the workload of artists.
Patent Information
- Application Number
- CN202411997871.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-03-04
AI Technical Summary
In the game, when the hairstyle of the virtual character is combined with the style of the hat, there is often a problem of hair interspersing in the area covered by the hat, which leads to the artists needing to make multiple models of different states for the same hair, which increases the workload.
By obtaining the hair model and the hat model, an enclosing body is generated, and the intersecting area between the hair model and the enclosing body and its target model vertices are determined. According to the distance between the target model vertices and the target position, the target model vertices are controlled to shrink to the hat model to obtain the target hair model that is suitable for the hat model.
This method only requires adjustments to the model vertices of the mold-wrapped part of the hair model, which can adapt the hair model to the hat model, reducing the workload and improving the processing efficiency of the hair model.
Smart Images

Figure CN119548826A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, computer equipment and storage medium for processing a hair model. Background Art
[0002] In the game, the hairstyles and hats of virtual characters vary greatly. When combining hairstyles and hats, there are often problems of interlacing with each other. For example, the model corresponding to the area covered by the hat is easily interspersed with hair that should be inside the hat, etc.
[0003] In the related art, when designing hair models, artists will create multiple different states for the same hair, such as flattened, stretched, etc. These different versions of hair will be adapted according to the type of hat. However, this method will greatly increase the workload of artists. Summary of the invention
[0004] The embodiments of the present application provide a hair model processing method, apparatus, computer equipment and storage medium, which can improve the processing efficiency of the hair model.
[0005] The present application embodiment provides a method for processing a hair model, comprising:
[0006] Get the hair model and hat model;
[0007] Generate a bounding volume based on the hat model;
[0008] Determine an intersection area between the hair model and the bounding volume, and a target model vertex of the hair model in the intersection area;
[0009] Based on the distance between the vertices of the target model and the target position, the vertices of the target model are controlled to shrink toward the hat model to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
[0010] Accordingly, the embodiment of the present application further provides a hair model processing device, comprising:
[0011] An acquisition unit, used for acquiring a hair model and a hat model;
[0012] A generating unit, configured to generate a bounding volume based on the hat model;
[0013] A first determining unit, configured to determine an intersection area between the hair model and the bounding volume, and a target model vertex of the hair model in the intersection area;
[0014] A control unit is used to control the vertices of the target model to shrink toward the hat model based on the distance between the vertices of the target model and the target position, so as to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
[0015] Accordingly, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes any hair model processing method provided in the embodiments of the present application.
[0016] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the above hair model processing method.
[0017] This solution obtains a hair model and a hat model; generates a bounding volume based on the hat model; determines the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area; controls the target model vertices to shrink toward the hat model based on the distance between the target model vertices and the target position, and obtains a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model. In the above manner, the hair model and the hat model can be adapted by only adjusting the model vertices of the through-molding part of the hair model, thereby reducing the workload and improving the processing efficiency of the hair model. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0019] Figure 1 A schematic flow chart of a hair model processing method provided in an embodiment of the present application.
[0020] Figure 2 A schematic diagram of an application scenario of a hair model processing method provided in an embodiment of the present application.
[0021] Figure 3 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application.
[0022] Figure 4 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application.
[0023] Figure 5A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application.
[0024] Figure 6 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application.
[0025] Figure 7 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application.
[0026] Figure 8 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application.
[0027] Fig. 9 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application.
[0028] Fig.10 This is a structural block diagram of a hair model processing device provided in an embodiment of the present application.
[0029] Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0031] The embodiments of the present application provide a method, device, storage medium and computer equipment for processing a hair model. Specifically, the method for processing a hair model of the embodiments of the present application can be executed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a personal computer (PC), a personal digital assistant (PDA), etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Distribution Network), and big data and artificial intelligence platforms.
[0032] For example, the computer device may be a terminal, which may acquire a hair model and a hat model; generate a bounding volume based on the hat model; determine an intersection area between the hair model and the bounding volume, and target model vertices of the hair model in the intersection area; and control the target model vertices to shrink toward the hat model based on a distance between the target model vertices and a target position, to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
[0033] Based on the above problems, the embodiments of the present application provide a first hair model processing method, apparatus, computer device and storage medium, which can improve the processing efficiency of the hair model.
[0034] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0035] The embodiment of the present application provides a method for processing a hair model. The method can be executed by a terminal or a server. The embodiment of the present application takes the method for processing a hair model executed by a terminal as an example for explanation.
[0036] See also Figure 1 , Figure 1 A schematic diagram of a process flow of a hair model processing method provided in an embodiment of the present application. The specific process flow of the hair model processing method may be as follows:
[0037] 101. Get the hair model and hat model.
[0038] In the embodiment of the present application, the target object refers to a virtual character with hair, and the virtual character may include a virtual character in a game or animation, etc.
[0039] The hair model refers to a model used to achieve the hair effect of the target object; the hat model refers to a model used to achieve the effect of the target object wearing a hat.
[0040] For example, the object model of the target object may include a hair setting part (eg, head), and the hair model may be set at the hair setting part of the object model; the hat model may be set above the hair model to cover at least part of the hair model.
[0041] Among them, the hair model and the hat model can be combined together.
[0042] For example, see Figure 2 , Figure 2 A schematic diagram of an application scenario of a hair model processing method provided in an embodiment of the present application. Figure 2 Shown is the hair model and hat model combined together.
[0043] There are many ways to obtain the hair model and the hat model. For example, a pre-made hair model and hat model may be obtained, or a hair model and a hat model may be created.
[0044] In some embodiments, the hair model and the hat model can be obtained by extracting a combined part of the hair model and the hat model from the object model of the target object (which has been provided with the hair model and the hat model) to obtain the combined hair model and the hat model.
[0045] In some embodiments, the hat model and the hair model can be obtained by creating or importing a model through 3D software, wherein the 3D software may include multiple types, such as Houdini, etc.
[0046] Among them, Houdini is an advanced visual effects software that can build complex visual effects and animations through a node system. Each node represents a specific function, and the connections between nodes form a complex workflow.
[0047] For example, use Houdini to import already made hair models and hat models from external files; or use the modeling tools in Houdini to create hair models and hat models, etc.
[0048] 102. Generate a bounding volume based on the hat model.
[0049] Among them, the bounding volume refers to a closed space that completely surrounds an object or a group of objects.
[0050] In the embodiment of the present application, the bounding volume generated according to the hat model may be a closed space that completely surrounds the hat model.
[0051] In some embodiments, in order to improve the efficiency of generating a bounding volume, the step of “generating a bounding volume based on the hat model” may include the following operations:
[0052] Extract the bottom geometry of the hat model;
[0053] Get the preset height parameter, and generate a bounding volume based on the preset height parameter and the bottom surface geometry.
[0054] The bottom surface geometry of the hat model refers to the geometry corresponding to the surface of the hat model that contacts the hair model.
[0055] For example, see Figure 3 , Figure 3 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application. Figure 3 The left side is a hat model. Figure 3On the right is the bottom surface geometry obtained by extracting the bottom surface from the hat model.
[0056] In some embodiments, the bottom surface geometry of the hat model can be extracted by 3D software. For example, the bottom of the hat model can be extracted by the Extract SOP (Extraction Operator) tool in Houdini to obtain the bottom surface geometry.
[0057] Among them, Extract SOP can extract specific parts or elements that meet specific conditions from geometric bodies (such as meshes, point clouds, etc.).
[0058] For example, create or import a hat model in Houdini as the input of Extract SOP; in the node view, connect the Extract SOP operator to the hat model node; then, set the extraction conditions, which can be based on the attributes of the geometry (such as position, normal, color, etc.) or user-defined expressions; after setting the extraction conditions, perform the extraction operation according to the extraction conditions to obtain the bottom surface geometry of the hat model.
[0059] The preset height parameter refers to the height of the bounding volume to be generated. Since the bounding volume needs to completely surround the hat model, the preset height parameter may be greater than the height of the hat model.
[0060] In some embodiments, the step of “generating a bounding volume based on a preset height parameter and a bottom surface geometry” may include the following operations:
[0061] Determine the silhouette edges in the bottom geometry;
[0062] Extend the contour edge in a direction away from the center of the bottom surface geometry to obtain a new bottom surface geometry;
[0063] determining a first direction perpendicular to the new bottom geometry;
[0064] Based on the first direction and the preset height parameter, the new bottom surface geometric body is extruded to obtain a bounding volume.
[0065] The silhouette edges are the edges at the outer edges of the bottom geometry.
[0066] For example, see Figure 4 , Figure 4 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application. Figure 4 The hat model shows the outer contour edge (i.e. Figure 4 (edges shown in bold).
[0067] The purpose of extending the contour edge in a direction away from the center of the bottom surface geometry is to expand the coverage of the bottom surface geometry to ensure that the generated bounding volume can completely cover the hair model (that is, the horizontal width of the bounding volume is greater than the horizontal width of the hair model).
[0068] In some embodiments, the contour edge can be extended by operating a 3D software, for example, the contour edge in the bottom surface geometry can be extruded in a direction away from the center of the bottom surface geometry by using the Extrude SOP (Extrusion Operator) tool in Houdini to obtain a new bottom surface geometry.
[0069] Among them, Extrude SOP can be used to extrude two-dimensional objects (such as lines, polygons, etc.) in a specified direction. By adjusting the parameters, you can control the shape, depth, direction, etc. of the extrusion.
[0070] For example, see Figure 5 , Figure 5 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application. Figure 5 The left side shows the bottom geometry and the contour edge in the bottom geometry. The contour edge in the bottom geometry is extruded away from the center of the bottom geometry by the Extrude SOP tool. Figure 5 The new bottom geometry is shown on the right, where the area of the new bottom geometry is larger than the area of the original bottom geometry.
[0071] The first direction is a direction perpendicular to the plane where the bottom geometric body is located. For example, the bottom geometric body may be in a horizontal direction, and the first direction may be a vertical direction, and so on.
[0072] Extrusion processing generally refers to the process of extending a two-dimensional graphic (such as a line, outline or surface) in a direction perpendicular to the graphic to generate a three-dimensional shape. This processing process usually maintains certain features of the original graphic (such as shape, proportion, etc.) in three-dimensional space.
[0073] In an embodiment of the present application, extruding a new bottom surface geometry based on a first direction and a preset height parameter may include: extruding a two-dimensional new ground geometry according to the first direction and a preset height parameter to generate a three-dimensional bounding box.
[0074] Since the new bottom surface geometric body needs to be expanded into a three-dimensional bounding volume, the direction for extruding the new bottom surface geometric body can be determined to be a first direction perpendicular to the new bottom surface geometric body.
[0075] In some embodiments, based on the first direction and the preset height parameter, the new bottom surface geometry is extruded, which can be operated through three-dimensional software. For example, the Extrude SOP (extrusion operator) tool in Houdini can be used to extrude the new bottom surface geometry along the first direction by the preset height parameter to obtain an enclosing volume.
[0076] For example, see Figure 6 , Figure 6 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application. Figure 6 The new bottom geometry is shown on the left. The new bottom geometry is extruded along the first direction using the Extrude SOP tool to obtain Figure 6 The bounding volume shown on the right, wherein the height of the bounding volume can be a preset height parameter.
[0077] In an embodiment of the present application, by utilizing the bottom surface geometry separated from the hat model, an accurate bounding volume can be generated by expanding and extruding the thickness according to the side length of the bottom surface geometry. There is no need to manually make a complex bounding volume, which can reduce the workload of adapting the hair model and the hat model.
[0078] 103. Determine the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area.
[0079] The intersection area of the hair model and the bounding volume may include an overlapping area of the hair model and the bounding volume; the target model vertex refers to a model vertex of the hair model that is in the intersection area.
[0080] In some embodiments, the step of “determining the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area” may include the following operations:
[0081] Perform intersection detection on the bounding volume and the hair model to determine the overlapping part of the bounding volume and the hair model and obtain the intersection area;
[0082] From among all the model vertices of the hair model, the model vertex in the intersection area is determined as the target model vertex.
[0083] For the intersection detection between the hair model and the bounding volume, the intersection area generally refers to the part where the hair model and the bounding volume overlap or contact in space.
[0084] In some embodiments, performing intersection detection on the bounding volume and the hair model to determine the intersection area may include: determining whether the bounding volume and the hair model intersect through a Collision Detection node of Houdini, and if so, obtaining the intersection area.
[0085] For example, in the Collision Detection node of Houdini, set the parameters related to the bounding volume, such as size and position, and adjust them as needed. Then you can adjust the collision detection parameters, such as collision accuracy, etc. Among them, the parameters related to collision accuracy can include the resolution and tolerance of collision detection. Adjust these parameters as needed to ensure that the collision detection can accurately capture the intersection area.
[0086] In some embodiments, performing intersection detection on the bounding volume and the hair model to determine the intersection area may include: determining whether the hair model and the bounding volume intersect by an intersection detection algorithm; if so, calculating the intersection area between the hair model and the bounding volume.
[0087] Among them, the intersection detection algorithm aims to determine whether two or more geometric bodies (such as points, lines, polygons, polyhedrons or bounding volumes) intersect in space. Its basic principles usually involve the representation of geometric bodies, the judgment of spatial position relationships, and the verification of intersection conditions. There are many types of intersection detection algorithms, such as line segment intersection detection algorithm: used to determine whether two line segments intersect; rectangle intersection test algorithm: used to determine whether two rectangles intersect, by comparing whether the projections of the two rectangles in the horizontal and vertical directions overlap; ray method: by comparing the positional relationship between the internal points of the two polygons to determine whether they intersect; point cloud intersection test algorithm: by calculating the distance between two point clouds; and so on.
[0088] For example, see Figure 7 , Figure 7 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application. Figure 7 The intersection detection between the hair model and the bounding volume is performed, and the obtained intersection area between the hair model and the bounding volume is shown.
[0089] In some embodiments, after determining that the hair model intersects with the bounding volume, the intersection area of the hair model and the bounding volume may be scattered. For example, the intersection points of the hair model and the bounding volume may be calculated first, and the intersection area may be constructed based on these intersection points.
[0090] Among them, determining the model vertices in the intersection area from all the model vertices of the hair model as the target model vertices can include: obtaining the position coordinates of each model vertex in the hair model, judging the model vertices in the intersection area according to the position coordinates, and thus determining the target model vertices in the hair model that intersect with the bounding volume.
[0091] In the embodiment of the present application, by creating a bounding volume to calculate the intersection area, the interaction process between the hair model and the hat model can be simplified.
[0092] In some embodiments, in order to further improve the adaptation effect of the hair model and the hat model, determining the target model vertex from the hair model may also include: determining a first model vertex in an intersection area from the hair model, and selecting some model vertices adjacent to the first model vertex in the hair model as second model vertices, and taking the first model vertex and the second model vertex as target model vertices, so that in subsequent processing steps, the first model vertex and the second model vertex are adjusted together to avoid a large distance between the first model vertex and the second model vertex, and adjusting only the first model vertex will affect the morphological change of the hair model.
[0093] 104. Based on the distance between the vertices of the target model and the target position, the vertices of the target model are controlled to shrink toward the hat model to obtain a target hair model adapted to the hat model.
[0094] In the embodiment of the present application, the target model vertex refers to the model vertex that affects the hair model to intersperse the hat model after the hat model and the hair model are combined. For the target model vertex, the position needs to be adjusted so that it does not intersperse the hat model.
[0095] The target position is a position determined based on the hat model.
[0096] In some embodiments, the target position may be the center line of the hat model, and the step of “controlling the target model vertices to shrink toward the hat model based on the distance between the target model vertices and the target position to obtain a target hair model adapted to the hat model” may include the following operations:
[0097] Determine the shortest distance between each vertex of the target model and the center line of the hat model;
[0098] The preset scaling parameters are obtained, and based on the preset scaling parameters and the closest distance, the vertices of the target model are controlled to shrink toward the center line to obtain the target hair model.
[0099] The center line of the hat model may be a central axis, which is located at the center of the hat model and runs through the entire hat model.
[0100] In the embodiment of the present application, the shrinking process of the target model vertex includes moving the position of the target model vertex. For example, the target model vertex may be moved to the target position.
[0101] In some embodiments, the target model vertices may be shrunk using a central axis approximation technique. The central axis approximation technique may be used to approximate or determine the central axis of an irregularly shaped object. The central axis approximation technique is a technique for approximating or determining the central axis of an irregularly shaped object through a series of mathematical or computational methods.
[0102] The closest distance is the shortest distance between the vertex of the target model and the central axis of the hat model.
[0103] In some embodiments, the step of “determining the shortest distance between each vertex of the target model and the center line of the hat model” may include the following operations:
[0104] Obtaining first position information of the vertices of the target model and second position information of the center line;
[0105] Based on the first position information and the second position information, calculating the projection length of the vertex of the target model on the center line;
[0106] Determine the projection point of the vertex of the target model on the center line based on the projection length;
[0107] Calculate the distance between the target model vertex and the projection point to get the shortest distance.
[0108] The first position information may include the position coordinates of the vertices of the target model in the spatial coordinate system; the second position information may include the direction of the center line in the spatial coordinate system and the position coordinates of the points on the center line in the spatial coordinate system, etc.
[0109] The projection length from point to line describes the length of the "shadow" or "projection" of the vertical distance from a point to a line in the direction of the line. The projection length of the vertex of the target model on the center line refers to the length of the projection of the vertical distance from the point of the target model to the center line in the direction of the center line.
[0110] In some embodiments, the projection length of the vertex of the target model on the center line can be calculated according to the following formula:
[0111]
[0112] Among them, A and B are points on the center line, refers to the vector corresponding to the center line (which can be calculated based on the position coordinates of point A and point B); P refers to the vertex of the target model. Refers to the vector corresponding to point A to point P (which can be calculated based on the position coordinates of point A and point P); Refers to the vector corresponding to the calculated projection length of the target model vertex P on the center line AB.
[0113] Wherein, determining the projection point of the vertex of the target model on the center line according to the projection length may include: determining the projection point of the vertex of the target model on the center line according to the projection length The difference between the coordinate position of point A and the position coordinate of projection point C is calculated.
[0114] The distance between the target model vertex and the projection point can be calculated based on the position coordinates of the target model vertex and the projection point, thereby obtaining the shortest distance between the target model vertex and the center line.
[0115] For example, see Figure 8 , Figure 8 A schematic diagram of an application scenario of another method for processing a hair model provided in an embodiment of the present application. Figure 8 In the figure, point A and point B are points on the center line of the hat model, and point P is the vertex of the target model that penetrates the hat model. The projection point of the vertex P of the target model on the center line calculated according to the above method is point C, that is, the point on the center line of the hat model that is closest to the vertex P of the target model is point C.
[0116] In some embodiments, a VEX (Houdini's built-in programming language) code can be written using a PointWrangle node according to the above method of calculating the shortest distance between the vertex and the center line of the target model. The function of calculating the shortest distance between the vertex and the center line of the target model is realized by running the code.
[0117] Among them, the PointWrangle node is a node in Houdini that allows users to use VEX to write custom scripts to operate point-level data.
[0118] In some embodiments, in order to obtain a hair model that is adapted to the hat model, that is, not interspersed with the hat model, the step of “controlling the target model vertex to shrink toward the hat model based on the distance between the target model vertex and the target position to obtain a target hair model adapted to the hat model” may include the following operations:
[0119] Based on the distance between the vertex of the target model and the target position, the vertex of the target model is controlled to shrink toward the hat model to determine the candidate hair model;
[0120] determining whether the candidate hair model is interspersed with the hat model;
[0121] If the candidate hair model is not interspersed with the hat model, the candidate hair model is used as the target hair model.
[0122] Among them, the distance between the vertex of the target model and the hat model is also the shortest distance between the vertex of the target model and the center line of the hat model.
[0123] In some embodiments, based on the distance between the target model vertex and the center line of the hat model, controlling the target model vertex to shrink toward the center line of the hat model may include: obtaining a preset shrinkage parameter, where the shrinkage parameter represents the ratio of shrinking the closest distance between the hair model and the center line, for example, the shrinkage parameter may be 0.5, which means that the closest distance is shrunk to half of the original distance.
[0124] Further, the distance after shrinkage is calculated according to the shrinkage parameter and the closest distance, and then the position of the vertex of the target model is adjusted according to the distance after shrinkage, so that the closest distance between the adjusted vertex of the target model and the center line of the hat model becomes the distance after shrinkage.
[0125] The candidate hair model is a hair model obtained by shrinking the vertices of the target model in the hair model.
[0126] There are many ways to determine whether the candidate hair model is interspersed with the hat model, such as manual inspection, or the above-mentioned method of creating a bounding volume to detect whether the bounding volume intersects with the candidate hair model, thereby determining whether the candidate hair model and the hat model are interspersed, and other detection methods are not limited here.
[0127] If it is detected that the candidate hair model is not interspersed with the hat model, it means that the candidate hair model is adapted to the hat model and no further adjustment is required, so the candidate hair model can be used as the target hair model.
[0128] In some embodiments, in order to achieve the best matching effect between the hat model and the hair model, the method may further include the following steps:
[0129] If the candidate hair model intersects the hat model, a new bounding volume is generated based on the hat model, and a new intersection area between the candidate hair model and the new bounding volume is determined;
[0130] Based on the distance between the new target model vertices of the candidate hair model in the new intersection area and the hat model, the new model vertices are controlled to shrink toward the hat model to obtain a new candidate hair model, until the new candidate hair model does not intersperse the hat model, thereby obtaining the target hat model.
[0131] Generating a new bounding volume based on the hat model may include: extracting the bottom surface geometry of the hat model, and obtaining a new bounding volume by extruding the bottom surface geometry. In the process of extruding the bottom surface geometry, different parameters from those of the bounding volume generated in step 102 may be set to generate a different bounding volume.
[0132] Among them, determining a new intersection area between the candidate hair model and the new bounding volume may include: performing intersection detection on the candidate hair model and the new bounding volume. During the intersection detection, the accuracy of the intersection detection may be adjusted to accurately detect the intersection portion of the hair model and the hat model.
[0133] Among them, based on the distance between the new target model vertex of the candidate hair model in the new intersection area and the hat model, the new model vertex is controlled to shrink toward the hat model. The shrinkage processing method of the target model vertex can be used as mentioned above, which will not be elaborated here.
[0134] In the present application, the hair model can be iterated and fine-tuned multiple times to achieve the best matching effect between the hair model and the hat model.
[0135] For example, see Fig. 9 , Fig. 9 A schematic diagram of an application scenario of another hair model processing method provided in an embodiment of the present application. Fig. 9 The left side shows the combination effect of the initial hat model and the hair model, where the hair model is interspersed with the hat model; after processing the hat model based on this scheme, the combination effect of the target hair model and the hat model shown on the right side is obtained, wherein the hair model is not interspersed with the hat model.
[0136] The embodiment of the present application discloses a method for processing a hair model, the method comprising: obtaining a hair model and a hat model; generating a bounding volume based on the hat model; determining the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area; based on the distance between the target model vertex and the target position, controlling the target model vertex to shrink toward the hat model to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model. In the above manner, the hair model and the hat model can be adapted by only adjusting the model vertices of the through-molding part of the hair model, thereby reducing the workload and improving the processing efficiency of the hair model.
[0137] In order to better implement the hair model processing method provided in the embodiment of the present application, the embodiment of the present application also provides a hair model processing device based on the hair model processing method. The meanings of the terms are the same as those in the hair model processing method, and the specific implementation details can refer to the description in the method embodiment.
[0138] See also Fig.10 , Fig.10 A structural block diagram of a hair model processing device provided in an embodiment of the present application, the device comprising:
[0139] An acquisition unit 301 is used to acquire a hair model and a hat model;
[0140] A generating unit 302, configured to generate a bounding volume based on the hat model;
[0141] A first determining unit 303 is used to determine an intersection area between the hair model and the bounding volume, and a target model vertex of the hair model in the intersection area;
[0142] The control unit 304 is used to control the vertices of the target model to shrink toward the hat model based on the distance between the vertices of the target model and the target position, so as to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
[0143] In some embodiments, the target position is the center line of the hat model; the control unit 304 may include:
[0144] A first determining subunit, used to determine the shortest distance between each target model vertex and the center line of the hat model;
[0145] The first control subunit is used to obtain a preset scaling parameter, and control the vertices of the target model to shrink toward the center line based on the preset scaling parameter and the closest distance to obtain the target hair model.
[0146] In some embodiments, the first determining subunit may be specifically used for:
[0147] Acquire first position information of the vertices of the target model and second position information of the center line;
[0148] Based on the first position information and the second position information, calculating the projection length of the vertex of the target model on the center line;
[0149] Determine a projection point of the vertex of the target model on the center line based on the projection length;
[0150] The distance between the vertex of the target model and the projection point is calculated to obtain the shortest distance.
[0151] In some embodiments, the control unit 304 may include:
[0152] a second control subunit, configured to control the vertices of the target model to shrink toward the hat model based on the distance between the vertices of the target model and a target position, so as to determine a candidate hair model, wherein the target position is a position determined based on the hat model;
[0153] A second determination subunit, configured to determine whether the candidate hair model is interspersed with the hat model;
[0154] The third determining subunit is configured to use the candidate hair model as the target hair model if the candidate hair model is not interspersed with the hat model.
[0155] In some embodiments, the apparatus may further include:
[0156] a second determining unit, configured to generate a new bounding volume based on the hat model if the candidate hair model intersects the hat model, and determine a new intersection area between the candidate hair model and the new bounding volume;
[0157] The third determination unit is used to control the new model vertices to shrink toward the hat model based on the distance between the new target model vertices of the candidate hair model in the new intersection area and the hat model, so as to obtain a new candidate hair model, until the new candidate hair model does not penetrate the hat model, so as to obtain the target hat model.
[0158] In some embodiments, the generating unit 302 may include:
[0159] An extraction subunit, used for extracting the bottom surface geometry of the hat model;
[0160] The generating subunit is used to obtain a preset height parameter, and generate the bounding volume based on the preset height parameter and the bottom surface geometry.
[0161] In some embodiments, the generating subunit may be specifically used for:
[0162] Determine the contour edge of the bottom surface geometric body;
[0163] Extending the contour edge in a direction away from the center of the bottom surface geometric body to obtain a new bottom surface geometric body;
[0164] determining a first direction perpendicular to the new bottom geometry;
[0165] Based on the first direction and the preset height parameter, the new bottom surface geometric body is extruded to obtain the bounding volume.
[0166] In some embodiments, the first determining unit 303 may include:
[0167] a detection subunit, configured to perform intersection detection on the bounding volume and the hair model, determine an overlapping portion of the bounding volume and the hair model, and obtain the intersection area;
[0168] The fourth determining subunit is used to determine, from all the model vertices of the hair model, a model vertex in the intersection area as the target model vertex.
[0169] The embodiment of the present application discloses a processing device for a hair model, wherein an acquisition unit 301 acquires a hair model and a hat model; a generation unit 302 generates a bounding volume based on the hat model; a first determination unit 303 determines the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area; a control unit 304 controls the target model vertices to shrink toward the hat model based on the distance between the target model vertices and the target position, to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model. In this way, the processing efficiency of the hair model can be improved.
[0170] Accordingly, the embodiment of the present application also provides a computer device, which may be a terminal. Fig.11 As shown, Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored in the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. It will be understood by those skilled in the art that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0171] The processor 501 is the control center of the computer device 500. It uses various interfaces and lines to connect the various parts of the entire computer device 500, executes various functions of the computer device 500 and processes data by running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, thereby monitoring the computer device 500 as a whole.
[0172] In the embodiment of the present application, the processor 501 in the computer device 500 will load instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:
[0173] Get the hair model and hat model;
[0174] Generate a bounding volume based on the hat model;
[0175] Determine the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area;
[0176] Based on the distance between the vertices of the target model and the target position, the vertices of the target model are controlled to shrink toward the hat model to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
[0177] The embodiment of the present application obtains a hair model and a hat model; generates a bounding volume based on the hat model; determines the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area; and controls the target model vertices to shrink toward the hat model based on the distance between the target model vertices and the target position, thereby obtaining a target hair model adapted to the hat model. In the above manner, wherein the target position is a position determined based on the hat model, only the model vertices of the through-molding part of the hair model need to be adjusted to adapt the hair model to the hat model, thereby reducing the workload and improving the processing efficiency of the hair model.
[0178] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0179] Optional, such as Fig.11 As shown, the computer device 500 further includes: a touch screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art can understand that Fig.11 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0180] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, and these graphical user interfaces may be composed of graphics, guide information, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 501, and can receive the command sent by the processor 501 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event, and then the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to realize the input and output functions. However, in some embodiments, the touch panel and the display panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to realize the input function.
[0181] The radio frequency circuit 504 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.
[0182] The audio circuit 505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 505 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and converted into audio data, and then the audio data is output to the processor 501 for processing, and then sent to another computer device through the radio frequency circuit 504, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between an external headset and the computer device.
[0183] The input unit 506 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0184] The power supply 507 is used to supply power to various components of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 507 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0185] although Fig.11 Not shown, the computer device 500 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0186] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0187] As can be seen from the above, the computer device provided in this embodiment can obtain a hair model and a hat model; generate a bounding volume based on the hat model; determine the intersection area of the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area; based on the distance between the target model vertex and the target position, control the target model vertex to shrink toward the hat model to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
[0188] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0189] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any hair model processing method provided in the embodiment of the present application. For example, the computer program can execute the following steps:
[0190] Get the hair model and hat model;
[0191] Generate a bounding volume based on the hat model;
[0192] Determine the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area;
[0193] Based on the distance between the vertices of the target model and the target position, the vertices of the target model are controlled to shrink toward the hat model to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
[0194] The embodiment of the present application obtains a hair model and a hat model; generates a bounding volume based on the hat model; determines the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area; based on the distance between the target model vertex and the target position, controls the target model vertex to shrink toward the hat model, and obtains a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model. In the above manner, only the model vertices of the through-molding part of the hair model need to be adjusted to adapt the hair model to the hat model, thereby reducing the workload and improving the processing efficiency of the hair model.
[0195] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0196] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0197] Since the computer program stored in the computer-readable storage medium can execute the steps in any one of the hair model processing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the hair model processing methods provided in the embodiments of the present application can be achieved. For details, please refer to the previous embodiments and will not be repeated here.
[0198] The above is a detailed introduction to a hair model processing method, device, storage medium and computer device provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there may be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A method for processing a hair model, characterized in that: The method comprises: Get the hair model and hat model; Generate a bounding volume based on the hat model; Determine an intersection area between the hair model and the bounding volume, and a target model vertex of the hair model in the intersection area; Based on the distance between the vertices of the target model and the target position, the vertices of the target model are controlled to shrink toward the hat model to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
2. The method according to claim 1, characterized in that: The target position is the center line of the hat model; The step of controlling the target model vertices to shrink toward the hat model based on the distance between the target model vertices and the target position to obtain a target hair model adapted to the hat model includes: Determine the shortest distance between each target model vertex and the center line of the hat model; A preset scaling parameter is obtained, and based on the preset scaling parameter and the closest distance, the vertices of the target model are controlled to shrink toward the center line to obtain the target hair model.
3. The method according to claim 2, characterized in that The determining the shortest distance between each target model vertex and the center line of the hat model includes: Acquire first position information of the vertices of the target model and second position information of the center line; Based on the first position information and the second position information, calculating the projection length of the vertex of the target model on the center line; Determine a projection point of the vertex of the target model on the center line based on the projection length; The distance between the vertex of the target model and the projection point is calculated to obtain the shortest distance.
4. The method according to claim 1, characterized in that: The step of controlling the target model vertices to shrink toward the hat model based on the distance between the target model vertices and the target position to obtain a target hair model adapted to the hat model includes: Based on the distance between the vertex of the target model and the target position, controlling the vertex of the target model to shrink toward the hat model to determine a candidate hair model; determining whether the candidate hair model is interspersed with the hat model; If the candidate hair model is not interspersed with the hat model, the candidate hair model is used as the target hair model.
5. The method according to claim 4, characterized in that The method further comprises: If the candidate hair model intersects the hat model, generating a new bounding volume based on the hat model, and determining a new intersection area between the candidate hair model and the new bounding volume; Based on the distance between the new target model vertex of the candidate hair model in the new intersection area and the hat model, the new model vertex is controlled to shrink toward the hat model to obtain a new candidate hair model, until the new candidate hair model does not intersperse the hat model, thereby obtaining the target hat model.
6. The method according to claim 1, characterized in that The step of generating a bounding volume based on the hat model includes: Extracting the bottom surface geometry of the hat model; A preset height parameter is obtained, and the bounding volume is generated based on the preset height parameter and the bottom surface geometry.
7. The method according to claim 6, characterized in that The step of generating the bounding volume based on the preset height sampling parameters and the bottom surface geometry includes: Determine the contour edge of the bottom surface geometric body; Extending the contour edge in a direction away from the center of the bottom surface geometric body to obtain a new bottom surface geometric body; determining a first direction perpendicular to the new bottom geometry; Based on the first direction and the preset height parameter, the new bottom surface geometric body is extruded to obtain the bounding volume.
8. The method according to claim 1, characterized in that: The determining the intersection area between the hair model and the bounding volume, and the target model vertices of the hair model in the intersection area, comprises: Performing intersection detection on the bounding volume and the hair model to determine an overlapping portion of the bounding volume and the hair model to obtain the intersection area; From all the model vertices of the hair model, a model vertex in the intersection area is determined as the target model vertex.
9. A hair model processing device, characterized in that: The device comprises: An acquisition unit, used for acquiring a hair model and a hat model; A generating unit, configured to generate a bounding volume based on the hat model; A first determining unit, configured to determine an intersection area between the hair model and the bounding volume, and a target model vertex of the hair model in the intersection area; A control unit is used to control the vertices of the target model to shrink toward the hat model based on the distance between the vertices of the target model and the target position, so as to obtain a target hair model adapted to the hat model, wherein the target position is a position determined based on the hat model.
10. A computer device comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein: When the processor executes the program, the hair model processing method according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the hair model processing method according to any one of claims 1 to 8.