Method and apparatus for generating model animation, and electronic device and storage medium
By dividing the skeleton model into model components and matching sub-animation data, the problem of low animation production efficiency of three-dimensional model resource in mobile applications is solved, and the reuse of animation data and user-defined animation generation is realized.
Patent Information
- Application Number
- PCT/CN2024/097537
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-06-12
- Filing Date
- 2024-06-05
- Publication Date
- 2024-12-19
AI Technical Summary
The animation production of three-dimensional model resources in mobile applications requires artists to produce them separately in the art tools in advance, resulting in a large amount of workload for animation developers and affecting the production progress.
By dividing the skeleton model into multiple model components and dividing the animation data into subanimation data corresponding to each model component, adjusting key points in the model component based on the skeleton structure data and subanimation data to generate model animation.
Uncoupling between bone model and animation reduces the workload of animation developers, allowing different bone models to apply the same animation data, and users can freely apply the animation data to generate the desired model animation.
Smart Images

Figure CN2024097537_19122024_PF_FP_ABST
Abstract
Description
Model animation generation method, device, electronic device and storage medium
[0001] This application claims priority to Chinese Patent Application No. 202310693641.9 filed on June 12, 2023, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] The present disclosure relates to a method, device, electronic device and storage medium for generating a model animation. Background Art
[0003] Currently, the 3D model resources used in mobile applications are usually created in advance by artists using art tools, for example, using 3D Max to create model resources.
[0004] Summary of the Invention
[0005] The embodiments of the present disclosure at least provide a method, device, electronic device, and storage medium for generating a model animation.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for generating a model animation, comprising:
[0007] In response to a selection operation on a skeleton model, a target skeleton model is determined, and the skeleton structure data of multiple bones in the target skeleton model are determined; the target skeleton model includes multiple model components; in response to a trigger operation on multiple candidate animation data, the target animation data of the target skeleton model is determined in the multiple candidate animation data; the target animation data includes sub-animation data of at least one target model component in the target skeleton model; based on the skeleton structure data, the respective sub-bones belonging to each of the target model components in the multiple bones are determined; based on the skeleton structure data and the sub-animation data of the target model component, the key points associated with the respective sub-bones in the target model component are adjusted to generate the model animation.
[0008] In an optional implementation, the target animation data includes at least one of the following data of the skeleton of each model component of the target skeleton model: key frame information, offset position, offset direction, and trigger event corresponding to the key frame.
[0009] In an optional embodiment, adjusting the key points associated with each sub-skeleton in the target model component based on the skeletal structure data and the sub-animation data of the target model component includes:
[0010] Adjusting the bone positions of each child skeleton of the target model component based on the child animation data of the target model component;
[0011] Based on the bone structure data and the adjusted bone positions of the sub-bones, the vertex positions of the model vertices associated with each sub-bone are adjusted.
[0012] In an optional implementation, adjusting the bone positions of each child skeleton of the target model component based on the child animation data of the target model component includes:
[0013] In the case of determining that the first sub-bone in each sub-bone of the target model component is the target bone of other model components, determining the position constraint information of the second sub-bone in each sub-bone; wherein the second sub-bone is a bone other than the target bone of the target model component and the first sub-bone; and the target bone is a bone participating in the action in the sub-animation data;
[0014] Adjust the bone position of the child skeleton according to the position constraint information and the target animation data.
[0015] In an optional embodiment, determining the position constraint information of the second child bone in each child bone includes:
[0016] Determine, among the sub-skeletons, third sub-bones located at both ends of the second sub-bones, and determine a bone line between the third sub-bones;
[0017] Determine the orientation information of the second child skeleton relative to the skeleton line, and determine the position constraint information based on the orientation information.
[0018] In an optional embodiment, determining the skeletal structure data of the plurality of bones in the target skeletal model includes:
[0019] Determining skeletal hierarchical data of the plurality of bones based on a positional relationship between model components in the target skeletal model;
[0020] Determining a mapping relationship between model vertices of the target skeletal model and the multiple bones;
[0021] The bone structure data is determined based on the bone hierarchy data and the mapping relationship.
[0022] In an optional embodiment, the model component includes a spinal model and a limb model, and the multiple skeletons include spinal skeletons and limb skeletons, wherein the spinal skeleton of the spinal model is located at the same bone level, and the limb skeleton of the limb model connected to the target spinal skeleton is located at the next bone level of the target spinal skeleton.
[0023] In an optional implementation, the method further includes:
[0024] determining an articular bone located at a joint among the plurality of bones;
[0025] Determine a parent node bone located at the joint bone based on the bone hierarchy data, and determine a target model vertex associated with the joint bone based on the mapping relationship;
[0026] A mapping relationship between the parent node bone and the target model vertex is established, and based on the positional relationship between the parent node bone and the target model vertex, the component sizes of the model components corresponding to the joint bone and the parent node bone are adjusted respectively.
[0027] In a second aspect, an embodiment of the present disclosure provides a device for generating a model animation, comprising:
[0028] A first determining unit, in response to a selection operation on a skeleton model, determines a target skeleton model and determines skeleton structure data of a plurality of bones in the target skeleton model; the target skeleton model includes a plurality of model components;
[0029] A second determining unit, in response to a triggering operation on a plurality of candidate animation data, determines target animation data of the target skeletal model from the plurality of candidate animation data; the target animation data includes sub-animation data of at least one target model component in the target skeletal model;
[0030] A generation unit is used to determine, based on the bone structure data, the sub-bones of the multiple bones belonging to each of the target model components; based on the bone structure data and the sub-animation data of the target model component, adjust the key points associated with the sub-bones in the target model component to generate the model animation.
[0031] In a third aspect, an embodiment of the present disclosure further provides an electronic device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are performed.
[0032] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments. The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and, together with the specification, are used to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without inventive effort.
[0034] FIG1 shows a flow chart of a method for generating a model animation provided by an embodiment of the present disclosure;
[0035] FIG2 shows a schematic diagram of a model structure of an optional target skeleton model provided by an embodiment of the present disclosure;
[0036] FIG3 shows a schematic diagram of a data structure of bone-level data provided by an embodiment of the present disclosure;
[0037] FIG4 is a schematic diagram showing a situation where edge distortion occurs at an arm joint position according to an embodiment of the present disclosure;
[0038] FIG5 is a schematic diagram showing an arm joint position without edge distortion after adjustment provided by an embodiment of the present disclosure;
[0039] FIG6 shows a schematic diagram of a data structure of target animation data provided by an embodiment of the present disclosure;
[0040] FIG7 shows a schematic diagram of a data structure of target animation data of a target skeleton model provided by an embodiment of the present disclosure;
[0041] FIG8 shows a schematic diagram of the data structure of target animation data of another target skeleton model provided by an embodiment of the present disclosure;
[0042] FIG9 shows a schematic diagram of a device for generating a model animation according to an embodiment of the present disclosure; and
[0043] FIG10 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the disclosure for which protection is sought, but merely represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.
[0045] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0046] The term "and / or" herein simply describes an association relationship, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, and the existence of B alone. In addition, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.
[0047] Research has found that 3D model assets used in mobile applications are typically pre-created by artists using art tools, such as 3D Max. After the model assets are created, individual animations must be created for each one. When there are a large number of model assets, individual animations must be created for each, increasing the workload for animation developers and impacting the animation production process for the model assets in the application.
[0048] Based on the above research, an embodiment of the present disclosure provides a solution for animation generation based on dividing model components. Specifically, after the user selects any target skeleton model (the target skeleton model includes multiple model components); the target animation data of the target skeleton model is determined among multiple candidate animation data, and the target animation data contains sub-animation data of at least one target model component in the target skeleton model; then, based on the skeleton structure data of the skeleton model, the various sub-bones belonging to each target model component are determined; finally, based on the skeleton structure data and the sub-animation data of the target model component, the key points associated with the various sub-bones in the target model component are adjusted to generate a model animation.
[0049] In the above-mentioned embodiment, by dividing the skeleton model into a plurality of model components, and dividing the target animation data into sub-animation data corresponding to each model component, it is possible to match the corresponding sub-animation data for any skeleton model after determining the plurality of model components of the skeleton model, thereby utilizing the key points associated with the corresponding sub-skeletons in the skeleton structure data of each model component to perform the actions indicated by the corresponding sub-animation data, thereby generating a model animation formed by the actions of the various model components. Thus, the disclosed embodiment can release the strong coupling between the skeleton model and the animation, and no longer needs to produce animations for each skeleton model separately. It can realize the application of the same animation data to different skeleton models, thereby reducing the workload of animation developers. At the same time, users can freely apply animation data to the skeleton model, thereby obtaining the model animation desired by the user.
[0050] To facilitate understanding of this embodiment, a method for generating a model animation disclosed in an embodiment of the present disclosure is first introduced in detail. The execution subject of the method for generating a model animation provided in an embodiment of the present disclosure is generally a computer device with certain computing capabilities. The computer device includes, for example: a terminal device or a server or other processing device. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the method for generating a model animation can be implemented by a processor calling computer-readable instructions stored in a memory.
[0051] 1 is a flowchart of a method for generating a model animation according to an embodiment of the present disclosure. The method includes steps S101 to S105, wherein:
[0052] S101: In response to a selection operation on a skeleton model, a target skeleton model is determined, and skeleton structure data of multiple bones in the target skeleton model is determined; the target skeleton model includes multiple model components.
[0053] Here, the model animation generation method provided by the embodiment of the present disclosure can be applied to any type of application program containing model resources. For example, the application program can be a game application program.
[0054] In the embodiment of the present disclosure, the above application may include an editing interaction interface, so that the user can edit the model through the editing interaction interface.
[0055] Here, the application can also be used to store the skeleton model edited by the user.
[0056] In a specific implementation, a user's selection operation of a skeletal model can be detected in an application. Then, in response to the trigger operation, the skeletal model selected by the user is determined as the target skeletal model, and the skeletal structure data of multiple bones in the target skeletal model is determined. Here, the skeletal structure data includes skeletal hierarchical data and skinning data. The skeletal hierarchical data is used to indicate the hierarchical relationship between multiple bones, and the skinning data is used to indicate the mapping relationship between multiple bones and the model vertices of the skeletal model.
[0057] Here, the target skeletal model includes multiple types of model components, and each type of model component includes corresponding bones. For example, the model components of the target skeletal model may include a spine model and a limb model, and the multiple bones include spine bones and limb bones.
[0058] S103: In response to a triggering operation on a plurality of candidate animation data, target animation data of the target skeletal model is determined from the plurality of candidate animation data; the target animation data includes sub-animation data of at least one target model component in the target skeletal model.
[0059] In the disclosed embodiment, multiple sets of animation data can be pre-set, and multiple candidate animation data can be determined based on the multiple sets of animation data. For example, all of the multiple sets of animation data can be determined as multiple candidate animation data; for another example, the animation data in the multiple sets of animation data that matches the model type of the target skeletal model can be determined as candidate animation data. The model type can be understood as the type of skeletal model, for example, an animal model, a plant model, etc.
[0060] Here, the animation data includes animation data (ie, sub-animation data) of the corresponding model component of the skeletal model. For example, the animation data may include the position coordinates of each bone of the corresponding model component of the skeletal model.
[0061] After a plurality of candidate animation data are determined, a triggering operation on the plurality of candidate animation data may be detected, and target animation data of a target skeletal model may be determined from the plurality of candidate animation data based on the triggering operation.
[0062] S105: Based on the bone structure data, determine the sub-bones of each target model component among the multiple bones; based on the bone structure data and the sub-animation data of the target model component, adjust the key points associated with the sub-bones in the target model component to generate the model animation.
[0063] After the target animation model is determined, the target animation data can be applied to the skeletal structure data to obtain the model animation of the target skeletal model.
[0064] In the embodiment of the present disclosure, after the skeleton structure data and the target animation data are determined, the model animation of the target skeleton model can be generated based on the skeleton structure data and the target animation data.
[0065] As can be seen from the above description, the target animation data contains sub-animation data of at least some model components (i.e., target model components) in the target skeletal model. Therefore, the sub-animation data in the target animation data that matches each target model component of the target skeletal model can be determined. Then, based on the sub-animation data, the key points (such as skeletal joint points, model vertex positions, etc.) associated with each sub-skeleton of the target model component in the skeletal structure data can be adjusted, thereby generating sub-animations of each target model component and obtaining an overall model animation composed of the sub-animations of each target model component.
[0066] In the disclosed embodiment, the skeletal model can be pre-divided into multiple model components. For example, the skeletal model can be divided into the following model components: left hand, right hand, left foot, right foot, head, wings, etc. For each model component of the skeletal model, corresponding sub-animation data can be set for the model component in the animation data.
[0067] After determining the target skeletal model's model components, the target skeletal model's model components can be matched with the sub-animation data. Each sub-animation data item in the target animation data contains a corresponding component tag. This component tag can be used to determine the model component associated with the sub-animation data item. Next, the sub-animation data can be applied to the skeletal structure data to obtain the model animation of the target skeletal model.
[0068] In the above implementation, by setting sub-animation data for each model component of the skeletal model, the sub-animation data can be applied to a variety of different skeletal models, thereby realizing that a set of animations can be applied to a variety of different skeletal models.
[0069] That is, by dividing the skeleton model into multiple model components, and dividing the target animation data into sub-animation data corresponding to each model component, for any skeleton model, after determining the multiple model components of the skeleton model, the corresponding sub-animation data can be matched to each of the multiple model components, thereby utilizing the key points associated with the corresponding sub-skeletons in the skeleton structure data of each model component to execute the actions indicated by the corresponding sub-animation data, thereby generating a model animation formed by the actions of each model component. Thus, the embodiment of the present disclosure can release the strong coupling between the skeleton model and the animation, and no longer needs to produce animations for each skeleton model separately. It can achieve the application of the same animation data to different skeleton models, thereby reducing the workload of animation developers. At the same time, users can freely apply animation data to the skeleton model, thereby obtaining the model animation desired by the user.
[0070] The above steps will be described in detail below in conjunction with specific implementation methods.
[0071] In the disclosed embodiment, after determining the target skeletal model, the skeletal structure data of the multiple bones in the target skeletal model can be determined. As can be seen from the above description, the skeletal structure data includes skeletal hierarchy data and skinning data, wherein the skinning data is used to indicate the mapping relationship between the multiple bones and the model vertices of the skeletal model.
[0072] In an optional embodiment, the step S103 of determining the skeletal structure data of the plurality of bones in the target skeletal model specifically includes the following steps:
[0073] Step S1031: determining the skeleton hierarchical data of the plurality of skeletons based on the positional relationship of each model component in the target skeleton model;
[0074] Step S1032: determining a mapping relationship between the model vertices of the target skeleton model and the multiple bones;
[0075] Step S1033: Determine the bone structure data based on the bone hierarchy data and the mapping relationship.
[0076] When the target skeleton model includes a spine model and a limb model, the skeleton hierarchical data of multiple bones can be determined based on the structural relationship between the limbs and the spine.
[0077] In the first embodiment, a root node bone can be determined from multiple bones of the target skeletal model, which is denoted as bone A1. Here, the root node bone can be a bone at the highest bone level that is pre-set by the model editor among multiple bones; it can also be a bone at the highest bone level that is automatically determined among multiple bones according to the model type of the target skeletal model. Then, the model component where the root node bone is located is determined, which is denoted as model component B1, and the other bones on the model component are used as child node bones of the root node bone, which are denoted as bone A2. Afterwards, the branch model component of the model component B1 is determined, which is denoted as model component B2, and the bone A2 in the model component B1 that is connected to the model component B2 is determined, and the bone of the model component B2 (denoted as A3) is determined as the child node bone of the bone A2.
[0078] Here, the bone A2 in the model component B1 that is connected to the model component B2 can be determined in the following way:
[0079] Determine the position C1 of each bone in the previous bone level (for example, bone A2), and then determine the position C2 of the root node bone A3 in each bone in the current level (for example, bone A3); determine the bone in the previous bone level that is closest to the root node bone A3, and use each bone in the current bone level as the child node bone of the closest bone.
[0080] For the branch model component of the model component B2 where the bone A3 is located, the child node bones of the bone A3 are determined in the same manner as described above, thereby obtaining the bone hierarchy data of multiple bones.
[0081] In a second embodiment, a spinal column model can be determined in the target skeletal model, and the bones of the spinal column model, i.e., the spinal column skeleton, can be determined. Then, the spinal column skeleton is used as the skeleton of the first skeletal level. After that, a branch model component of the spinal column skeleton can be determined. For example, the branch model component can be determined to be a limb model, and the bones of the limb model, i.e., the limb skeleton, can be used as the skeleton of the next skeletal level of the spinal column skeleton. Here, the parent node spinal column skeleton of the limb skeleton can be determined in the spinal column skeleton. The parent node spinal column skeleton of the limb skeleton can be determined in the following manner:
[0082] Determine the position D1 of the spinal bones, and then determine the position D2 of the root node bone in the limb bones; determine the spinal bone closest to the root node bone in the spinal bones, and use the limb bone as the child node bone of the spinal bone closest to the root node bone.
[0083] For example, an optional target skeleton model is shown in Figure 2. The target skeleton model shown in Figure 2 includes a spine model and four limb models (two arms and two legs), wherein the spine model includes a number of spine bones, and each limb model includes a number of limb bones. As shown in Figure 2, the bones on the spine model are located at the same bone hierarchy, and the limb bones of the four limb models are sub-node bones of the spine bones. After the target skeleton model shown in Figure 2 is processed according to the second embodiment described above, the bone hierarchy data shown in Figure 3 can be obtained.
[0084] From the above description, it can be seen that when the model component includes a spinal model and a limb model, the multiple bones include spinal bones and limb bones, wherein the spinal bones of the spinal model are located at the same bone level, and the limb bones of the limb model connected to the target spinal bones are located at the next bone level of the target spinal bones.
[0085] After the skeleton hierarchy data is determined in the manner described above, the mapping relationship between the model vertices of the target skeleton model and the multiple bones can be determined.
[0086] In a specific implementation, a meta model corresponding to each bone in the target skeletal model can be determined, where the meta model is the model set for each bone during the process of building the target skeletal model. An intersection point on each meta model is determined, where the intersection point is the intersection point between the meta model and the voxel cube.
[0087] In the disclosed embodiment, during the model editing phase, the model editing area can be divided into multiple voxel cubes. A corresponding metaball model is then determined for each bone in the target skeletal model. The intersection points between each voxel cube and the metaball model are then determined and used as model vertices. The target skeletal model is then constructed based on these model vertices.
[0088] After determining the intersection points on each meta-ball model, a mapping relationship can be established between the skeleton and the intersection point to obtain the skinning data of the target skeleton model. By establishing this mapping relationship, the animation data can drive the skeleton, and the skeleton can drive the model vertices, thus realizing the playback of the animation data.
[0089] In an optional embodiment, the method described above further includes the following steps:
[0090] Step S11: determining an articular bone located at a joint among the multiple bones;
[0091] Step S12: determining a parent node bone located at the joint bone based on the bone hierarchy data, and determining a target model vertex associated with the joint bone based on the mapping relationship;
[0092] Step S13: Establish a mapping relationship between the parent node bone and the target model vertex, and adjust the component sizes of the joint bone and the model components corresponding to the parent node bone based on the positional relationship between the parent node bone and the target model vertex.
[0093] Through research, it was found that for the joint positions of the target skeleton model, if the model animation is generated using the above-described skeleton structure data and target animation data, the model animation at the joint positions will have edge distortion.
[0094] From the above description of the skinning data determination process, it can be seen that each model vertex of the target skeletal model is associated with a bone. At this time, when the arm of the target skeletal model is bent, a relatively stiff pulling will occur, resulting in edge distortion at the arm joint position. For example, Figure 4 is a schematic diagram of the situation where edge distortion occurs at the arm joint position.
[0095] In order to solve the edge aliasing described above, it is necessary to perform transition processing on the weights of the joint positions of the target skeleton model. The specific transition process is described as follows:
[0096] First, the joint bone located at the joint is identified from multiple skeletons. Then, the parent bone of the joint bone is determined based on the bone hierarchy data. A mapping relationship is then established between the parent bone and the target model vertex associated with the joint bone. Once this mapping relationship is established, since a single model vertex is associated with multiple bones, edge aliasing that occurs at the joint during bending can be mitigated.
[0097] Next, you also need to adjust the component sizes of the model components corresponding to the joint bones and the parent node bones based on the positional relationship between the parent node bones and the target model vertices.
[0098] Here, the model size (for example, the sphere radius) of the meta-ball model corresponding to the joint bones can be adjusted according to the positional relationship between the joint bones and the parent node bones, as well as the model size (for example, the sphere radius) of the meta-ball model corresponding to the parent node bones, thereby adjusting the component size of the model components corresponding to the joint bones and the parent node bones. In specific implementation, the position coordinates of the joint bones and the position coordinates of the parent node bones can be interpolated to obtain the model size of the meta-ball model corresponding to the joint bones and the model size of the meta-ball model corresponding to the parent node bones. After processing in the manner described above, the schematic diagram of edge distortion shown in Figure 4 can be adjusted to the schematic diagram shown in Figure 5. The arm joints shown in Figure 5 are smoother, and there is no edge distortion.
[0099] In an optional embodiment, the target animation data includes at least one of the following data of the target skeleton of each model component of the target skeleton model: key frame information, offset position, offset direction, and trigger event corresponding to the key frame.
[0100] Here, the target animation data may be animation data of a key frame of a model animation, that is, the target animation data includes key frame information (e.g., information such as the position of the key frame and the number of key frames). The offset position is used to indicate a position change of the corresponding bone in the corresponding key frame relative to the initial position of the bone, the offset direction is used to indicate a direction change of the corresponding bone in the corresponding key frame relative to the initial position of the bone, and the trigger event is used to indicate an event corresponding to the key frame, such as the sound of clapping or the like; wherein the initial position may be the original position of the corresponding bone in the original animation data.
[0101] Here, the target bone can be understood as the bone at the lowest bone level among the multiple bones of the corresponding model component, or it can also be called the leaf node bone among the multiple bones of the model component.
[0102] In the disclosed embodiment, the target animation data includes not only the data described above but also blendshape data. For example, corresponding blendshape data can be set for the tip limbs of the skeletal model. For example, corresponding blendshape data can be set for the tip limbs such as the hands and feet. The target animation data can also include special parameters, wherein the special parameters are used to control the position change of the bones, which is directly proportional to the body shape and arm span of the target skeletal model. Through this processing method, the movements of the target skeletal model can be made more coordinated, thereby obtaining a more realistic model animation.
[0103] The above embodiment will be described below with reference to Figures 6 and 7. Figure 6 shows a schematic diagram of the data structure of target animation data, Figure 7 shows a schematic diagram of the data structure of target animation data of a target skeletal model, and Figure 8 shows a schematic diagram of the data structure of target animation data of another target skeletal model.
[0104] As shown in Figure 6, the target animation data includes sub-animation data for the following model components: left hand, right hand, head, left foot, right foot, and blendshape data for the tip parts (claws, paws, and mouth).
[0105] Suppose the target skeletal model has a head and hands, but no feet. In this case, as shown in Figure 7, the sub-animation data that matches the target skeletal model's model components is the sub-animation data for the left hand, right hand, and head, as well as the blendshape data for the left paw, right paw, and mouth. At this point, this successfully matched data can be applied to the skeletal structure data to obtain the model animation for the target skeletal model.
[0106] Let's assume the target skeletal model has two heads, four legs, but no hands. In this case, as shown in Figure 8, the sub-animation data that matches the target skeletal model's model components is the sub-animation data for the two heads, the sub-animation data for the four left and four right legs, and the blendshape data for the left and right soles of the feet and the mouth. At this point, we can apply this successfully matched data to the skeletal structure data to obtain the model animation for the target skeletal model.
[0107] In this case, in the above step S105, the key points associated with each sub-skeleton may include the skeletal position points of the sub-skeleton (which may include joint points, position points between joint points, etc.) and the model vertices associated with each of the sub-skeletons. In S105, based on the skeletal structure data and the sub-animation data of the target model component, adjusting the key points associated with each of the sub-skeletons in the target model component specifically includes the following steps:
[0108] Step S31: adjusting the bone positions of each sub-skeleton of the target model component based on the sub-animation data of the target model component;
[0109] Step S32: Based on the bone structure data and the adjusted bone positions of the sub-bones, adjust the vertex positions of the model vertices associated with each sub-bone.
[0110] In the disclosed embodiment, first, the sub-bones of each model component of the target skeletal model are determined from the bone hierarchy data in the skeletal structure data. For example, as shown in the bone hierarchy data in FIG3 , leg_1_0 and leg_1_1 are the sub-bones of the left arm, and leg_F_0 and leg_F_1 are the sub-bones of the right arm. Spine0-Spine10 are the sub-bones of the spine model.
[0111] As can be seen from the above description, the target animation data includes at least one of the following data for the target bone of each model component of the target skeletal model: keyframe information, offset position, offset direction, and the trigger event corresponding to the keyframe. Furthermore, for each model component, the child skeleton of that model component includes the target bone of that model component.
[0112] Based on this, the bone positions of each child bone of the model component can be adjusted based on the animation data of the target bone in the target animation data.
[0113] In specific implementations, the target bone's bone position can be refreshed to the target point based on the target animation data. Then, the target bone's adjacent child bone M1's bone position is refreshed. Here, child bone M1 can be controlled to be pulled in toward the target bone based on the initial distance between the target bone and child bone M1. Next, the bone position of child bone M2, adjacent to child bone M1, is refreshed. Here, child bone M2 can be controlled to be pulled in toward child bone M1 based on the initial distance between child bones M1 and M2. The bone positions of other child bones are determined in the same manner.
[0114] After repeated iterations of the method described above, the final determined bone position can be determined as the bone position of each sub-bone after adjustment.
[0115] Then, based on the mapping relationship in the skeletal structure data and the bone position of the adjusted child skeleton, the vertex positions of the model vertices with a mapping relationship with the child skeleton are adjusted to obtain the corresponding model animation keyframes. After obtaining the model animation keyframes, the model animation keyframes can be interpolated to obtain the model animation.
[0116] In the above embodiment, by setting sub-animation data for each model component of the skeleton model, the animation data can be applied to a variety of different skeleton models, thereby realizing that a set of animations can be applied to a variety of different skeleton models.
[0117] In an optional embodiment, step S32 adjusts the bone positions of each child skeleton of the target model component based on the child animation data of the target model component, specifically comprising the following steps:
[0118] Step S321: When determining that the first child skeleton of each child skeleton of the target model component is the target skeleton of other model components, determine the position constraint information of the second child skeleton of each child skeleton; wherein the second child skeleton is a skeleton other than the target skeleton of the target model component and the first child skeleton; and the target skeleton is a skeleton participating in the action in the sub-animation data;
[0119] Step S322: adjusting the bone position of the child skeleton according to the position constraint information and the target animation data.
[0120] If a model component's child skeletons contain no target bones from other model components besides the target bone of that model component, the joints of the target skeleton model will not bend in the opposite direction during the model animation. If the target bones of other model components are included, then some joints in the determined bone positions may bend in the opposite direction, affecting the animation quality of the model.
[0121] In order to solve the above-described problem of joint bending in the opposite direction, it is necessary to set position constraint information for the sub-bones of the model component, so as to control the sub-bones and adjust the bone position of each sub-bones under the constraint of the position constraint information.
[0122] Here, a target bone of another model component, i.e., a first sub-bone, can be determined from among the multiple sub-bones of the model component. Then, a sub-bone other than the first sub-bone and the target bone of the model component, i.e., a second sub-bone, can be determined from among the multiple sub-bones of the model component. Then, position constraint information is set for the second sub-bone, thereby controlling the second sub-bone to adjust the bone positions of each sub-bone under the constraints of the position constraint information.
[0123] Here, first, the third sub-bones located at both ends of the second sub-bones can be determined in the sub-bones, and the bone line between the third sub-bones can be determined; then, the orientation information of the second sub-bones relative to the bone line can be determined, and the position constraint information can be determined based on the orientation information.
[0124] During specific implementation, in the initial state, position constraint information is determined for the second sub-skeleton, wherein the initial state can be understood as the state of each sub-skeleton before adjustment.
[0125] For any second child skeleton, we can determine the third child skeleton adjacent to the second child skeleton, and then determine the bone line between the adjacent third child skeletons. We also record the initial position information of the second child skeleton relative to the bone line, and then determine this position information as the position constraint information of the second child skeleton.
[0126] Through the above processing method, the bone position of the adjusted sub-skeleton can be made more reasonable, thereby avoiding the situation where the joint bends in the opposite direction, thereby improving the animation effect of the model animation.
[0127] Those skilled in the art will understand that in the above-mentioned method of the specific implementation method, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0128] Based on the same inventive concept, the embodiment of the present disclosure also provides a model animation generation device corresponding to the model animation generation method. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned model animation generation method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0129] 9 , which is a schematic diagram of a device for generating a model animation according to an embodiment of the present disclosure, the device includes: a first determining unit 10 , a second determining unit 20 , and a generating unit 30 ; wherein,
[0130] The first determining unit 10 determines a target skeleton model in response to a selection operation on the skeleton model, and determines skeleton structure data of a plurality of bones in the target skeleton model; the target skeleton model includes a plurality of model components;
[0131] The second determining unit 20 is configured to determine target animation data of the target skeletal model from the plurality of candidate animation data in response to a triggering operation on the plurality of candidate animation data; the target animation data includes sub-animation data of at least one target model component in the target skeletal model;
[0132] The generation unit 30 determines, based on the bone structure data, the sub-bones among the multiple bones belonging to each of the target model components; based on the bone structure data and the sub-animation data of the target model component, adjusts the key points associated with the sub-bones in the target model component to generate the model animation.
[0133] In the disclosed embodiment, the same animation expression can be applied to different skeletal models, and there is no need to perform separate animation design for each skeletal model. For example, after the user selects any target skeletal model (the target skeletal model includes multiple model components), the target animation data of the target skeletal model is determined from multiple candidate animation data, and the target animation data includes sub-animation data of at least one target model component in the target skeletal model; then, based on the skeletal structure data of the skeletal model, the sub-bones belonging to each target model component are determined; finally, based on the skeletal structure data and the sub-animation data of the target model component, the key points associated with the sub-bones in the target model component are adjusted to generate a model animation.
[0134] In the above-mentioned embodiment, by dividing the skeleton model into a plurality of model components, and dividing the target animation data into sub-animation data corresponding to each model component, it is possible to match the corresponding sub-animation data for each of the multiple model components for any skeleton model after determining the multiple model components of the skeleton model, thereby utilizing the key points associated with the corresponding sub-skeletons in the skeleton structure data of each model component to execute the action indicated by the corresponding sub-animation data, thereby generating a model animation formed by the action of each model component. Thus, the embodiment of the present disclosure can release the strong coupling between the skeleton model and the animation, and no longer need to produce animations for each skeleton model separately. It can realize the application of the same animation data to different skeleton models, thereby reducing the workload of animation developers. At the same time, users can freely apply animation data to the skeleton model, thereby obtaining the model animation desired by the user.
[0135] In a possible implementation, the target animation data includes at least one of the following data of the target skeleton of each model component of the target skeleton model: key frame information, offset position, offset direction, and trigger event corresponding to the key frame.
[0136] In one possible implementation, the generation unit 30 is further used to: adjust the bone positions of each sub-skeleton of the target model component based on the sub-animation data of the target model component; and adjust the vertex positions of the model vertices associated with each sub-skeleton based on the bone structure data and the adjusted bone positions of each sub-skeleton.
[0137] In one possible embodiment, the generation unit 30 is further used to: determine the position constraint information of the second sub-bone in each sub-skeleton of the target model component when the first sub-bone is determined to be the target bone of other model components; wherein the second sub-bone is a bone other than the target bone of the target model component and the first sub-bone; the target bone is a bone participating in the action in the sub-animation data; and adjust the bone position of the sub-bone according to the position constraint information and the target animation data.
[0138] In one possible embodiment, the generation unit is further used to: determine the third sub-skeleton located at both ends of the second sub-skeleton among the sub-skeletons, and determine the bone line between the third sub-skeletons; determine the orientation information of the second sub-skeleton relative to the bone line, and determine the position constraint information based on the orientation information.
[0139] In one possible implementation, the first determination unit is further used to: determine the bone hierarchy data of the multiple bones based on the positional relationship between the model components in the target bone model; determine the mapping relationship between the model vertices of the target bone model and the multiple bones; and determine the bone structure data based on the bone hierarchy data and the mapping relationship.
[0140] In one possible embodiment, the model component includes a spinal model and a limb model, and the multiple skeletons include spinal skeletons and limb skeletons, wherein the spinal skeleton of the spinal model is located at the same bone level, and the limb skeleton of the limb model connected to the target spinal skeleton is located at a bone level below the target spinal skeleton.
[0141] In one possible embodiment, the device is also used to: determine the joint bone located at the joint among the multiple bones; determine the parent node bone located at the joint bone based on the bone hierarchy data, and determine the target model vertex associated with the joint bone based on the mapping relationship; establish a mapping relationship between the parent node bone and the target model vertex, and adjust the component sizes of the model components corresponding to the joint bone and the parent node bone respectively based on the positional relationship between the parent node bone and the target model vertex.
[0142] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0143] Corresponding to the method for generating the model animation in FIG1 , an embodiment of the present disclosure further provides an electronic device 1000 . FIG10 is a schematic structural diagram of the electronic device 1000 provided in an embodiment of the present disclosure, including:
[0144] Processor 1001, memory 1002, and bus 1003; memory 1002 is used to store execution instructions, including internal memory 1021 and external memory 1022; the internal memory 1021 is also called internal memory, which is used to temporarily store operation data in the processor 1001 and data exchanged with external memory 1022 such as a hard disk. The processor 1001 exchanges data with the external memory 1022 through the internal memory 1021. When the electronic device 1000 is running, the processor 1001 communicates with the memory 1002 through the bus 1003, so that the processor 1001 executes the following instructions:
[0145] In response to a selection operation on a skeleton model, a target skeleton model is determined, and skeleton structure data of a plurality of bones in the target skeleton model is determined; the target skeleton model includes a plurality of model components;
[0146] In response to a triggering operation on a plurality of candidate animation data, target animation data of the target skeletal model is determined from the plurality of candidate animation data; the target animation data includes sub-animation data of at least one target model component in the target skeletal model;
[0147] Based on the bone structure data, determining each sub-skeleton belonging to each target model component among the multiple bones;
[0148] Based on the skeletal structure data and the sub-animation data of the target model component, the key points associated with each sub-skeleton in the target model component are adjusted to generate the model animation. The disclosed embodiment also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for generating the model animation described in the above method embodiment are executed. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0149] The embodiments of the present disclosure also provide a computer program product, which carries program code. The instructions included in the program code can be used to execute the steps of the model animation generation method described in the above method embodiment. For details, please refer to the above method embodiment and will not be repeated here.
[0150] The computer program product may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0152] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0153] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0154] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. 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. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0155] Finally, it should be noted that the above-described 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 scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure shall be subject to the scope of protection of the claims.
Claims
1. A method for generating a model animation, comprising: In response to a selection operation on a skeleton model, a target skeleton model is determined, and skeleton structure data of a plurality of bones in the target skeleton model is determined; The target skeleton model includes a plurality of model components; In response to a triggering operation on a plurality of candidate animation data, determining target animation data of the target skeleton model from the plurality of candidate animation data; The target animation data includes sub-animation data of at least one target model component in the target skeleton model; Based on the bone structure data, determining each sub-skeleton belonging to each target model component among the multiple bones; Based on the bone structure data and the sub-animation data of the target model component, the key points associated with the sub-bones in the target model component are adjusted to generate the model animation.
2. The method according to claim 1, wherein: The target animation data includes at least one of the following data of the skeleton of each model component of the target skeleton model: key frame information, offset position, offset direction, and trigger event corresponding to the key frame.
3. The method according to claim 1, wherein: The step of adjusting the key points associated with each sub-skeleton in the target model component based on the bone structure data and the sub-animation data of the target model component comprises: Based on the sub-animation data of the target model component, adjusting the bone position of each sub-bone of the target model component; Based on the bone structure data and the adjusted bone positions of each of the sub-bones, the vertex positions of the model vertices associated with each of the sub-bones are adjusted.
4. The method according to claim 3, wherein: The step of adjusting the bone positions of each child skeleton of the target model component based on the child animation data of the target model component comprises: In the case of determining that the first sub-bone in each sub-bone of the target model component is the target bone of other model components, determining the position constraint information of the second sub-bone in each sub-bone; wherein the second sub-bone is a bone other than the target bone of the target model component and the first sub-bone; and the target bone is a bone participating in the action in the sub-animation data; The bone position of the child bone is adjusted according to the position constraint information and the target animation data.
5. The method according to claim 4, wherein: The determining of the position constraint information of the second child bone in each child bone comprises: Determine the third sub-bones located at both ends of the second sub-bones among the sub-bones, and determine the bone connection lines between the third sub-bones; Determine the orientation information of the second child skeleton relative to the skeleton line, and determine the position constraint information based on the orientation information.
6. The method according to any one of claims 1 to 5, wherein: The step of determining the skeletal structure data of the plurality of bones in the target skeletal model comprises: Determining the skeleton hierarchical data of the plurality of skeletons based on the positional relationship of each model component in the target skeleton model; Determine a mapping relationship between model vertices of the target skeleton model and the multiple bones; The bone structure data is determined based on the bone hierarchy data and the mapping relationship.
7. The method according to claim 6, wherein: The model component includes a spinal column model and a limb model, and the multiple skeletons include spinal column bones and limb bones, wherein the spinal column bones of the spinal column model are located at the same bone level, and the limb bones of the limb model connected to the target spinal column bones are located at a bone level below the target spinal column bones.
8. The method according to claim 6, further comprising: determining an articular bone located at a joint among the plurality of bones; Determine a parent node bone located at the joint bone based on the bone hierarchy data, and determine a target model vertex associated with the joint bone based on the mapping relationship; A mapping relationship between the parent node bone and the target model vertex is established, and based on the positional relationship between the parent node bone and the target model vertex, the component sizes of the model components corresponding to the joint bone and the parent node bone are adjusted respectively.
9. A device for generating a model animation, comprising: A first determining unit is configured to determine a target skeleton model in response to a selection operation on the skeleton model, and determine skeleton structure data of a plurality of bones in the target skeleton model; The target skeleton model includes a plurality of model components; A second determining unit is configured to determine target animation data of the target skeleton model from among the plurality of candidate animation data in response to a triggering operation on the plurality of candidate animation data; The target animation data includes sub-animation data of at least one target model component in the target skeleton model; A generating unit configured to determine, based on the bone structure data, each sub-skeleton belonging to each of the target model components among the multiple bones; Based on the bone structure data and the sub-animation data of the target model component, the key points associated with the sub-bones in the target model component are adjusted to generate the model animation.
10. An electronic device comprising: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, a method for generating a model animation as described in any one of claims 1 to 8 is executed.
11. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for generating a model animation as claimed in any one of claims 1 to 8 is executed.
Citation Information
Patent Citations
Image processing method and device, computer equipment and storage medium
CN112933597A
Skeletal animation processing method and device, electronic equipment and storage medium
CN113368501A
Model animation generation method and device, electronic equipment and storage medium
CN116681808A
Converting deformation data for a mesh to animation data for a skeleton, skinning and shading in a runtime computer graphics animation engine
US20080024487A1
System and method for automatic rigging of three dimensional characters for facial animation
US20130127853A1
Cited By
Simulation plant model construction method and system based on three-dimensional modeling
CN122134922A
