Model processing method and device and electronic equipment
Through automated bone generation and binding methods, the time-consuming and error problems in the binding process of hair model are solved, and more efficient and accurate animation display effects are achieved.
Patent Information
- Application Number
- CN202411595204.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-04-18
AI Technical Summary
In three-dimensional animation production, during the binding process of hair model, due to the large number of hairs and the curved shape, manually positioning the bones is very time-consuming and prone to errors, which affects the quality of the animation display.
By obtaining the hair model, the curve corresponding to the sub-model is determined based on the vertices of the sub-model is determined, the joint nodes of the bone are determined according to the curve, and bones can be generated that can match the curved morphology of the sub-model and bind them.
This method can generate more accurate bones, improve the animation display effect of the hair model, and enhance the user's viewing experience.
Smart Images

Figure CN119850798A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of virtual three-dimensional models, and in particular to a model processing method, device and electronic equipment. Background Art
[0002] In 3D animation production, model processing is an essential step. In the process of binding, the character model is usually associated with the skeleton system, so that the production staff can control the character's movement through the skeleton system. In the process of hair binding, the binder is usually required to manually create and position bones for each hair one by one. Due to the large number of hairs and their curved shapes, manual positioning of bones is very time-consuming and prone to errors. If the bone positioning is inaccurate, it will also affect the animation display quality, resulting in a poor viewing experience. Summary of the invention
[0003] In view of this, the purpose of the present disclosure is to provide a model processing method, device and electronic device to generate a skeleton that can more accurately match the curved shape of the sub-model. By controlling the dynamic effect of the hair model by controlling the skeleton, the animation display effect of the hair model can be improved, thereby enhancing the user's viewing experience.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for processing a model, the method comprising: obtaining a hair model; the hair model comprises multiple sub-models; the sub-model comprises multiple vertices; based on the vertices of the sub-model, determining a curve corresponding to the sub-model, and based on the curve corresponding to the sub-model, determining a joint node of a bone corresponding to the sub-model; the curve corresponds to a bending shape of the sub-model; based on the joint nodes of the bone corresponding to the sub-model, generating a bone corresponding to the sub-model, and binding the sub-model to the bone.
[0005] In a second aspect, an embodiment of the present disclosure provides a model processing device, which includes: a hair model acquisition module, used to acquire a hair model; the hair model includes multiple sub-models; the sub-model includes multiple vertices; a joint node determination module, used to determine the curve corresponding to the sub-model based on the vertices of the sub-model, and determine the joint nodes of the bone corresponding to the sub-model based on the curve corresponding to the sub-model; the curve corresponds to the bending shape of the sub-model; a model binding module, used to generate the bone corresponding to the sub-model based on the joint nodes of the bone corresponding to the sub-model, and bind the sub-model to the bone.
[0006] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model processing method.
[0007] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned model processing method.
[0008] The embodiments of the present invention bring the following beneficial effects:
[0009] The above-mentioned processing method, device and electronic device of a model obtains a hair model; the hair model includes multiple sub-models; the sub-model includes multiple vertices; based on the vertices of the sub-model, the curve corresponding to the sub-model is determined, and based on the curve corresponding to the sub-model, the joint nodes of the bone corresponding to the sub-model are determined; the curve corresponds to the bending shape of the sub-model; based on the joint nodes of the bone corresponding to the sub-model, the bone corresponding to the sub-model is generated, and the sub-model is bound to the bone. This method can generate a bone that can more accurately match the bending shape of the sub-model, and control the dynamic effect of the hair model by controlling the bone, thereby improving the animation display effect of the hair model and enhancing the user's viewing experience.
[0010] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A flowchart of a model processing method provided by an embodiment of the present disclosure;
[0014] Figure 2 A schematic diagram of a sub-model provided in an embodiment of the present disclosure;
[0015] Figure 3 A schematic diagram of another sub-model provided for an embodiment of the present disclosure;
[0016] Figure 4 A schematic diagram of another sub-model provided for an embodiment of the present disclosure;
[0017] Figure 5 A schematic diagram of a polygon formed by vertices provided in an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of the structure of a model processing device provided in an embodiment of the present disclosure;
[0019] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0021] In 3D animation production, character rigging is an essential step. Rigging involves associating the character model with the skeleton system so that the character can be animated. During the rigging process, hair rigging is particularly complex. Due to the large number of hair and its curved shape, manually positioning the bones is very time-consuming and prone to errors.
[0022] In the related art, during the hair binding process, the binder usually needs to manually create and position bones for each hair one by one. This method is not only time-consuming, but also prone to errors due to human operation, affecting the effect of hair animation.
[0023] In summary, the above hair binding technology has the following disadvantages: cumbersome manual operation and low efficiency; inaccurate bone positioning, affecting animation quality; difficult to adapt to complex hair shapes and large quantities. These disadvantages increase the workload and time cost of binding production.
[0024] Based on this, the embodiments of the present disclosure provide a model processing method, device, and electronic device, and the technology can be applied to scenarios where hair model binding is required.
[0025] See also Figure 1 First, a model processing method provided by an embodiment of the present invention is introduced. The method comprises the following steps:
[0026] Step S102, obtaining a hair model; the hair model includes a plurality of sub-models; the sub-model includes a plurality of vertices.
[0027] In order to simulate the real hair effect, the hair model usually includes multiple sub-models. The sub-model can be a patch model or a three-dimensional model similar to a cylinder (or cone). Unlike a cylinder, the center line of the sub-model is curved. The surface of the sub-model is usually connected by multiple polygons. The above polygons are usually triangles or quadrilaterals, or other shapes, which are set according to the needs and are not limited here. Adjacent polygons usually share two vertices and the edges formed by the two vertices.
[0028] Step S104, based on the vertices of the sub-model, determine the curve corresponding to the sub-model, and based on the curve corresponding to the sub-model, determine the joint nodes of the skeleton corresponding to the sub-model; the curve corresponds to the bending shape of the sub-model.
[0029] For each sub-model, the curve corresponding to the sub-model can be determined based on the vertices of the sub-model. In order to simulate hair, the sub-model usually has a certain extension, and the curve corresponding to the sub-model can correspond to the bending shape of the sub-model. The sub-model usually has a starting vertex and an ending vertex, which are used to simulate the root part and the end part of the hair respectively. Since there may be occlusion between the hair, the sub-model can also simulate the middle part of the hair through the model part corresponding to the starting vertex, which is not limited here.
[0030] The sub-model has an extension direction, extending from the model part simulating the hair root to the model part simulating the hair tip. Figure 2 As shown in , when the sub-model is a patch model, its extension direction is represented by a curve A with an arrow; Figure 3 As shown, when the sub-model is a model similar to a cylindrical shape, its extension direction is represented by a curve B with an arrow. Figure 2 and Figure 3 The figure only shows the polygons constituting the sub-model by way of example. In practice, the number of polygons constituting the sub-model is usually larger.
[0031] In order to show the display form of the sub-model, the extension direction of the curve is usually consistent with the extension direction of the sub-model. You need to select vertices in the sub-model as points on the curve, or determine the points in the curve based on the vertices of the sub-model. Figure 2 To zoom in locally Figure 4 As shown, Figure 4 a1, a2 and a3 in the figure are not vertices arranged along the extension direction of the sub-model, and their extension degrees can be considered the same. However, a1, b1 and c1 are vertices arranged along the extension direction of the sub-model, and their extension degrees increase in sequence. Similarly, a2, b2 and c2 are also vertices arranged along the extension direction of the sub-model, and a2, b3 and c3 are also vertices arranged along the extension direction of the sub-model.
[0032] It is worth noting that the starting vertices of the sub-model include o1, o2 and o3, and a1, a2 and a3 are connected to o1, o2 and o3 respectively through one edge of the polygon. And a1, b1, c1 are connected to o1 through one edge, two edges and three edges of the polygon respectively. It can be considered that the more edges a vertex passes through when connecting to the starting vertex, the greater the extension of the vertex. Since a1 can also be regarded as connected to o2 through a2, a1 and o2 also need to be connected through two edges, which will cause confusion. The extension of the vertex can be measured by the minimum number of edges connecting the vertex to the starting vertex. The minimum number of edges can be called the "minimum number of edges".
[0033] Since the extension direction of the curve is consistent with the extension direction of the sub-model, in order to express the display form of the sub-model through the curve, a vertex can be selected from the vertices with the same extension degree of the corresponding sub-model as the vertex on the curve. Selecting a vertex from each vertex corresponding to each extension degree will result in multiple vertices, which can be used as points on the curve to generate the curve. For example, a1, b1 and c1 can be selected as points on the curve, or a1, b2 and c3 can be selected as points on the curve.
[0034] In order to make the curve more accurately represent the display form of the sub-model, a point can also be determined based on multiple vertices corresponding to the same extension degree. For example, the position coordinates of multiple vertices are superimposed and then divided by the number of vertices. Then, a curve is generated based on multiple points determined by vertices corresponding to each extension degree.
[0035] When generating a curve based on multiple points, fitting, spline interpolation and other methods are usually used. The specific method can be selected according to the needs and is not limited here. It is further necessary to determine multiple joint nodes based on the generated curve. In specific implementation, the point on the curve where the curvature is greater than the specified value can be used as a joint node, and the above specified value can be adjusted according to the number of joint nodes required. It is usually also necessary to use the starting point and end point of the curve as joint nodes.
[0036] Step S106, based on the joint nodes of the skeleton corresponding to the sub-model, generate the skeleton corresponding to the sub-model, and bind the sub-model to the skeleton.
[0037] After determining multiple joint nodes, it is necessary to generate bones between the joint nodes. Since joint nodes are generated based on curves, the arrangement order between multiple joint nodes can be determined based on the extension direction of the curve. Then bones are generated between two adjacent joint nodes according to the arrangement order, and the driving relationship between the bones is also determined. Thus, the sub-model composed of the generated multiple bones corresponds to the bones.
[0038] After generating the bones corresponding to the sub-model, the sub-model needs to be bound to the bones, that is, the vertex positions of each vertex of the sub-model need to be determined according to the weights of each bone in the bones. The specific process will not be repeated here.
[0039] The processing method of the above-mentioned model obtains a hair model; the hair model includes multiple sub-models; the sub-model includes multiple vertices; based on the vertices of the sub-model, the curve corresponding to the sub-model is determined, and based on the curve corresponding to the sub-model, the joint nodes of the bone corresponding to the sub-model are determined; the curve corresponds to the bending shape of the sub-model; based on the joint nodes of the bone corresponding to the sub-model, the bone corresponding to the sub-model is generated, and the sub-model is bound to the bone. This method can generate a bone that can more accurately match the bending shape of the sub-model, and control the dynamic effect of the hair model by controlling the bone, thereby improving the animation display effect of the hair model and enhancing the user's viewing experience.
[0040] The following embodiment provides a specific method for determining a curve corresponding to a sub-model based on the vertices of the sub-model.
[0041] The sub-model has a model boundary. The sub-model is formed by connecting multiple polygons, and the polygons include multiple vertices. The model boundary is usually formed by the edges of the sub-model simulating the hair root part, such as Figure 4 The edges formed by connecting the three vertices o1, o2 and o3 in the model form the model boundary. In the process of determining the curve corresponding to the sub-model based on the vertices of the sub-model, it is necessary to divide the multiple vertices of the sub-model into multiple vertex combinations. Each vertex combination includes multiple vertices. The extension degree of the sub-model corresponding to each vertex combination is the same, that is, the minimum number of edges between the vertices in each vertex combination and the vertices in the model boundary of the sub-model are the same. Among them, the minimum number of edges is the number of edges of the least polygons that are passed along the vertex to reach the vertex in the model boundary. After determining the vertex combination, it is necessary to determine multiple target positions based on multiple vertex combinations, and then generate the curve corresponding to the sub-model based on the multiple target positions.
[0042] In the process of dividing the vertex combination, it is necessary to traverse multiple polygons of the sub-model to determine the model boundary of the sub-model; wherein the model boundary, also known as the boundary edge, generally refers to the edge at the boundary in a 3D model or mesh. Corresponding to the hair model, it is the edge of the model boundary that simulates the hair root or hair tip. Then, based on the vertices in the model boundary, the corresponding vertex combination is determined, that is, the vertices in the model boundary are combined into a vertex combination. Among the remaining vertices in the sub-model, the corresponding vertex combination is determined based on the vertices with the minimum number of edges between the vertices combined with the previous vertex being 1, that is, these vertices are combined into a vertex combination; then, among the remaining vertices in the sub-model, the corresponding vertex combination is determined based on the vertices with the minimum number of edges between the vertices combined with the previous vertex being 1, until all the vertices in the sub-model are divided into vertex combinations. There may be only one vertex in the part of the sub-model that simulates the hair root, and at this time, a corresponding vertex combination can be established for this vertex.
[0043] Then, for each vertex combination in the multiple vertex combinations, based on the positions of the multiple vertices in the vertex combination, the target position corresponding to the vertex combination can be determined; or some vertex combinations can be selected from the multiple vertex combinations, such as a vertex combination with a specified number, or a vertex combination with a corresponding minimum number of edges as the technique, and then for each vertex combination in this part of the vertex combinations, the target position corresponding to the vertex combination can be determined. When some vertex combinations are selected, the amount of calculation will be reduced, but the degree of conformity between the determined curve and the curvature of the sub-model will be reduced to a certain extent. The specific choice can be made according to the needs. . Usually, the target position is the geometric center of a polygon formed by multiple vertices, or the midpoint of a straight line formed by connecting multiple vertices. In practice, multiple vertices can usually form a polygon, such as Figure 5 As shown, a triangle can be formed at the top view angles a1, a2 and a3, and the center of the triangle can be determined as the sampling point corresponding to the vertex combination. Multiple vertices may also be connected to form a straight line, in which case the end point of the straight line can be determined as the sampling point corresponding to the vertex combination.
[0044] After the sampling points are determined, spline interpolation is performed based on multiple target positions to obtain a spline curve, and the spline curve is determined as the curve corresponding to the sub-model. Spline interpolation is a mathematical method that constructs a smooth curve through a series of shape value points.
[0045] The above sampling points can be regarded as control points of the curve. In order to reduce the amount of calculation, some sampling points can be selected from the multiple sampling points to generate the curve. The control points of the above curve can control the curvature of the curve. In practical applications, at least some of the multiple control points of the curve can be determined as joint nodes of the bones corresponding to the sub-model. That is, all control points can be used as joint nodes of the bones, or some control points can be selected as joint nodes of the bones, for example, one bone is determined every other control point.
[0046] The following embodiment provides a specific method for generating a skeleton corresponding to a sub-model based on the joint nodes of the skeleton corresponding to the sub-model.
[0047] As shown above, the above-mentioned joint nodes are determined based on multiple control points of the curve. The multiple control points have a preset order, and the arrangement order of the multiple joint nodes is determined based on the preset order. For example, if a1, b1 and c1 are all used as joint nodes, the arrangement order is a1->b1->c1. Based on the arrangement order of multiple joint nodes of the bones corresponding to the sub-model, adjacent joint nodes are determined. In the above example, the adjacent joint nodes are a1 and b1, and b1 and c1. Then, for any adjacent joint node, a bone connecting the adjacent joint nodes is generated, that is, multiple bones corresponding to the sub-model are determined.
[0048] The present disclosure also provides another model processing method. Figure 1 This method uses 3D computer graphics software as the basic tool, reads the model structure, generates curves based on the circular edge, and then generates bones based on the curves, aiming to solve the problems of low efficiency and poor accuracy of traditional manual hair binding technology, and quickly generates Maya hair bones through automated tools, thereby improving production efficiency and positioning accuracy.
[0049] The method specifically comprises the following steps:
[0050] 1. Read the model data and identify the circular edge of the hair part
[0051] In practical applications, tools of three-dimensional computer graphics software (such as Autodesk Maya) can be used to distinguish the types of the selected object and its sub-objects, and determine whether they are transform and shape types.
[0052] In Maya, each object usually has a transform node to store and operate these transformation attributes. The model object created in Maya contains the specific geometric data of the object, such as vertices, edges, faces, etc. Shape nodes can be different types of geometric shapes, such as NURBS curves, NURBS surfaces, polygonal meshes, etc.
[0053] In the shape type, further determine whether it is a polygon type. If it is a polygon type, record it in a list. Polygon is a commonly used geometric representation method, widely used in 3D modeling and computer graphics. Polygons are composed of vertices (Vertex), edges (Edge) and faces (Face), which define the shape and structure of a 3D object.
[0054] Traverse each polygon in this polygon list. Get the border edge of the polygon. In Autodesk Maya, "border edge" is a border edge. These border edges may be the outer contour edges of the model, or they may be boundaries formed by holes or unsealed areas in the model. Then, get the faces connected to the border edge, and then determine the edges connected to these faces, and get the vertices connected to the determined edges, and then add the vertices to a vertex ring list. Further search for edges connected to this vertex and not connected to the current face. If there is only one edge, recursively call this process to continue searching for edge rings. In this way, a complete vertex ring can be constructed through recursive search.
[0055] 2 Generate the corresponding curve
[0056] According to the identified circular edges of the hair part, traverse them, find the corresponding points, calculate the center positions of these points, and generate the corresponding NURBS curves.
[0057] 3 Generate bones based on curves
[0058] The skeleton is automatically generated according to the generated curve, and the joint points of the skeleton correspond to the control points on the curve. In the specific implementation, the code can be written based on this method to realize the automatic generation of the skeleton through the code.
[0059] This method generates hair skeletons through automated tools, reducing manual operation time and improving efficiency. In specific implementation, skeletons are generated according to curves to ensure the accuracy of skeleton positioning and reduce human errors. At the same time, the tool can handle large amounts of hair with complex shapes, can adapt to complex situations, and has strong adaptability.
[0060] For the above method embodiments, see Figure 6 A processing device for a model shown, the device comprising:
[0061] The hair model acquisition module 602 is used to acquire the hair model; the hair model includes multiple sub-models; the sub-model includes multiple vertices;
[0062] The joint node determination module 604 is used to determine the curve corresponding to the sub-model based on the vertices of the sub-model, and determine the joint nodes of the skeleton corresponding to the sub-model based on the curve corresponding to the sub-model; the curve corresponds to the bending shape of the sub-model;
[0063] The model binding module 606 is used to generate the skeleton corresponding to the sub-model based on the joint nodes of the skeleton corresponding to the sub-model, and bind the sub-model to the skeleton.
[0064] The processing device of the above-mentioned model obtains a hair model; the hair model includes multiple sub-models; the sub-model includes multiple vertices; based on the vertices of the sub-model, the curve corresponding to the sub-model is determined, and based on the curve corresponding to the sub-model, the joint nodes of the bone corresponding to the sub-model are determined; the curve corresponds to the bending shape of the sub-model; based on the joint nodes of the bone corresponding to the sub-model, the bone corresponding to the sub-model is generated, and the sub-model is bound to the bone. This method can generate a bone that can more accurately match the bending shape of the sub-model, and control the dynamic effect of the hair model by controlling the bone, thereby improving the animation display effect of the hair model and enhancing the user's viewing experience.
[0065] The above-mentioned sub-model has a model boundary; the sub-model is connected by multiple polygons, and the polygons include multiple vertices; the joint node determination module is also used to: divide the multiple vertices of the sub-model into multiple vertex combinations; each vertex combination includes multiple vertices; the minimum number of edges between the vertices in each vertex combination and the vertices in the model boundary of the sub-model are the same; the minimum number of edges is the number of edges of the polygons that are passed through the least along the vertex to reach the vertex in the model boundary; based on multiple vertex combinations, multiple target positions are determined; based on multiple target positions, a curve corresponding to the sub-model is generated.
[0066] The above-mentioned joint node determination module is also used to: traverse multiple polygons of the sub-model to determine the model boundary of the sub-model; determine the corresponding vertex combination based on the vertices in the model boundary; determine the corresponding vertex combination among the remaining vertices in the sub-model based on the vertices whose minimum number of edges between the vertices combined with the previous vertex is 1; continue to execute the steps of determining the corresponding vertex combination among the remaining vertices in the sub-model based on the vertices whose minimum number of edges between the vertices combined with the previous vertex is 1, until all vertices in the sub-model are divided into vertex combinations.
[0067] The above-mentioned joint node determination module is also used to: for each vertex combination in at least part of the vertex combinations in multiple vertex combinations, determine the target position corresponding to the vertex combination based on the positions of multiple vertices in the vertex combination; the target position is the geometric center of the polygon formed by multiple vertices, or the midpoint of the straight line formed by connecting multiple vertices.
[0068] The joint node determination module is also used to: perform spline interpolation based on multiple target positions to obtain a spline curve; and determine the spline curve as a curve corresponding to the sub-model.
[0069] The above curve has multiple control points; the control points are used to control the curvature of the curve; the joint node determination module is also used to: determine at least some of the multiple control points of the curve as joint nodes of the bones corresponding to the sub-model.
[0070] The joint nodes are determined based on multiple control points of the curve; the multiple control points have a preset order; the arrangement order of the multiple joint nodes is determined based on the preset order; the model binding module is also used to: determine the adjacent joint nodes based on the arrangement order of the multiple joint nodes of the bones corresponding to the sub-model; for any adjacent joint nodes, generate bones connecting the adjacent joint nodes.
[0071] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model processing method, for example:
[0072] Acquire a hair model; the hair model includes multiple sub-models; the sub-model includes multiple vertices; based on the vertices of the sub-model, determine the curve corresponding to the sub-model, and based on the curve corresponding to the sub-model, determine the joint nodes of the bone corresponding to the sub-model; the curve corresponds to the bending shape of the sub-model; based on the joint nodes of the bone corresponding to the sub-model, generate the bone corresponding to the sub-model, and bind the sub-model to the bone.
[0073] The above method can generate a skeleton that can more accurately match the bending shape of the sub-model. By controlling the skeleton to control the dynamic effect of the hair model, the animation display effect of the hair model is improved, and the user's viewing experience is enhanced.
[0074] Optionally, the above-mentioned sub-model has a model boundary; the sub-model is connected by multiple polygons, and the polygons include multiple vertices; based on the vertices of the sub-model, the step of determining the curve corresponding to the sub-model includes: dividing the multiple vertices of the sub-model into multiple vertex combinations; each vertex combination includes multiple vertices; the minimum number of edges between the vertices in each vertex combination and the vertices in the model boundary of the sub-model are the same; the minimum number of edges is the number of edges of the polygon with the least number of passes along the vertex to reach the vertex in the model boundary; based on multiple vertex combinations, multiple target positions are determined; based on the multiple target positions, the curve corresponding to the sub-model is generated.
[0075] Optionally, the above-mentioned step of dividing multiple vertices of the sub-model into multiple vertex combinations includes: traversing multiple polygons of the sub-model to determine the model boundary of the sub-model; determining the corresponding vertex combination based on the vertices in the model boundary; determining the corresponding vertex combination among the remaining vertices in the sub-model based on the vertices whose minimum number of edges between the vertices combined with the previous vertex is 1; continuing to execute the step of determining the corresponding vertex combination among the remaining vertices in the sub-model based on the vertices whose minimum number of edges between the vertices combined with the previous vertex is 1, until all vertices in the sub-model are divided into vertex combinations.
[0076] Optionally, the above step of determining multiple targets based on multiple vertex combinations includes: for each vertex combination in at least some of the multiple vertex combinations, based on the positions of multiple vertices in the vertex combination, determining the target position corresponding to the vertex combination; the target position is the geometric center of a polygon formed by multiple vertices, or the midpoint of a straight line formed by connecting multiple vertices.
[0077] Optionally, the step of generating a curve corresponding to the sub-model based on multiple target positions includes: performing spline interpolation based on the multiple target positions to obtain a spline curve; and determining the spline curve as the curve corresponding to the sub-model.
[0078] Optionally, the above-mentioned curve has multiple control points; the control points are used to control the degree of curvature of the curve; based on the curve corresponding to the sub-model, the step of determining the joint nodes of the bone corresponding to the sub-model includes: determining at least some of the multiple control points of the curve as the joint nodes of the bone corresponding to the sub-model.
[0079] Optionally, the joint nodes are determined based on multiple control points of the curve; the multiple control points have a preset order; the arrangement order of the multiple joint nodes is determined based on the preset order; based on the joint nodes of the bones corresponding to the sub-model, the step of generating the bones corresponding to the sub-model includes: determining adjacent joint nodes based on the arrangement order of the multiple joint nodes of the bones corresponding to the sub-model; for any adjacent joint nodes, generating bones connecting the adjacent joint nodes. Model boundary of sub-model Model boundary of sub-model Vertices in the model boundary
[0080] See also Figure 7 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine executable instructions that can be executed by the processor 100. The processor 100 executes the machine executable instructions to implement the above-mentioned model processing method.
[0081] Further, Figure 7 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0082] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0083] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 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 gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.
[0084] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the processing method of the above model.
[0085] A model processing method, device and electronic device provided in the embodiments of the present disclosure include a computer-readable storage medium storing program code, and the program code includes instructions that can be used to execute the methods described in the previous method embodiments, for example:
[0086] Acquire a hair model; the hair model includes multiple sub-models; the sub-model includes multiple vertices; based on the vertices of the sub-model, determine the curve corresponding to the sub-model, and based on the curve corresponding to the sub-model, determine the joint nodes of the bone corresponding to the sub-model; the curve corresponds to the bending shape of the sub-model; based on the joint nodes of the bone corresponding to the sub-model, generate the bone corresponding to the sub-model, and bind the sub-model to the bone.
[0087] The above method can generate a skeleton that can more accurately match the bending shape of the sub-model. By controlling the skeleton to control the dynamic effect of the hair model, the animation display effect of the hair model is improved, and the user's viewing experience is enhanced.
[0088] Optionally, the above-mentioned step of determining the curve corresponding to the sub-model based on the vertices of the sub-model includes: dividing multiple vertices of the sub-model into multiple vertex combinations; each vertex combination includes multiple vertices; the minimum number of edges between the vertices in each vertex combination and the vertices in the model boundary of the sub-model are the same; based on the multiple vertex combinations, determining multiple sampling points; based on the multiple sampling points, generating the curve corresponding to the sub-model.
[0089] Optionally, the above-mentioned step of dividing multiple vertices of the sub-model into multiple vertex combinations includes: traversing multiple polygons of the sub-model to determine the model boundary of the sub-model; determining the corresponding vertex combination based on the vertices in the model boundary; determining the corresponding vertex combination among the remaining vertices in the sub-model based on the vertices whose minimum number of edges between the vertices combined with the previous vertex is 1; continuing to execute the step of determining the corresponding vertex combination among the remaining vertices in the sub-model based on the vertices whose minimum number of edges between the vertices combined with the previous vertex is 1, until all vertices in the sub-model are divided into vertex combinations, or there is only one vertex in the sub-model that is not divided into the vertex combination.
[0090] Optionally, the above step of determining multiple sampling points based on multiple vertex combinations includes: for each vertex combination, based on the positions of the multiple vertices, determining the sampling point corresponding to the vertex combination; the sampling point is the geometric center of the polygon formed by the multiple vertices, or the midpoint of the straight line formed by connecting the multiple vertices.
[0091] Optionally, the step of generating a curve corresponding to the sub-model based on multiple sampling points includes: performing spline interpolation based on the multiple sampling points to obtain a spline curve; and determining the spline curve as the curve corresponding to the sub-model.
[0092] Optionally, the above-mentioned curve has multiple control points; the control points are used to control the degree of curvature of the curve; based on the curve corresponding to the sub-model, the step of determining the joint nodes of the bone corresponding to the sub-model includes: determining at least some of the multiple control points of the curve as the joint nodes of the bone corresponding to the sub-model.
[0093] Optionally, the above-mentioned joint nodes are determined based on multiple control points of the curve; the multiple control points have a preset order; the arrangement order of the multiple joint nodes is determined based on the preset order; based on the joint nodes of the bones corresponding to the sub-model, the step of generating the bones corresponding to the sub-model includes: determining adjacent joint nodes based on the arrangement order of the multiple joint nodes of the bones corresponding to the sub-model; for any adjacent joint nodes, generating bones connecting the adjacent joint nodes.
[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0095] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0096] If the function is implemented in the form of 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 the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0097] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0098] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for processing a model, characterized in that: The method comprises: Acquire a hair model; the hair model includes a plurality of sub-models; the sub-model includes a plurality of vertices; Based on the vertices of the sub-model, a curve corresponding to the sub-model is determined, and based on the curve corresponding to the sub-model, a joint node of the bone corresponding to the sub-model is determined; the curve corresponds to the bending shape of the sub-model; Based on the joint nodes of the skeleton corresponding to the sub-model, the skeleton corresponding to the sub-model is generated, and the sub-model is bound to the skeleton.
2. The method according to claim 1, characterized in that The sub-model has a model boundary; the sub-model is formed by connecting a plurality of polygons, and the polygons include a plurality of vertices; The step of determining a curve corresponding to the sub-model based on the vertices of the sub-model comprises: Divide the multiple vertices of the sub-model into multiple vertex combinations; each of the vertex combinations includes multiple vertices; the minimum number of edges between the vertices in each vertex combination and the vertices in the model boundary of the sub-model is the same; the minimum number of edges is the number of edges of the least polygons that are passed along the vertex to reach the vertex in the model boundary; Determining a plurality of target positions based on the plurality of vertex combinations; Based on the multiple target positions, a curve corresponding to the sub-model is generated.
3. The method according to claim 2, characterized in that The step of dividing the plurality of vertices of the sub-model into a plurality of vertex combinations comprises: Traversing multiple polygons of the sub-model to determine a model boundary of the sub-model; Based on the vertices in the model boundary, determining corresponding vertex combinations; Determine the corresponding vertex combination among the remaining vertices in the sub-model based on the vertices whose minimum number of edges between the vertices combined with the previous vertex is 1; Continue to perform the step of determining corresponding vertex combinations among the remaining vertices in the sub-model based on vertices with a minimum number of edges of 1 between vertices in the previous vertex combination, until all vertices in the sub-model are divided into vertex combinations.
4. The method according to claim 2, characterized in that: The step of determining a plurality of targets based on the plurality of vertex combinations comprises: For each vertex combination in at least some of the multiple vertex combinations, determine the target position corresponding to the vertex combination based on the positions of the multiple vertices in the vertex combination; the target position is the geometric center of the polygon formed by the multiple vertices, or the midpoint of the straight line formed by connecting the multiple vertices.
5. The method according to claim 2, characterized in that: The step of generating a curve corresponding to the sub-model based on the multiple target positions comprises: Based on the multiple target positions, performing spline interpolation to obtain a spline curve; The spline curve is determined as the curve corresponding to the sub-model.
6. The method according to claim 1, characterized in that The curve has a plurality of control points; the control points are used to control the curvature of the curve; The step of determining the joint nodes of the bones corresponding to the sub-model based on the curve corresponding to the sub-model comprises: At least some of the multiple control points of the curve are determined as joint nodes of the skeleton corresponding to the sub-model.
7. The method according to claim 1, characterized in that The joint nodes are determined based on a plurality of control points of the curve; the plurality of control points have a preset order; and the arrangement order of the plurality of joint nodes is determined based on the preset order; The step of generating a skeleton corresponding to the sub-model based on the joint nodes of the skeleton corresponding to the sub-model comprises: Determining adjacent joint nodes based on the arrangement order of multiple joint nodes of the skeleton corresponding to the sub-model; For any adjacent joint nodes, a bone connecting the adjacent joint nodes is generated.
8. A model processing device, characterized in that: The device comprises: A hair model acquisition module, used to acquire a hair model; the hair model includes a plurality of sub-models; the sub-model includes a plurality of vertices; A joint node determination module, used to determine the curve corresponding to the sub-model based on the vertices of the sub-model, and determine the joint nodes of the skeleton corresponding to the sub-model based on the curve corresponding to the sub-model; the curve corresponds to the bending shape of the sub-model; The model binding module is used to generate the skeleton corresponding to the sub-model based on the joint nodes of the skeleton corresponding to the sub-model, and bind the sub-model to the skeleton.
9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the model processing method according to any one of claims 1 to 7.
10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the model processing method described in any one of claims 1 to 7.