Methods, apparatuses, electronic devices, and storage media for processing hair face sheets
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-03-07
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, the automatic UV mapping achieved through DDC software results in poor UV effects for hair models, requiring artists to spend a significant amount of time manually adjusting them to meet requirements.
By acquiring multiple facets of the hair model, determining the initial edges and sorting the vertices, and adjusting the final coordinate values of the vertices in the UV coordinate system based on the vertex index and the original coordinate values in the UV coordinate system, each hair facet is made to appear as a rectangle.
It improved the UV separation effect, reduced the time cost for artists to manually adjust, and met the UV requirements of the hair model.
Smart Images

Figure CN116228953B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of three-dimensional modeling technology, and in particular to a method, apparatus, electronic device, and storage medium for processing hair facets. Background Technology
[0002] In games, real-time rendered hair is generally not modeled directly as a realistic hair model due to performance limitations. Instead, hair patches are created, hair textures are drawn on the patches, and then patch inserts are used to create a complete hair model.
[0003] Generally speaking, realistic games require a high number of hair facets. The art production process can be to first create a hair model, then divide the hair model facets into UVs (that is, adjust the UV coordinate axis of the facets so that the hair facets appear as rectangles on the UV coordinate axis), and finally align and unfold the hair model on the drawn hair texture.
[0004] If it is necessary to further improve the texture of the hair model, new textures or models may be introduced. This requires re-UVing the hair model's faces, and re-splitting each UV is a time-consuming task.
[0005] Existing technologies can achieve automatic UV mapping using DDC (Digital Content Creation) software. However, the aforementioned method of achieving automatic UV mapping using DDC software generally suffers from poor UV mapping results, requiring artists to spend a significant amount of time manually adjusting the UVs to meet the requirements of the hair model. Summary of the Invention
[0006] In view of this, the purpose of the present invention is to provide a method, apparatus, electronic device and storage medium for processing hair patches, so as to improve the UV separation effect, reduce the time cost of manual adjustment by artists, and thus meet the UV requirements of hair models.
[0007] In a first aspect, embodiments of the present invention provide a method for processing hair patches, the method comprising: acquiring a hair model and determining multiple hair patches of the hair model; determining an initial edge of the hair patch based on the coordinates of each vertex of the hair patch; sorting each vertex of the hair patch starting from the vertex of the initial edge to obtain the sequence number of each vertex; and determining the final coordinate value of each vertex in the UV coordinate system based on the sequence number of each vertex and the original coordinate value of each vertex in the UV coordinate system.
[0008] Secondly, embodiments of the present invention also provide a hair patch processing apparatus, the apparatus comprising: a hair patch determination module, used to acquire a hair model and determine multiple hair patches of the hair model; an initial edge determination module, used to determine the initial edge of the hair patch based on the coordinates of each vertex of the hair patch; a vertex sorting module, used to sort each vertex of the hair patch starting from the vertex of the initial edge to obtain the sequence number of each vertex; and a UV coordinate adjustment module, used to determine the final coordinate value of each vertex in the UV coordinate system based on the sequence number of each vertex and the original coordinate value of each vertex in the UV coordinate system.
[0009] Thirdly, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the above-described hair patch processing method.
[0010] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the above-described hair patch processing method.
[0011] The embodiments of the present invention bring the following beneficial effects:
[0012] This invention provides a method, apparatus, electronic device, and storage medium for processing hair patches. It determines the initial edges of the hair patch based on the coordinates of each vertex, sorts the vertices of the hair patch starting from the initial edges, and determines the final coordinates of each vertex in the UV coordinate system based on the vertex number and the original coordinates of each vertex. Therefore, after adjusting the coordinates in the UV coordinate system, each hair patch can be presented as a rectangle, improving the UV separation effect, reducing the time cost of manual adjustments by artists, and thus meeting the UV requirements of the hair model.
[0013] Other features and advantages of this disclosure will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.
[0014] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0015] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0016] Figure 1 A flowchart illustrating a method for processing hair patches according to an embodiment of the present invention;
[0017] Figure 2 A schematic diagram of a hair patch provided in an embodiment of the present invention;
[0018] Figure 3 A schematic diagram of sorted hair patches provided in an embodiment of the present invention;
[0019] Figure 4 A schematic diagram of a straightened hair sheet provided in an embodiment of the present invention;
[0020] Figure 5 A flowchart illustrating another method for processing hair patches provided in an embodiment of the present invention;
[0021] Figure 6 A schematic diagram of another straightened hair sheet provided in an embodiment of the present invention;
[0022] Figure 7 A schematic diagram of a hair processing device provided in an embodiment of the present invention;
[0023] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] In games, real-time rendered hair is generally not modeled directly as a realistic hair model due to performance limitations. Instead, hair patches are created, hair textures are drawn on these patches, and then patch inserts are used to create a complete hair model. Generally, realistic games require a high number of hair patch inserts. The art production workflow typically involves first creating the hair model, then UV mapping the hair model's patches, and finally aligning and unfolding the hair model onto the drawn hair textures. If further enhancements to the hair model's texture are needed, new textures or models may be introduced, requiring a re-UV mapping of the hair model's patches. Re-decomposing each UV is a time-consuming process.
[0026] In existing technologies, automatic UV mapping can be achieved using DDC software such as 3ds Max, Maya, and Houdini. The principles of automatic UV mapping in various DCC software are similar. Here, we will take the automatic UV mapping tools in Maya and Houdini as examples.
[0027] (1) UV Projections: Projection methods. Generally speaking, projection methods refer to converting the coordinates of points in 3D space into 2D texture coordinates. Traditional projection methods include: spherical projection, cylindrical projection, planar projection, and cube projection (multiple planar projections).
[0028] For example, spherical projection projects the points of a model onto an assumed sphere; similarly, planar projection, like X-rays, projects 3D points onto a plane.
[0029] After UV projections are split, issues such as seams and messy UVs may arise. Due to the simplicity of the surface to be projected onto, they may not meet the requirements for direct use. Generally, artists will manually adjust the UVs to achieve a uniform and usable state.
[0030] (2) UV Unwarp: The model's seam is used as the baseline for UV unwarping, and the baseline serves as a constraint on UV unwarping. In a cube model, cutting the top three edges will unfold the model surface onto a 2D plane.
[0031] After UV unwarping, the UVs still need to be manually adjusted by the artists. Because the algorithm unfolds and stretches the UVs based on the seams, there may be situations where UVs break and need to be stitched together. The edges of curves also need to be manually straightened by the artists afterward.
[0032] (3) UV Flatten: A method node in Houdini that automatically flattens UVs, which "flattens" the model in 3D space into 2D texture space.
[0033] After UV flattening, the shape of the UVs is almost similar to the shape of the facet in three-dimensional space, which cannot meet the horizontal and vertical UVs required for hair models.
[0034] (4) UV Straighten: UV straightening is usually done manually by artists. Select a UV edge and straighten it.
[0035] After UV Straighten is applied, artists need to manually select each side. For realistic hair, there are thousands of planes, and artists need to manually straighten each plane, which is a huge workload.
[0036] In summary, the above-mentioned methods of achieving automatic UV separation using DDC software generally suffer from poor UV separation results, requiring artists to spend a significant amount of time manually adjusting the UV settings to meet the requirements of the hair model.
[0037] Based on this, the hair patch processing method, apparatus, electronic device and storage medium provided in the embodiments of the present invention can improve the UV separation effect, reduce the time cost of manual adjustment by artists, and thus meet the UV requirements of hair models.
[0038] To facilitate understanding of this embodiment, a method for processing hair face sheets disclosed in this embodiment of the invention will first be described in detail.
[0039] This embodiment provides a method for processing hair patches, and the following concepts are involved in this embodiment:
[0040] (1) 3D Model: The mathematical representation of an object's surface in three dimensions. Texture: A set of pixels projected onto a 3D model in real-time rendering. UV: Defines the texture pixel coordinates of a 3D model's surface, with a value range of [0,1]. Vertex: A point in 3D space containing information about the normal direction, texture coordinates, and other mesh properties. Shader: A program running on the graphics card that performs pixel-by-pixel calculations on the applied object. Patch: Geometric vertices combined into patches (line segments or polygons composed of points). For Loop: A loop statement in a programming language that allows writing a loop control structure that executes a specified number of times. Index: An index that is unique. It is a single value in a set of data.
[0041] (2) Hair facets: In real-time rendering, artists usually make hair facets into rectangular facets. Due to the styling requirements of the hair itself, the rectangular facets are usually made into various curved shapes.
[0042] (3) Hair rendering: Anisotropic rendering. Hair rendering has certain special characteristics compared with the rendering of general objects. The highlights present a "ring of angels". Taking the most common and simple Kajiya-Kay rendering model as an example, it requires that the UVs be flat and that the model be placed from the root to the end of the hair according to the scene.
[0043] (4) UV splitting: also known as UV splitting. Due to the special nature of hair rendering, it is generally required that the UV of hair be split into relatively regular, even-edged, and straight UV frames.
[0044] (5) Houdini attributes: In Houdini software, data can be stored in nodes such as “Point”, “Vertice”, “Primitive”, and “Details” of the model, which correspond to the information stored at the point, the information on the fragment, and the information on the model, respectively.
[0045] A 3D model is composed of vertices, and information can be stored on each vertex, such as UV coordinates, normals, and world space coordinates. Each vertex has a unique index, also called a point number, which is a unique identifier for each vertex. Various information about a vertex can be extracted using its point number.
[0046] Based on the above description, see Figure 1 The flowchart shown illustrates a method for processing a hair patch, which includes the following steps:
[0047] Step S102: Obtain the hair model and determine multiple hair facets of the hair model.
[0048] This embodiment can obtain a hair model and extract multiple facets from the hair model, each facet including multiple vertices.
[0049] Step S104: Determine the initial edges of the hair face based on the coordinates of each vertex of the hair face.
[0050] See Figure 2 The diagram shows a hair-shaped facet. It can be seen that the facet includes multiple vertices, and the facets can be randomly ordered when determining their positions. Figure 2 The numbers in the graph represent the randomly ordered vertices. A line connecting all vertices forms an edge. In this embodiment, an edge can include multiple vertices. An edge can be a straight line or a curve, and each edge can include as many vertices as possible. For example, the line connecting vertices 2 and 3 can be an edge, as can the line connecting vertices 2, 6, 5, 1, 4, and 10.
[0051] In this embodiment, one edge can be determined from the above edges as the initial edge. In this embodiment, the hair patch is generally a quadrilateral patch, that is, the hair patch includes 4 endpoints ( Figure 2 In this embodiment, the initial edge can be any two of the four endpoints mentioned above, for example: (vertices 2, 3, 8, and 10). Figure 2 The lines connecting vertices 2 and 3, vertices 8 and 10, vertices 2, 6, 5, 1, and 4, and vertices 3, 11, 12, 7, 9, and 8 can all be used as initial edges.
[0052] Step S106: Sort the vertices of the hair face starting from the vertices of the initial edge to obtain the sequence number of each vertex.
[0053] After determining the initial edge, the vertices can be reordered. The specific sorting method is as follows: start sorting from the initial edge, and sort the other edges in the same order as the initial edge.
[0054] First, let's define the concept of "other edges." Other edges can be understood as edges that do not intersect with each other and also do not intersect with the initial edge. That is, the vertices included in each other edge are not the same, and the vertices included in each other edge are not the same as those included in the initial edge.
[0055] For example, such as Figure 2 As shown, if the line connecting vertices 2 and 3 is taken as the initial edge, the lines connecting vertices 6 and 11, 5 and 12, 1 and 7, 5 and 9, and 10 and 8 can all be taken as other edges.
[0056] After determining the initial edges and other edges, they can be sorted in the same order. The sorting order is from top to bottom, and can be found in [reference needed]. Figure 3 The diagram shows a sorted hair facet, resulting in a hair facet with vertices sorted. (Example:) Figure 3 As shown, the sorted vertex numbers exhibit a strong regularity: the vertices of the upper curve edges are all even numbers from 0 to 10, while the vertices of the lower curve edges are all odd numbers from 1 to 11. Therefore, subsequent adjustments to the UV coordinate system values can be made.
[0057] Step S108: Based on the index of each vertex and the original coordinate values of each vertex in the UV coordinate system, determine the final coordinate values of each vertex in the UV coordinate system.
[0058] After reordering the vertices, this embodiment can adjust the coordinate values of each vertex in the UV coordinate system. First, the original coordinate values of each vertex in the UV coordinate system can be obtained. Based on the regularity of the sorted vertices, each vertex can be processed systematically: by averaging the UV coordinate values in the UV coordinate system using the sequence number of the sorted vertices, the UV coordinates can be straightened.
[0059] In this embodiment, the purpose of adjusting the coordinate values is to obtain a rectangular facet in the UV coordinate system. Since the sorted vertex numbers exhibit a strong regularity, the required vertices can be selected based on this regularity for processing to obtain the rectangular facet.
[0060] For example, in this embodiment, the X-axis or Y-axis of the initial edge and all other edges can be straightened first, and then the other coordinate axis of the initial edge and all other edges can be straightened. See also Figure 4 The diagram shows a straightened hair sheet. The straightened hair sheet is rectangular. The X-axis coordinates of vertices 0 and 1 are the same, the X-axis coordinates of vertices 2 and 3 are the same, the X-axis coordinates of vertices 4 and 5 are the same, the X-axis coordinates of vertices 6 and 7 are the same, the X-axis coordinates of vertices 8 and 9 are the same, and the X-axis coordinates of vertices 10 and 11 are the same. The Y-axis coordinates of vertices 0, 2, 4, 6, 8, and 10 are the same, and the Y-axis coordinates of vertices 1, 3, 5, 7, 9, and 11 are the same.
[0061] In this embodiment, the same hair facet processing method described above can be applied to all hair facets of the hair model using the for each node (equivalent to a for loop) in the Houdini software, and each hair facet can be presented as a rectangle.
[0062] This invention provides a method for processing hair facets. The initial edges of the hair facet are determined based on the coordinates of its vertices. Starting from the vertices of the initial edges, the vertices of the hair facet are sorted. Based on the vertex number and the original coordinates of each vertex in the UV coordinate system, the final coordinates of each vertex in the UV coordinate system are determined. Therefore, after adjusting the coordinates in the UV coordinate system, each hair facet can be presented as a rectangle, improving the UV separation effect, reducing the time cost of manual adjustments by artists, and thus meeting the UV requirements of the hair model.
[0063] This embodiment provides another method for processing hair patches, which is implemented based on the above embodiment. See also Figure 5 The flowchart illustrates another method for processing hair patches. The hair patch processing method in this embodiment includes the following steps:
[0064] Step S502: Obtain the hair model and preprocess the hair model.
[0065] Specifically, in this embodiment, the hair model can be preprocessed in the following way, for example, by converting the hair model into a quadrilateral model.
[0066] In this embodiment, the hair model needs to be converted into a quadrilateral model, which refers to a facet containing multiple quadrilaterals. If the hair model is a triangular facet model, which refers to a facet containing multiple triangles, then the hair model needs to be preprocessed to convert it from a triangular facet model into a quadrilateral model.
[0067] Furthermore, if the distance between two vertices of the hair model is less than a preset vertex threshold, this embodiment can also merge the two vertices into one vertex. For two relatively close vertices, merging them into one vertex can reduce the computational load in subsequent processing and improve processing efficiency.
[0068] Step S504: Determine multiple hair faces of the hair model.
[0069] Step S506: Determine the initial edges of the hair face based on the coordinates of each vertex of the hair face.
[0070] Specifically, this embodiment can determine multiple first vertices of a hair patch; wherein, the first vertex is the endpoint of the polygon of the hair patch; determine the coordinate values of the multiple first vertices in the world coordinate system; take the first vertex with the largest or smallest coordinate value of a specified coordinate axis in the world coordinate system as the target first vertex; determine the initial edge of the hair patch based on the target first vertex; wherein, the initial edge includes the target first vertex.
[0071] If a vertex of a hair face is an endpoint of the polygon of the hair face, then this vertex can be the first vertex. Figure 2 For example, vertices 2, 8, 3, and 10 can all be used as the first vertex. Subsequently, in this embodiment, the first vertex with the largest or smallest coordinate value on a specified coordinate axis in the world coordinate system can be used as the target first vertex. Taking the first vertex with the largest Y-axis value as the target first vertex as an example, that is, taking the highest first vertex as the target first vertex... Figure 2 For example, vertex 3 is the first vertex of the target.
[0072] After this, the initial edge can be determined. One endpoint of the initial edge is the target first vertex, and the other vertex is another first vertex. Figure 2 Taking vertex 3 as the target first vertex as an example, the line connecting vertices 2 and 3 or the line connecting vertices 3, 11, 12, 7, 9, and 8 can be used as the initial edge.
[0073] Step S508: Sort the vertices of the hair face starting from the vertices of the initial edge to obtain the sequence number of each vertex.
[0074] Specifically, in this embodiment, multiple other edges of the hair facet besides the initial edge can be determined; the vertices of the initial edge and the vertices of the multiple other edges are ordered in sequence.
[0075] The other edges can be determined as follows: The non-intersecting edges of the hair face that do not intersect with the initial edge are identified as the other edges of the hair face. In other words, this embodiment can determine the non-intersecting edges as the other edges of the hair face from among the edges that do not intersect with the initial edge. Continuing with... Figure 2 Taking the line connecting vertices 2 and 3 as the initial edge, the lines connecting vertices 6 and 11, 5 and 12, 1 and 7, 5 and 9, and 10 and 8 can all be used as other edges.
[0076] It should be noted here that the initial edge and other edges do not constitute all the edges of the hair facet, such as... Figure 2 As shown, Figure 2 The lines connecting vertices 2, 6, 5, 1, and 4, and vertices 3, 11, 12, 7, 9, and 8, are neither initial edges nor any other edges. However, all vertices of the hair face belong to either an initial edge or another edge, and can only belong to one initial edge or another edge.
[0077] After determining the initial edge and other edges, this embodiment can sort them in the following ways: starting from the target first vertex of the initial edge, sort each vertex of the initial edge; determine the target other edges from multiple other edges in order of increasing distance from the initial edge; and sort each vertex of the target other edges.
[0078] In other words, the sorting principle in this embodiment can be simply summarized as follows: sort the initial edges first, then sort the other edges, with each edge maintaining the same sorting order. For example: Figure 2 For example, first assign the value 0 to vertex 3, then assign the value 1 to vertex 2, completing the initial edge sorting; then determine the other edge closest to the initial edge as the connection between vertices 11 and 6, assign the value 2 to vertex 11, then assign the value 4 to vertex 6, completing the sorting of the other edges, and so on, to obtain... Figure 3 The index of the vertex.
[0079] Step S510: Based on the sequence number of each vertex and the original coordinate values of each vertex in the UV coordinate system, determine the final coordinate values of each vertex in the UV coordinate system.
[0080] After completing the vertex sorting, this embodiment needs to adjust the original coordinate values of each vertex in the UV coordinate system. This embodiment can obtain the original coordinate values of each vertex using the UV Flatten node in Houdini software, and use these original coordinate values as the X and Y axes for UV processing. Specifically, this embodiment can adjust the original coordinate values of each vertex according to the coordinate axes, see steps A1-A2:
[0081] Step A1: For the first coordinate axis of the UV coordinate system, based on the original coordinate values of each vertex on the first coordinate axis in the UV coordinate system, determine the final coordinate values of each vertex on the first coordinate axis in the UV coordinate system.
[0082] Specifically, for any target edge of the hair patch, the average of the original coordinate values of the first coordinate axis of each vertex of the target edge is used as the final coordinate value of the first coordinate axis of each vertex of the target edge.
[0083] Taking the first coordinate axis as the X-axis as an example, the average of the original X-axis coordinates of each vertex of the initial edge or each of the other edges can be used as the final X-axis coordinates of the vertices of the initial edge of the hair patch. For example... Figure 3 As shown, the initial edge (the line connecting vertices 0 and 1) and other edges (the lines connecting vertices 2 and 3, 4 and 5, 6 and 7, 8 and 9, and 10 and 11) can be processed sequentially. For example, the average of the original X-axis coordinates of vertex 0 and vertex 1 can be used as the final X-axis coordinates of vertices 0 and 1.
[0084] By using the above method, we can ensure that the first coordinate axis of the vertices of the initial edge or all other edges is the same, and ensure that the adjusted hair facet is horizontal in the direction of the first coordinate axis, which can meet the UV requirements of the hair model.
[0085] Step A2: For the second coordinate axis of the UV coordinate system, based on the index of each vertex and the original coordinate values of each vertex on the second coordinate axis in the UV coordinate system, determine the final coordinate values of each vertex on the second coordinate axis in the UV coordinate system.
[0086] Specifically, the number of vertices included in the initial edge can be determined as a first value; target vertices are selected sequentially from the initial edge, and other vertices are determined from each other edge based on the index of the target vertex and the first value; the average of the original coordinate values of the target vertex in the second coordinate system and the original coordinate values of each other vertex in the second coordinate system is used as the final coordinate values of the second coordinate axis of the target vertex and each other vertex.
[0087] In this embodiment, the number of vertices included in the initial edge can be predetermined to be the same as the number of vertices included in other edges. The number of vertices included in the initial edge can be initially determined to be a first value N. See also... Figure 6 The diagram shows another type of straightened hair section, as shown below. Figure 6 As shown, in this embodiment, the line connecting vertices 0, 1, 2, and 3 can be used as the initial edge. The initial edge and other edges each consist of 4 vertices, so N=4.
[0088] like Figure 6 As shown, if the target vertex of the initial edge is selected as x (x=0, 1, 2, 3), the index of the target vertex can be increased by a multiple of N (4, 8, 12, 16, 20) to obtain the other vertices of each other edge. The selected target vertex and the other vertices are grouped together. For example, if x=0, the other vertices are vertices with indices 4, 8, 12, 16, and 20; if x=1, the other vertices are vertices with indices 5, 9, 13, 17, and 21, and so on.
[0089] For each target vertex and other vertices in a group, this embodiment can process them uniformly, that is, the average of the original coordinate values of the target vertex in the second coordinate system and the original coordinate values of all other vertices in the second coordinate system can be used as the final coordinate values of the second coordinate axis of the target vertex and all other vertices. Taking the second coordinate axis as the Y-axis as an example, the average of the original Y-axis coordinate values of each vertex in each group can be used as the final Y-axis coordinate values of each vertex in that group.
[0090] By using the above method, we can ensure that the second coordinate axis of the vertices of the initial edge or each other edge is the same, and ensure that the adjusted hair facet is also horizontal in the direction of the second coordinate axis, which can meet the UV requirements of the hair model.
[0091] In this embodiment of the invention, each hair face can be processed individually. Due to the special nature of the hair model, the coordinate values of each vertex in the UV coordinate system of each face can be determined. Then, UV processing is performed on each vertex of each face to improve the UV separation effect, reduce the time cost of manual adjustment by artists, and thus meet the UV requirements of the hair model.
[0092] For example, the same UV processing algorithm can be applied to N hair facets using the for each node (equivalent to a for loop) in the Houdini software, with the processing number being N times.
[0093] This embodiment can sort the vertices so that the vertex numbers change in a regular pattern. Based on the vertices with the regular numbering pattern, the UV coordinate values of each vertex can be read and regularly adjusted. After adjusting the UV coordinate values, each hair facet can be presented as a rectangle, which improves the UV separation effect and meets the UV requirements of the hair model.
[0094] This invention can also save artists time in manually adjusting UV boundaries. Generally, the method of this embodiment can automatically process hair planes. Processing and arranging hair planes for each hair model takes approximately 8 seconds, while traditional manual adjustments by artists would take about 1-2 days. Therefore, the method provided in this embodiment can reduce the time cost of manual adjustments by artists.
[0095] Corresponding to the above method embodiments, this invention provides a hair sheet processing apparatus, such as... Figure 7 The diagram shows a structural schematic of a hair processing device, which includes:
[0096] The hair patch determination module 71 is used to acquire a hair model and determine multiple hair patches of the hair model.
[0097] The initial edge determination module 72 is used to determine the initial edges of the hair face based on the coordinates of each vertex of the hair face.
[0098] Vertex sorting module 73 is used to sort the vertices of the hair face starting from the vertices of the initial edge to obtain the sequence number of each vertex;
[0099] The UV coordinate adjustment module 74 is used to determine the final coordinate values of each vertex in the UV coordinate system based on the vertex number and the original coordinate values of each vertex in the UV coordinate system.
[0100] This invention provides a hair patch processing device that determines the initial edge of the hair patch based on the coordinates of each vertex. Starting from the vertices of the initial edge, the vertices of the hair patch are sorted. Based on the vertex number and the original coordinate values of each vertex in the UV coordinate system, the final coordinate values of each vertex in the UV coordinate system are determined. Therefore, after adjusting the coordinate values in the UV coordinate system, each hair patch can be presented as a rectangle, improving the UV separation effect, reducing the time cost of manual adjustments by artists, and thus meeting the UV requirements of the hair model.
[0101] In one feasible implementation, the aforementioned initial edge determination module is used to determine multiple first vertices of a hair patch; wherein, the first vertex is the endpoint of the polygon of the hair patch; determine the coordinate values of the multiple first vertices in the world coordinate system; take the first vertex with the largest or smallest coordinate value on a specified coordinate axis in the world coordinate system as the target first vertex; and determine the initial edge of the hair patch based on the target first vertex; wherein, the initial edge includes the target first vertex.
[0102] In one feasible implementation, the vertex sorting module described above is used to determine multiple other edges of the hair face besides the initial edge; and to sort the vertices of the initial edge and the vertices of the multiple other edges in turn.
[0103] In one feasible implementation, the vertex sorting module is used to sort each vertex of the initial edge starting from the target first vertex of the initial edge; to determine the target other edges sequentially from multiple other edges in order of increasing distance from the initial edge; and to sort each vertex of the target other edges.
[0104] In one feasible implementation, the vertex sorting module described above is used to determine the non-intersecting edges of the hair face that do not intersect with the initial edge as the other edges of the hair face.
[0105] In one feasible implementation, the aforementioned UV coordinate adjustment module is used to take the average of the original coordinate values of the first coordinate axis of each vertex of the target edge as the final coordinate value of the first coordinate axis of each vertex of the target edge for any target edge of the hair patch.
[0106] In one feasible implementation, the aforementioned UV coordinate adjustment module is used to take the average of the original coordinate values of the first coordinate axis of each vertex of the initial edge or other edge of the hair patch as the final coordinate value of the first coordinate axis of the vertex of the initial edge of the hair patch.
[0107] In a feasible implementation, the number of vertices included in the initial edge is the same as the number of vertices included in other edges; the UV coordinate adjustment module is used to determine the number of vertices included in the initial edge as a first value; select target vertices sequentially from the initial edge, and determine other vertices from each other edge based on the index of the target vertex and the first value; and take the average of the original coordinate values of the target vertex in the second coordinate system and the original coordinate values of each other vertex in the second coordinate system as the final coordinate values of the second coordinate axes of the target vertex and each other vertex.
[0108] In one feasible implementation, the hair patch processing device further includes: a hair model preprocessing module for converting the hair model into a quadrilateral model;
[0109] In one feasible implementation, the hair model preprocessing module is further configured to merge two vertices into one vertex if the distance between two vertices of the hair model is less than a preset vertex threshold.
[0110] The hair sheet processing apparatus provided in this embodiment of the invention has the same technical features as the hair sheet processing method provided in the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.
[0111] This invention also provides an electronic device for running the above-described hair patch processing method; see [link to previous document]. Figure 8 The diagram shows the structure of an electronic device, which includes a memory 100 and a processor 101. The memory 100 stores one or more computer instructions, which are executed by the processor 101 to perform the following steps:
[0112] Obtain the hair model and determine multiple hair patches of the hair model; determine the initial edge of the hair patch based on the coordinates of each vertex of the hair patch; sort the vertices of the hair patch starting from the vertices of the initial edge to obtain the index of each vertex; determine the final coordinate value of each vertex in the UV coordinate system based on the index of each vertex and the original coordinate value of each vertex in the UV coordinate system.
[0113] In an optional embodiment of the present invention, the above-mentioned determination of the initial edge of the hair patch based on the coordinates of each vertex of the hair patch includes: determining a plurality of first vertices of the hair patch; wherein, the first vertex is the endpoint of the polygon of the hair patch; determining the coordinate values of the plurality of first vertices in the world coordinate system; taking the first vertex with the largest or smallest coordinate value of a specified coordinate axis in the world coordinate system as the target first vertex; determining the initial edge of the hair patch based on the target first vertex; wherein, the initial edge includes the target first vertex.
[0114] In an optional embodiment of the present invention, the above-described sorting of the vertices of the hair face starting from the vertex of the initial edge includes: determining a plurality of other edges of the hair face besides the initial edge; and sorting the vertices of the initial edge and the vertices of the plurality of other edges in sequence.
[0115] In an optional embodiment of the present invention, the above-mentioned sorting of each vertex of the initial edge and each vertex of the plurality of other edges includes: sorting each vertex of the initial edge starting from the target first vertex of the initial edge; determining the target other edges sequentially from the plurality of other edges in order of increasing distance from the initial edge; and sorting each vertex of the target other edges.
[0116] In an optional embodiment of the present invention, the above-mentioned determination of each other edge of the hair patch includes: determining the non-intersecting edges of the hair patch that do not intersect with the initial edge as other edges of the hair patch.
[0117] In an optional embodiment of the present invention, the above-mentioned determination of the final coordinate value of each vertex in the UV coordinate system based on the index of each vertex and the original coordinate value of each vertex in the UV coordinate system includes: for any target edge of the hair patch, taking the average value of the original coordinate values of the first coordinate axis of each vertex of the target edge as the final coordinate value of the first coordinate axis of each vertex of the target edge.
[0118] In an optional embodiment of the present invention, the above-mentioned determination of the final coordinate value of the first coordinate axis of each vertex in the UV coordinate system based on the original coordinate value of each vertex in the UV coordinate system includes: for the initial edge or other edge of the hair patch, the average value of the original coordinate values of the first coordinate axis of each vertex of the edge is used as the final coordinate value of the first coordinate axis of the vertex of the initial edge of the hair patch.
[0119] In an optional embodiment of the present invention, the number of vertices included in the initial edge is the same as the number of vertices included in other edges; determining the final coordinate value of the second coordinate axis of each vertex in the UV coordinate system based on the index of each vertex and the original coordinate value of each vertex in the UV coordinate system includes: determining the number of vertices included in the initial edge as a first value; sequentially selecting target vertices from the initial edge, and determining other vertices from each other edge based on the index of the target vertex and the first value; taking the average of the original coordinate value of the target vertex in the second coordinate system and the original coordinate value of each other vertex in the second coordinate system as the final coordinate value of the second coordinate axis of the target vertex and each other vertex.
[0120] In an optional embodiment of the present invention, after obtaining the hair model, the method further includes: converting the hair model into a quadrilateral model.
[0121] In an optional embodiment of the present invention, after obtaining the hair model, the method further includes: if the distance between two vertices of the hair model is less than a preset vertex threshold, merging the two vertices into one vertex.
[0122] In this embodiment of the invention, the initial edges of the hair facet can be determined based on the coordinates of each vertex. Starting from the vertices of the initial edges, the vertices of the hair facet are sorted. Based on the vertex number and the original coordinate values of each vertex in the UV coordinate system, the final coordinate values of each vertex in the UV coordinate system are determined. Therefore, after adjusting the coordinate values in the UV coordinate system, each hair facet can be presented as a rectangle, which can improve the UV separation effect, reduce the time cost of manual adjustments by artists, and thus meet the UV requirements of the hair model.
[0123] Furthermore, Figure 8 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 101, the communication interface 103 and the memory 100 connected via the bus 102.
[0124] The memory 100 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 8 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0125] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. The processor 101 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The methods disclosed in the embodiments of this invention can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 100, and processor 101 reads information from memory 100 and, in conjunction with its hardware, completes the method of the aforementioned embodiments.
[0126] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these instructions are invoked and executed by a processor, they cause the processor to implement the aforementioned hair patch processing method, which can perform the following steps:
[0127] Obtain the hair model and determine multiple hair patches of the hair model; determine the initial edge of the hair patch based on the coordinates of each vertex of the hair patch; sort the vertices of the hair patch starting from the vertices of the initial edge to obtain the index of each vertex; determine the final coordinate value of each vertex in the UV coordinate system based on the index of each vertex and the original coordinate value of each vertex in the UV coordinate system.
[0128] In an optional embodiment of the present invention, the above-mentioned determination of the initial edge of the hair patch based on the coordinates of each vertex of the hair patch includes: determining a plurality of first vertices of the hair patch; wherein, the first vertex is the endpoint of the polygon of the hair patch; determining the coordinate values of the plurality of first vertices in the world coordinate system; taking the first vertex with the largest or smallest coordinate value of a specified coordinate axis in the world coordinate system as the target first vertex; determining the initial edge of the hair patch based on the target first vertex; wherein, the initial edge includes the target first vertex.
[0129] In an optional embodiment of the present invention, the above-described sorting of the vertices of the hair face starting from the vertex of the initial edge includes: determining a plurality of other edges of the hair face besides the initial edge; and sorting the vertices of the initial edge and the vertices of the plurality of other edges in sequence.
[0130] In an optional embodiment of the present invention, the above-mentioned sorting of each vertex of the initial edge and each vertex of the plurality of other edges includes: sorting each vertex of the initial edge starting from the target first vertex of the initial edge; determining the target other edges sequentially from the plurality of other edges in order of increasing distance from the initial edge; and sorting each vertex of the target other edges.
[0131] In an optional embodiment of the present invention, the above-mentioned determination of each other edge of the hair patch includes: determining the non-intersecting edges of the hair patch that do not intersect with the initial edge as other edges of the hair patch.
[0132] In an optional embodiment of the present invention, the above-mentioned determination of the final coordinate value of each vertex in the UV coordinate system based on the index of each vertex and the original coordinate value of each vertex in the UV coordinate system includes: for any target edge of the hair patch, taking the average value of the original coordinate values of the first coordinate axis of each vertex of the target edge as the final coordinate value of the first coordinate axis of each vertex of the target edge.
[0133] In an optional embodiment of the present invention, the above-mentioned determination of the final coordinate value of the first coordinate axis of each vertex in the UV coordinate system based on the original coordinate value of each vertex in the UV coordinate system includes: for the initial edge or other edge of the hair patch, the average value of the original coordinate values of the first coordinate axis of each vertex of the edge is used as the final coordinate value of the first coordinate axis of the vertex of the initial edge of the hair patch.
[0134] In an optional embodiment of the present invention, the number of vertices included in the initial edge is the same as the number of vertices included in other edges; determining the final coordinate value of the second coordinate axis of each vertex in the UV coordinate system based on the index of each vertex and the original coordinate value of each vertex in the UV coordinate system includes: determining the number of vertices included in the initial edge as a first value; sequentially selecting target vertices from the initial edge, and determining other vertices from each other edge based on the index of the target vertex and the first value; taking the average of the original coordinate value of the target vertex in the second coordinate system and the original coordinate value of each other vertex in the second coordinate system as the final coordinate value of the second coordinate axis of the target vertex and each other vertex.
[0135] In an optional embodiment of the present invention, after obtaining the hair model, the method further includes: converting the hair model into a quadrilateral model.
[0136] In an optional embodiment of the present invention, after obtaining the hair model, the method further includes: if the distance between two vertices of the hair model is less than a preset vertex threshold, merging the two vertices into one vertex.
[0137] In this embodiment of the invention, the initial edges of the hair facet can be determined based on the coordinates of each vertex. Starting from the vertices of the initial edges, the vertices of the hair facet are sorted. Based on the vertex number and the original coordinate values of each vertex in the UV coordinate system, the final coordinate values of each vertex in the UV coordinate system are determined. Therefore, after adjusting the coordinate values in the UV coordinate system, each hair facet can be presented as a rectangle, which can improve the UV separation effect, reduce the time cost of manual adjustments by artists, and thus meet the UV requirements of the hair model.
[0138] The computer program products of the hair patch processing method, apparatus, electronic device and storage medium provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0139] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and / or device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0140] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0141] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0142] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0143] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method of treating a hair panel, characterized by, The method includes: Obtain a hair model and determine multiple hair facets of the hair model; The initial edges of the hair patch are determined based on the coordinates of each vertex of the hair patch; Starting from the vertex of the initial edge, sort the vertices of the hair patch to obtain the sequence number of each vertex; For the first coordinate axis of the UV coordinate system, for any target edge of the hair patch, the average of the original coordinate values of the first coordinate axis of each vertex of the target edge is taken as the final coordinate value of the first coordinate axis of each vertex of the target edge. For the second coordinate axis of the UV coordinate system, the final coordinate value of each vertex in the UV coordinate system is determined based on the index of each vertex and the original coordinate value of each vertex in the second coordinate axis of the UV coordinate system.
2. The method of claim 1, wherein, Determining the initial edges of the hair patch based on the coordinates of each vertex includes: Determine a plurality of first vertices of the hair patch; wherein the first vertex is an endpoint of the polygon of the hair patch; Determine the coordinates of multiple first vertices in the world coordinate system; The first vertex with the largest or smallest coordinate value on a specified coordinate axis in the world coordinate system is taken as the target first vertex; The initial edges of the hair facet are determined based on the target first vertex; wherein the initial edges include the target first vertex.
3. The method according to claim 2, characterized in that, Starting from the vertex of the initial edge, sort the vertices of the hair patch, including: Determine multiple other edges of the hair patch besides the initial edge; The vertices of the initial edge and the vertices of the other edges are ordered sequentially.
4. The method according to claim 3, characterized in that, The vertices of the initial edge and the vertices of the other edges are ordered sequentially, including: Sort the vertices of the initial edge starting from the target first vertex of the initial edge; Target other edges are determined sequentially from multiple other edges in order of increasing distance from the initial edge; and the vertices of the target other edges are sorted.
5. The method according to claim 3, characterized in that, Determine the other edges of the hair patch, including: The edges of the hair face that do not intersect with each other and do not intersect with the initial edge are determined as the other edges of the hair face.
6. The method according to claim 1, characterized in that, The initial edge includes the same number of vertices as the other edges; based on the index of each vertex and the original coordinate values of the second coordinate axis of each vertex in the UV coordinate system, the final coordinate values of the second coordinate axis of each vertex in the UV coordinate system are determined, including: The number of vertices included in the initial edge is determined to be a first value; Select target vertices sequentially from the initial edges, and determine other vertices from each of the other edges based on the index of the target vertex and the first value; The average of the original coordinates of the target vertex in the second coordinate system and the original coordinates of the other vertices in the second coordinate system is taken as the final coordinates of the second coordinate axis of the target vertex and the other vertices.
7. The method according to claim 1, characterized in that, After obtaining the hair model, the method further includes: The hair model is converted into a quadrilateral model.
8. The method according to claim 1, characterized in that, After obtaining the hair model, the method further includes: If the distance between two vertices of the hair model is less than a preset vertex threshold, the two vertices are merged into one vertex.
9. A device for processing hair sheets, characterized in that, The device includes: The hair patch determination module is used to acquire a hair model and determine multiple hair patches of the hair model; An initial edge determination module is used to determine the initial edges of the hair face based on the coordinates of each vertex of the hair face. A vertex sorting module is used to sort the vertices of the hair face starting from the vertex of the initial edge, and obtain the sequence number of each vertex; The UV coordinate adjustment module is used to, for any target edge of the hair patch, take the average of the original coordinate values of the first coordinate axis of each vertex of the target edge as the final coordinate value of the first coordinate axis of each vertex of the target edge for the first coordinate axis of the UV coordinate system; and for the second coordinate axis of the UV coordinate system, determine the final coordinate value of the second coordinate axis of each vertex in the UV coordinate system based on the index of each vertex and the original coordinate value of each vertex in the second coordinate axis of the UV coordinate system.
10. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the hair sheet processing method according to any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the hair patch processing method according to any one of claims 1-8.