Animation generation method, device and equipment
By obtaining the associated data of virtual characters and scenes to generate target animations, the problem of matching between virtual character actions and scene changes is solved, the animation generation efficiency and visual effects are improved, and adaptive matching of animations is achieved.
Patent Information
- Application Number
- CN202110875177.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-15
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-05-15
AI Technical Summary
The existing technology is difficult to maintain animation matching when virtual character movements and scene changes, resulting in low animation generation efficiency and poor visual effects.
By obtaining the associated data between the virtual character and the target scene, the target animation is generated, so that the virtual character's movements can adaptively match various scenes, improving the smoothness of the action trajectory and visual effects.
It improves the efficiency of animation generation, reduces the workload of manual re-animation, achieves accurate matching of virtual character actions and scenes, and improves the naturalness of visual effects.
Smart Images

Figure CN113744373B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image technology, and in particular to an animation generation method, device and equipment. Background Art
[0002] At present, in order to make the movements of virtual characters have more realistic and natural visual effects, the movements of virtual characters are usually produced by animators in accordance with the scenes in which the virtual characters are located.
[0003] Taking climbing action as an example, an animator can produce an animation containing climbing action according to the scene where the virtual character is located. If the scene where the virtual character is located changes, the previously produced animation may not match the changed scene. In the traditional animation production scheme, animators re-produce the animation according to the changed scene, but this scheme results in a large workload for animators and low efficiency in generating new animations. Although the inverse kinematics (IK) technology is used to analyze the previously produced animation, a new animation of the virtual character in the changed scene can be generated based on the analysis results, but the new animation generated by this scheme has obvious motion jitter, uneven motion trajectory, and poor visual effect.
[0004] In summary, how to make the movements of the virtual characters in the new animation match the changed scenery so as to improve the efficiency of animation generation and improve the visual effects of the new animation has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present invention provide an animation generation method, apparatus, and device, which are used to adapt the actions of a virtual character to various scenes.
[0006] In a first aspect, an embodiment of the present invention provides an animation generation method, which is applied to a service program, wherein a target scene is loaded in the service program, and the method comprises:
[0007] triggering an action execution instruction in a target scene, wherein the action execution instruction is used to instruct the virtual character to perform a set of target actions in the target scene;
[0008] In response to the action execution instruction, obtaining a set of first association data between target actions and target scenes;
[0009] A set of target images of the virtual character performing a set of target actions is generated based on the first association data to obtain a target animation including a set of target images.
[0010] In a second aspect, an embodiment of the present invention provides an animation generating device, in which a target scene is loaded, and the animation generating device includes:
[0011] A trigger module, used to trigger an action execution instruction in a target scene, wherein the action execution instruction is used to instruct the virtual character to perform a set of target actions in the target scene;
[0012] A first acquisition module, configured to acquire first association data between a set of target actions and target scenes in response to an action execution instruction;
[0013] A generating module is used to generate a set of target images of a virtual character performing a set of target actions based on the first association data, so as to obtain a target animation including a set of target images.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the animation generation method in the first aspect.
[0015] An embodiment of the present invention provides a non-transitory machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement the animation generation method in the first aspect.
[0016] In an embodiment of the present invention, an action execution instruction in a target scene loaded by a service program is first triggered, and the action execution instruction is used to instruct a virtual character to perform a set of target actions in the target scene. Then, after triggering the action execution instruction in the target scene, the service program responds to the action execution instruction and obtains first association data between a set of target actions performed by the virtual character and the target scene. Since the first association data can reflect the intrinsic association between the virtual character performing the set of target actions and the target scene, a set of target images in which a set of target actions are performed by the virtual character can be generated through the first association data, so that the set of target actions performed by the virtual character can be accurately matched with the target scene in the target image, and finally a target animation including the set of target images is obtained. In an embodiment of the present invention, after triggering an action execution instruction in a target scene, first association data between a set of target actions executed by a virtual character and a target scene is obtained, and the intrinsic association between the virtual character and the target scene reflected by the first association data is applied to the generation process of a target animation, so that the target action can be matched with the target scene in the target animation, effectively improving the smoothness of the action trajectory, bringing a more realistic and natural visual effect to the user, and the matching process of the target action and the target scene can be achieved without manually remaking the actions of the virtual character, thereby greatly improving the efficiency of animation generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A flowchart of an animation generation method provided by an embodiment of the present invention;
[0019] Figure 2a A schematic diagram of a reference image provided by an embodiment of the present invention;
[0020] Figure 2b A schematic diagram of another reference image provided by an embodiment of the present invention;
[0021] Figure 3 A schematic diagram of the principle of an animation generation process provided by an embodiment of the present invention;
[0022] Figure 4 A schematic diagram of another principle of an animation generation process provided by an embodiment of the present invention;
[0023] Figure 5 A schematic diagram of the principle of another animation generation process provided by an embodiment of the present invention;
[0024] Figure 6 A schematic diagram of the structure of an animation generating device provided by an embodiment of the present invention;
[0025] Figure 7 For Figure 6 A schematic structural diagram of an electronic device corresponding to the animation generating device provided in the illustrated embodiment. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0028] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0029] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0030] The animation generation scheme provided in the embodiment of the present invention can be executed by an electronic device, which can be a terminal device such as a smart phone, a tablet computer, a PC, a laptop, etc. In an optional embodiment, a service program for executing the animation generation scheme can be installed on the electronic device.
[0031] The animation generation scheme provided in the embodiment of the present invention is suitable for creating scenes containing animations of various actions. The various actions are, for example, climbing actions, jumping actions, and running actions. In an optional embodiment, the various actions are performed by virtual characters in the animation.
[0032] The following takes the climbing action performed by the virtual character as an example to illustrate the technical problem that the technical solution provided by the embodiment of the present invention actually solves:
[0033] Animators can create an animation that includes climbing movements based on the scenery in the scene where the virtual character is located. If the scene where the virtual character is located changes, the previously produced animation may not match the changed scene. For example, the spacing between the rungs of the ladder in the scene where the virtual character is located increases. In this case, the limbs of the virtual character may penetrate the rungs or be suspended in the air during the climbing process. If the animator still re-creates the animation based on the changed scene, it will result in a large workload for the animator and low efficiency in generating the new animation. The IK technology is used to analyze the previously produced animation and determine the position of the virtual character's bones. Although the actions in the original animation can be directly transferred to the changed scene to generate a new animation based on the analysis results, the virtual character's movements in the new animation will be obviously jittery, the movement trajectory will not be smooth, and the visual effect will be poor.
[0034] In summary, how to make the movements of the virtual characters in the new animation match the changed scenery so as to improve the efficiency of animation generation and improve the visual effects of the new animation has become a technical problem that needs to be solved urgently.
[0035] In view of the technical problems mentioned above, the embodiments of the present invention provide an animation generation method, device, and apparatus. In summary, the solution ideas of the animation generation solution provided by the embodiments of the present invention are:
[0036] First, this scheme triggers the action execution instruction in the target scene loaded in the service program, and the action execution instruction is used to instruct the virtual character to perform a set of target actions in the target scene. Then, after the action execution instruction in the target scene is triggered, the service program responds to the action execution instruction and obtains the association data between a set of target actions performed by the virtual character and the target scene, which is referred to as the first association data in this article for distinction. The first association data can reflect the intrinsic association between the virtual character performing the set of target actions and the target scene, such as the relative position relationship between the virtual character performing the set of target actions and the associated scenery in the target scene, which is referred to as the target association object in this article for distinction. Therefore, a set of target images in which a set of target actions are performed by the virtual character can be generated through the first association data, so that the set of target actions performed by the virtual character can be accurately matched with the target scene in the target image, and finally a target animation including the set of target images is obtained.
[0037] In this solution, after triggering the action execution instruction in the target scene, by obtaining the first association data between a set of target actions executed by the virtual character and the target scene, and applying the internal association reflected by the first association data to the generation process of the target animation, the target action can be adaptively matched to different scenes in various target animations, which can not only improve the smoothness of the action trajectory, but also bring more realistic and natural visual effects to users. In addition, by applying the first association data to the generation process of the target animation, it also helps to reduce the workload caused by the traditional animation production solution and improve the efficiency of animation generation.
[0038] After introducing the basic idea of the animation generation solution, various non-limiting embodiments of the present invention are specifically described below.
[0039] The execution process of the animation generation method is described below in conjunction with the following embodiments.
[0040] Figure 1 A flowchart of an animation generation method provided by an embodiment of the present invention, such as Figure 1 As shown, the animation generation method includes the following steps:
[0041] 101. triggering an action execution instruction in a target scene, where the action execution instruction is used to instruct the virtual character to perform a set of target actions in the target scene;
[0042] 102. In response to the action execution instruction, obtain a set of first association data between target actions and target scenes;
[0043] 103. Generate a set of target images of the virtual character performing a set of target actions based on the first association data to obtain a target animation including a set of target images.
[0044] The animation generation method in the embodiment of the present invention is applied to a service program, and the target scene is loaded in the service program.
[0045] The target animation is the animation that is finally generated. In this article, the scene in which the virtual character is located (that is, the scene displayed in the target animation) is called the target scene, and the action that the virtual character needs to perform is called the target action. For example, the target action includes climbing action, jumping action, and running action.
[0046] First, an action execution instruction in the target scene is triggered, which instructs the virtual character to perform a set of target actions in the target scene.
[0047] In an optional embodiment, the action execution instruction in the target scene can be controlled by setting a control item in the service program. When the user selects the control item, the action execution instruction can be triggered. The specific implementation form of the control item is, for example, a button or a slider in the service program.
[0048] Alternatively, in another optional embodiment, the action execution instruction in the target scene can also be controlled by setting a trigger condition in the service program. For example, if the service program is a game client, and the trigger condition is that the virtual character completes a certain preset task, then when the virtual character completes the certain preset task, it can be regarded as meeting the trigger condition, thereby triggering the action execution instruction.
[0049] After triggering the action execution instruction in the target scene, the service program needs to obtain a set of first association data between the target action and the target scene in response to the action execution instruction.
[0050] In practical applications, after the action execution instruction is triggered, the action that the virtual character needs to perform can be calculated in real time. Optionally, a set of pre-generated first association data between the target action and the target scene can be retrieved.
[0051] Specifically, obtaining a set of first association data between target actions and target scenes can be implemented as follows:
[0052] Determine a plurality of body key points of the virtual character when performing a set of target actions, and obtain displacement trajectories of the plurality of body key points of the virtual character relative to a target associated object in a target scene as first associated data.
[0053] Through the above-mentioned method of obtaining the first associated data, it can be known that the first associated data actually reflects the relative position relationship between multiple body key points of the virtual character and the associated objects in the target scene when performing a set of target actions. Therefore, the first associated data can reflect the internal association between a set of target actions and the target scene. This internal association helps to determine the actual posture of the virtual character when performing the target action, so it can be applied to the target animation generation process described later.
[0054] Among them, the associated objects in the target scene refer to the objects in the target scene that the virtual character touches when performing a set of target actions, such as ladders, rocks, and chairs. For the sake of distinction, the associated objects in the target scene are referred to as target-associated objects in this paper.
[0055] In an embodiment of the present invention, the multiple body key points of the virtual character include limbs. The limbs include hands and feet. In an optional embodiment, the limbs can be represented by joints such as wrists and ankles. Taking the multiple body key points including limbs as an example, the first associated data includes displacement trajectories of the limbs relative to the target scene object.
[0056] For different types of virtual characters, multiple body key points corresponding to the virtual character when performing a set of target actions can be pre-set. For example, for a humanoid virtual character, joints such as wrists and ankles of the virtual character can be pre-set as multiple body key points.
[0057] To facilitate understanding of the meaning of the first associated data, the following first describes in detail how to obtain the displacement trajectories of multiple body key points of the virtual character relative to the target associated object in the target scene as the first associated data in conjunction with the accompanying drawings:
[0058] First, before obtaining the displacement trajectories of multiple body key points of the virtual character relative to the target associated object in the target scene as the first associated data, it is also necessary to obtain a set of reference images of the virtual character performing a set of target actions in the reference scene. Optionally, the virtual character performing a set of target actions in the reference image and the virtual character in the target scene described above can be the same virtual character.
[0059] Among them, the reference image should also have good image quality, such as the clarity and brightness of the image should be good. In practical applications, in order to ensure the continuity and integrity of the target action, a group of target actions is an action cycle. Therefore, in order to capture more action details, so as to ultimately improve the visual effect of the target animation to a greater extent, the above-mentioned set of reference images should be an animation clip corresponding to an action cycle. If the above-mentioned set of reference images includes multiple frames, the interval between each frame should be as small as possible.
[0060] It can be understood that a set of target actions can substantially represent a complete action with clear definitions, such as a climbing action or a jumping action.
[0061] To facilitate understanding of the meaning of the above set of target actions and the set of reference images, for example, assume that the reference associated object in the reference scene is a ladder. Assume that the reference image is an animation, and the animation includes a virtual character performing a climbing action on the ladder. Assume that the two image frames included in the animation are Figure 2a and Figure 2b In this example, the virtual character's limbs touching the horizontal bar can be regarded as the virtual character climbing onto the corresponding horizontal bar. Based on this, if the above set of target actions includes the action cycle of the virtual character climbing from horizontal bar 2 to horizontal bar 1 of the ladder, the above set of reference images can be captured from the above animation. Figure 2a As the starting frame, and Figure 2b A segment of animation that is the last frame.
[0062] Of course, in addition to capturing a set of reference images from the animation, in some optional embodiments, it is also possible to pre-set a section of animation footage with better image quality corresponding to a certain target action as a reference image based on the target action that may need to be generated in the actual application. Thus, for a certain target action that needs to be generated currently, a pre-set set of reference images corresponding to the target action can be directly used.
[0063] Furthermore, after acquiring a set of reference images, it is necessary to extract a set of association data between target actions and reference scenes from the set of reference images. For the sake of distinction, the association data between a set of target actions and reference scenes is referred to as second association data in this article. The second association data includes displacement trajectories of multiple body key points of the virtual character relative to the associated objects in the reference scene. The objects in the reference scene that the virtual character in the reference scene touches when performing a set of target actions are referred to as reference associated objects in this article.
[0064] Specifically, from the above set of reference images, extracting a set of association data between target actions and reference scenes can be specifically implemented as follows:
[0065] Calibrate multiple contact points on a reference associated object corresponding to a set of climbing actions; and obtain, from a set of reference images, displacement trajectories of the limbs of the virtual character relative to the multiple contact points on the reference associated object when the virtual character performs a set of climbing actions.
[0066] In order to facilitate understanding of the meaning of the second association data, an example is given here with reference to the accompanying drawings to illustrate how to extract a set of second association data between a set of target actions and reference scenes from a set of reference images:
[0067] Assume that a set of target actions performed by a virtual character in a reference scene in a set of reference images includes a set of climbing actions. Assume that the multiple body key points of the virtual character include limbs, and the reference associated object in the reference scene includes a ladder. For distinction, the ladder in the reference scene is referred to as a first ladder in this article. Optionally, the intervals between the rungs in the first ladder are equal, that is, the multiple rungs in the first ladder are evenly distributed.
[0068] Based on the above assumptions, multiple contact points formed by multiple horizontal bars on the first ladder corresponding to a set of climbing actions are calibrated. Specifically, when the virtual character performs a set of climbing actions, the four limbs will each form multiple contact points with the multiple horizontal bars, and these contact points are calibrated respectively. Then, from a set of reference images, the displacement trajectories of the four limbs of the virtual character relative to the above multiple contact points when the virtual character performs a set of climbing actions are obtained. Optionally, the displacement trajectories of the four limbs of the virtual character relative to the multiple contact points include: multiple contact points corresponding to each of the four limbs of the virtual character, and the displacement trajectories of each between the contact points.
[0069] For example, the three horizontal bars on the first ladder that the left hand of the virtual character touches when performing a set of climbing actions are calibrated to obtain the following: Figure 3 From a set of reference images, extract the following Figure 3 It should be noted that in actual applications, since the left hand of the virtual character will contact the three horizontal bars, Figure 3 The displacement trajectory t1 shown in the figure has contact points with the crossbar a1, crossbar b1, and crossbar c1. Figure 3 Similarly, the following Figure 4 and Figure 5 No similar contact points are indicated in FIG.
[0070] After the above processing of a group of reference images, the displacement trajectory of the limbs of the virtual character included in the second associated data relative to the reference associated object in the reference scene can be obtained. The displacement trajectory will also be one of the bases for the subsequent generation of a group of target actions performed by the virtual character in the target scene, that is, the displacement trajectory will be one of the bases for the subsequent generation of a group of target images.
[0071] It should be noted that the naming of the first associated data and the second associated data is only used to distinguish the associated data between a group of target actions and different scenes, and does not represent the order in which the two associated data are generated.
[0072] In addition to the limbs, the displacement trajectories of other body key points relative to the reference associated objects can also be obtained through the above steps, which is not limited here.
[0073] Finally, after extracting a set of second association data between the target action and the reference scene, the displacement trajectories of the multiple body key points relative to the target associated object in the target scene are obtained as the first association data, which can be specifically implemented as follows:
[0074] Based on the correspondence between the reference associated object and the target associated object, the second associated data is transformed to obtain the first associated data.
[0075] The corresponding relationship between the reference associated object and the target associated object includes the corresponding relationship between each contact point on the reference associated object and each contact point on the target associated object.
[0076] Specifically, based on the correspondence between the reference associated object and the target associated object, the second associated data is transformed to obtain the first associated data, which can be implemented as follows:
[0077] Based on the correspondence between each contact point on the reference associated object and each contact point on the target associated object, the ratio of the spacing between each contact point on the target associated object to the spacing between each contact point on the corresponding reference associated object is determined, and then, based on the ratio, the second associated data is scaled and transformed to obtain a set of first associated data between the climbing action and the target associated object.
[0078] Through the above-mentioned generation process of the first associated data, it can be known that by converting the relative position relationship between multiple body key points of the virtual character and the reference associated objects in the reference scene (i.e., the second associated data) into the relative position relationship between multiple body key points of the virtual character and the target associated objects in the target scene (i.e., the first associated data), a set of target actions performed by the virtual character can be matched with the target associated objects in the target scene, that is, the target actions can be adapted to various scenes, which helps to bring more realistic and natural visual effects to users.
[0079] In the embodiment of the present invention, the target associated object in the target scene is obtained by deforming the reference associated object in the reference scene, so there are certain differences in some properties between the two. Some properties are such as shape and material. For different objects, the deformation method is also different.
[0080] In an optional embodiment, assuming that the reference associated object in the reference scene is sponge pad a, by changing the material of sponge pad a from material 1 to material 2, a sponge pad b made of material 2 can be obtained, and the sponge pad b is the target associated object in the target scene. If a set of target actions is a jumping action performed on a sponge pad, then based on the corresponding relationship between sponge pad a and sponge pad b in elastic modulus, the motion trajectory of the virtual character's feet when jumping on sponge pad a is transformed, and the motion trajectory of the virtual character's feet when jumping on sponge pad b can be obtained. Assuming that the elastic modulus of material 2 is greater than the elastic modulus of material 1, the depth of the virtual character's feet sinking into sponge pad b is greater.
[0081] In another optional implementation, assuming that the reference associated object in the reference scene is a first ladder, by changing the rung spacing distribution of the first ladder from uniform distribution to uneven distribution, a second ladder with uneven rung spacing distribution can be obtained, and the second ladder is the target associated object in the target scene.
[0082] The following example illustrates how to transform the second associated data to obtain the first associated data based on the correspondence between the reference associated object and the target associated object:
[0083] Assume that a set of target actions includes a set of climbing actions. Assume that the plurality of body key points of the virtual character include limbs. Assume that the reference associated object in the reference scene is a first ladder. Assume that the target associated object in the target scene is a second ladder.
[0084] Based on the above assumption, the correspondence between each contact point on the reference associated object and each contact point on the target associated object includes: the correspondence between each crossbar in the second ladder and each crossbar in the first ladder, that is, each crossbar in the second ladder corresponds to each crossbar in the first ladder. Optionally, the correspondence between each crossbar in the second ladder and each crossbar in the first ladder at least includes: each crossbar in the first ladder that contacts the limbs of the virtual character corresponds to each crossbar in the second ladder that contacts the limbs of the virtual character.
[0085] Optionally, there are multiple methods for obtaining the correspondence between each crossbar in the second ladder and each crossbar in the first ladder, one of which can be implemented as follows: after calibrating multiple crossbars on the first ladder corresponding to a set of climbing actions, for the calibrated crossbar i on the first ladder, determine the crossbar j on the second ladder that has the same arrangement order as the crossbar i, and establish the correspondence between the crossbar j on the second ladder and the crossbar i on the first ladder. Wherein, the crossbar i is any one of the multiple crossbars calibrated on the first ladder. The arrangement order refers to the arrangement order of all crossbars on each ladder, such as the arrangement order of all crossbars on the second ladder from low to high. The process of obtaining the correspondence between other crossbars in the second ladder and other crossbars in the first ladder is consistent with the process of obtaining the correspondence between the crossbar j in the second ladder and the crossbar i in the first ladder, and will not be repeated.
[0086] Furthermore, based on the above assumption, the distance between the rungs of the two ladders can be regarded as the distance between the contact points. Therefore, the ratio of the distance between the contact points on the target associated object to the distance between the contact points on the corresponding reference associated object is specifically the ratio of the distance between the rungs in the second ladder to the distance between the rungs in the corresponding first ladder. Furthermore, based on the ratio of the distance between the rungs in the second ladder (i.e., the target associated object) to the distance between the rungs in the corresponding first ladder (i.e., the reference associated object), the second associated data is scaled and transformed to obtain a set of first associated data between the climbing action and the second ladder.
[0087] Continuing with the above assumption, for example, the horizontal bars touched by the left hand of the virtual character in the first ladder are marked as follows: Figure 3 Based on the corresponding relationship between the crossbars in the second ladder and the crossbars in the first ladder, the three crossbars in the second ladder corresponding to the above three crossbars are respectively as follows: Figure 3 The crossbars a2, b2, and c2 are shown. Then, the distance H between the crossbars a2 and b2 in the second ladder is determined. ab2 The distance H between the crossbar a1 and the crossbar b1 in the corresponding first ladder ab1 The ratio H ab2 / H ab1 , and determine the distance H between the crossbars b2 and c2 in the second ladder bc2 The distance H between the crossbar b1 and the crossbar c1 in the corresponding first ladder bc1 The ratio H bc2 / H bc1 .
[0088] Furthermore, if H ab2 / H ab1 and H bc2 / H bc1 are all less than 1, then Figure 3The displacement trajectory t1 of the left hand of the virtual character relative to the horizontal bars a1, b1, c1 is reduced and transformed to obtain the following Figure 4 The displacement trajectory t2 of the virtual character's left hand relative to the horizontal bars a2, b2, c2 is shown.
[0089] Or, if H ab2 / H ab1 is greater than 1, and H bc2 / H bc1 If is less than 1, then Figure 3 The upper half of the displacement trajectory t1 of the left hand of the virtual character relative to the horizontal bars a1 and b1 is enlarged and transformed. Figure 3 The lower half of the displacement trajectory t1 of the left hand of the virtual character relative to the horizontal bars b1 and c1 is reduced and transformed, and finally the transformed displacement trajectories are combined to obtain the following: Figure 5 The displacement trajectory t3 of the left hand of the virtual character relative to the horizontal bars a2, b2, c2 is shown.
[0090] Similar to the process of obtaining the displacement trajectory of the virtual character's left hand relative to multiple horizontal bars, the displacement trajectories of the virtual character's right hand, left foot, and right foot relative to multiple horizontal bars are obtained, so that the displacement trajectories of the virtual character's left hand, right hand, left foot, and right foot relative to multiple horizontal bars are used as the first associated data.
[0091] The above describes the process of transforming the second associated data to obtain the first associated data based on the correspondence between the reference associated object and the target associated object.
[0092] In actual applications, for different actions, it is not necessary to pay attention to the displacement trajectory of the virtual character's limbs relative to the target associated object. For example, in a jumping action, the main focus is on the displacement trajectory of the virtual character's feet relative to the target associated object, that is, the two ankle joints.
[0093] In addition to the limbs described above, the multiple body key points of the virtual character in the embodiment of the present invention also include root joints. In an optional embodiment, a joint is designated as the root joint from the multiple joints of the virtual character. The designated root joint can be any joint other than the wrist, ankle, etc.
[0094] Optionally, obtaining the displacement trajectories of multiple body key points relative to the target associated object in the target scene as the first associated data may also be specifically implemented as follows:
[0095] The displacement speed or displacement distance of the root joint relative to the target associated object is obtained as the first associated data.
[0096] The first associated data also includes a movement trajectory of the root joint relative to the target associated object in the target scene, that is, a displacement speed of the root joint relative to the target associated object and a displacement distance of the root joint relative to the target associated object. The movement trajectory of the root joint relative to the target associated object in the target scene can reflect the overall movement trajectory of the virtual character. The calculation method of the displacement trajectory of the root joint is different for target associated objects in different scenes.
[0097] The following still takes the target associated object as the second ladder as an example to explain how to obtain the displacement speed or displacement distance of the root joint relative to the target associated object as the first associated data:
[0098] In an optional embodiment, obtaining the displacement speed of the root joint relative to the target associated object as the first associated data can be implemented as follows:
[0099] A plurality of contact points corresponding to a set of climbing actions on the target-associated object are determined, and then, if the distances between the contact points in the target-associated object are equal, a ratio of the total distance between the plurality of contact points to the duration corresponding to a set of climbing actions is used as the displacement speed of the root joint relative to the target-associated object.
[0100] The following still takes the second ladder as an example, assuming that the horizontal bars in the second ladder are equally spaced, that is, the horizontal bars in the second ladder are evenly distributed. Then, the multiple contact points on the target-related object corresponding to a set of climbing actions are the horizontal bars of the second ladder, that is:
[0101] The ratio of the total spacing of the plurality of horizontal bars to the duration corresponding to the set of climbing actions is used as the displacement speed of the root joint of the virtual character relative to the second ladder. root The formula is as follows:
[0102] V root =H rung *2 / T ladder
[0103] Among them, H rung *2 indicates the total horizontal distance corresponding to a set of target actions. ladder It is the duration corresponding to a set of climbing actions, that is, the length of time corresponding to executing a set of target actions.
[0104] In another possible embodiment, obtaining the displacement distance of the root joint relative to the target associated object as the first associated data may be implemented as follows:
[0105] Determine multiple contact points on the target-associated object corresponding to a set of climbing actions. Furthermore, if there are multiple contact points with unequal spacing in the target-associated object, for two frames of images corresponding to a set of climbing actions, take the average value of the distance difference between the limbs of the virtual character in the two frames of images as the displacement distance of the root joint relative to the target-associated object in the two frames of images.
[0106] It is understandable that the displacement distance can be a lateral distance or a longitudinal distance. For example, the displacement distance of the root joint relative to the ladder is actually the displacement height of the root joint relative to the ladder.
[0107] The following still takes the target-related object as the second ladder as an example, assuming that the intervals between the horizontal bars in the second ladder are not equal, that is, the horizontal bars in the second ladder are unevenly distributed. Then, the multiple contact points on the target-related object corresponding to a set of climbing actions are the horizontal bars of the second ladder, that is:
[0108] For a set of two images corresponding to a climbing action, the average value of the distance difference between the limbs of the virtual character in the two images is used as the displacement distance of the root joint of the virtual character relative to the second ladder in the two images. root The formula is as follows:
[0109] ⊿H root =(⊿H leftfoot +⊿H rightfoot +⊿H lefthand +⊿H righthand) / 4
[0110] Among them, ⊿H leftfoot , ⊿H rightfoot , ⊿H lefthand , ⊿H righthand They are the distance differences corresponding to the left ankle, right ankle, left wrist, and right wrist in the two frames of images respectively.
[0111] By taking the average value of the distance difference between the limbs of the virtual character in the two frames of images as the displacement distance of the root joint of the virtual character relative to the second ladder in the two frames of images, the root joint of the virtual character can be displaced in coordination with the limbs of the virtual character, thereby realizing dynamic adjustment of the displacement trajectory of the root joint of the virtual character.
[0112] The above introduces two processes of how to obtain the displacement trajectory of the root joint relative to the target associated object as the first associated data.
[0113] It should be understood that, when the multiple body key points of the virtual character include limbs and root joints, if the target associated object in the target scene changes, the displacement trajectory of the limbs relative to the target associated object in the first associated data changes synchronously with the displacement trajectory of the root joint relative to the target associated object. Of course, in actual applications, if the first associated data also includes associated data corresponding to other body key points of the virtual character, they also need to change synchronously.
[0114] After the first association data is acquired, a group of target images of a virtual character performing a group of target actions is generated based on the first association data to obtain a target animation including a group of target images.
[0115] In order to ensure the continuity and integrity of the target action in practical applications, a group of target actions is usually regarded as an action cycle. Therefore, similar to a group of reference images, the above group of target images should be an animation clip corresponding to an action cycle, so that the target animation has a more natural and smooth visual effect. If the above group of target images includes multiple frames, the interval between each frame should be as small as possible.
[0116] It is understandable that, in actual applications, the target action may include multiple groups of target actions. These multiple groups of target actions may change according to changes in the target scene. For example, during the process of the virtual character performing a climbing action, the distance between the ladders in the target scene changes multiple times, then the climbing action may be divided into multiple groups, and the first association data between each group of climbing actions and the target scene may be obtained, thereby generating each group of target images based on the first association data corresponding to each group of climbing actions, so as to obtain a target animation including a group of target images.
[0117] Based on the above description of the first associated data, it can be seen that the intrinsic association between the virtual character performing a set of target actions and the target scene can be reflected. Therefore, based on the first associated data, the virtual character in the target image can be matched with the target scene, which helps to improve the efficiency of animation generation, improve the smoothness of the action trajectory of the virtual character in the target image, and make the target animation have a more natural and realistic visual effect, greatly improving the user's visual experience.
[0118] Furthermore, since neither the process of acquiring the first associated data nor the process of generating the target animation based on the first associated data requires manual re-production of the virtual character's movements, the workload caused by manual re-production of new animations in traditional solutions can be reduced, thereby effectively improving animation generation efficiency.
[0119] Based on the above Figure 1 The introduction of the animation generation method shown above is used to more intuitively understand the execution process of the above animation generation method, and the following embodiments are combined to exemplarily illustrate how to generate a target animation.
[0120] In an optional embodiment, a practical application scenario is assumed: generating an animation of performing a climbing action on ladder a (ie, target animation).
[0121] By selecting the action execution option in the client, the action execution instruction in the target scene loaded by the client is triggered, and the action execution instruction is used to instruct the virtual climber (i.e., the virtual character) to perform a set of climbing actions on the ladder a in the target scene. Then, in response to the action execution instruction, the client obtains the displacement trajectory (i.e., the first associated data) between the virtual climber's limbs and the ladder a when executing a set of sub-climbing actions currently performed by the virtual climber between the horizontal bar 1 and the horizontal bar 2 of the ladder a. Based on the displacement trajectory, a set of images (i.e., the target image) of the virtual climber performing the climbing action between the horizontal bar 2 and the horizontal bar 3 of the ladder a is generated. By analogy, each set of images corresponding to the virtual climber performing the climbing action between the horizontal bars on the ladder a is generated in real time, thereby combining to obtain an animation of the virtual climber performing the climbing action on the ladder a.
[0122] In another optional embodiment, a practical application scenario is also assumed: generating an animation of jumping between rocks exposed on the river surface (ie, target animation).
[0123] After the character m controlled by the user in the client completes the specified task, the action execution instruction in the target scene loaded by the client is triggered, and the action execution instruction is used to instruct the character m (i.e., the virtual character) to perform a set of jumping actions on the rocks by the river. In response to the action execution instruction, the client obtains the displacement trajectory (i.e., the first associated data) between the feet of the character m and the above two rocks when executing the set of jumping actions, for the set of jumping actions currently performed by the character m between rock 1 and rock 2. Based on the displacement trajectory, a set of images (i.e., the target image) of the character m performing the jumping action between rock 2 and rock 3 is generated. By analogy, the corresponding sets of images when the character m performs the jumping action between the rocks exposed on the river surface are generated in real time, thereby combining to obtain an animation of the character m performing the jumping action on the rocks exposed on the river surface.
[0124] Figure 1During the execution of the animation generation method shown, by obtaining the first association data between a set of target actions performed by the virtual character and the target scene, and applying the intrinsic association between the virtual character and the target scene reflected by the first association data to the generation process of the target animation, the target action can be matched with the target scene in the target animation, which helps to improve the efficiency of animation generation, improve the smoothness of the action trajectory, and bring a more realistic and natural visual effect to the user. In addition, since the execution process of the animation generation method can achieve the matching process of the target action and the target scene without manually reproducing the action of the virtual character, it effectively reduces the workload caused by the traditional animation production scheme, and also helps to improve the efficiency of animation generation.
[0125] The following will describe in detail the animation generation device of one or more embodiments of the present invention. Those skilled in the art will appreciate that these animation generation devices can be configured using commercially available hardware components through the steps taught in this solution.
[0126] Figure 6 Schematic diagram of the structure of an animation generation device provided by an embodiment of the present invention. The animation generation device is loaded with a target scene, such as Figure 6 As shown, the animation generating device includes: a triggering module 11, a first acquiring module 12, and a generating module 13.
[0127] A trigger module 11, used to trigger an action execution instruction in the target scene, wherein the action execution instruction is used to instruct the virtual character to perform a set of target actions in the target scene;
[0128] A first acquisition module 12, configured to acquire first association data between the set of target actions and the target scene in response to the action execution instruction;
[0129] The generating module 13 is used to generate a set of target images of the virtual character performing the set of target actions based on the first association data, so as to obtain a target animation including the set of target images.
[0130] Optionally, the first acquisition module 12 is specifically used to: determine multiple body key points of the virtual character when executing the set of target actions; and obtain displacement trajectories of the multiple body key points relative to the target-associated object in the target scene as the first associated data.
[0131] Optionally, the animation generating device further includes a second acquiring module.
[0132] The second acquisition module is specifically used to: before the first acquisition module acquires the displacement trajectories of the multiple body key points relative to the target associated object in the target scene as the first associated data, acquire a set of reference images of a virtual character performing a set of target actions in a reference scene; from the set of reference images, extract the second associated data between the set of target actions and the reference scene, wherein the second associated data includes the displacement trajectories of the multiple body key points of the virtual character relative to the reference associated object in the reference scene.
[0133] When acquiring the displacement trajectories of the multiple body key points relative to the target associated object in the target scene as the first associated data, the first acquisition module 12 is specifically used to: based on the correspondence between the reference associated object and the target associated object, transform the second associated data extracted by the second acquisition module to obtain the first associated data.
[0134] Optionally, the multiple body key points include limbs, and the first associated data includes displacement trajectories of the limbs relative to the target scene object.
[0135] Optionally, the set of target actions includes a set of climbing actions.
[0136] When the second acquisition module extracts the second association data between the set of target actions and the reference scene from the set of reference images, it is specifically used to: calibrate multiple contact points on the reference association object corresponding to the set of climbing actions; and obtain, from the set of reference images, the displacement trajectories of the limbs of the virtual character relative to the multiple contact points on the reference association object when the virtual character performs the set of climbing actions.
[0137] Optionally, the correspondence between the reference associated object and the target associated object includes a correspondence between each contact point on the reference associated object and each contact point on the target associated object.
[0138] When the first acquisition module 12 transforms the second associated data based on the correspondence between the reference associated object and the target associated object to obtain the first associated data, it is specifically used to: determine the ratio of the spacing between each contact point on the target associated object to the corresponding spacing between each contact point on the reference associated object based on the correspondence between each contact point on the reference associated object and each contact point on the target associated object; and scale the second associated data based on the ratio to obtain the first associated data between the set of climbing actions and the target associated object.
[0139] Optionally, the plurality of body key points further include a root joint.
[0140] When acquiring the displacement trajectories of the multiple body key points relative to the target associated object in the target scene as the first associated data, the first acquisition module 12 is specifically used to: acquire the displacement speed or displacement distance of the root joint relative to the target associated object as the first associated data.
[0141] Optionally, the set of target actions includes a set of climbing actions.
[0142] When acquiring the displacement speed of the root joint relative to the target-associated object as the first associated data, the first acquisition module 12 is specifically used to: determine multiple contact points on the target-associated object corresponding to the set of climbing actions; if the spacing between the contact points in the target-associated object is equal, then the ratio of the total spacing between the multiple contact points to the duration corresponding to the set of climbing actions is used as the displacement speed of the root joint relative to the target-associated object.
[0143] Optionally, the set of target actions includes a set of climbing actions.
[0144] When acquiring the displacement distance of the root joint relative to the target-associated object as the first associated data, the first acquisition module 12 is specifically used to: determine multiple contact points on the target-associated object corresponding to the set of climbing actions; if there are multiple contact points in the target-associated object with unequal spacing, then for two frames of images corresponding to the set of climbing actions, the average value of the distance difference between the limbs of the virtual character in the two frames of images is used as the displacement distance of the root joint relative to the target-associated object in the two frames of images.
[0145] Figure 6 The animation generating device shown can execute the methods provided in the aforementioned embodiments. For the parts not described in detail in this embodiment, reference can be made to the relevant descriptions of the aforementioned embodiments, which will not be repeated here.
[0146] In one possible design, the above Figure 6 The structure of the animation generating device shown can be implemented as an electronic device.
[0147] like Figure 7 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 stores executable code, and when the executable code is executed by the processor 21, the processor 21 can at least implement the animation generation method provided in the above embodiment. The structure of the electronic device may also include a communication interface 23 for communicating with other devices or communication networks.
[0148] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of a wireless router, the processor executes the animation generation method provided in the aforementioned embodiments.
[0149] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0150] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or contribute to the part in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An animation generation method, characterized in that: The method is applied to a service program, in which a target scene is loaded, and the method comprises: triggering an action execution instruction in the target scene, wherein the action execution instruction is used to instruct the virtual character to perform a set of target actions in the target scene; In response to the action execution instruction, determining a plurality of body key points of the virtual character when performing the set of target actions, the plurality of body key points including a root joint; Determining whether the distances between multiple contact points corresponding to the set of target actions on the target-associated object in the target scene are equal; Based on the judgment result, a displacement speed or a displacement distance of the root joint relative to the target associated object is obtained as first associated data, wherein the first associated data is determined by obtaining displacement trajectories of the multiple body key points relative to the target associated object in the target scene; generating a set of target images of the virtual character performing the set of target actions based on the first association data, so as to obtain a target animation including the set of target images; The step of generating a set of target images in which the virtual character performs the set of target actions based on the first association data to obtain a target animation including the set of target images comprises: Based on the displacement trajectory, a set of target images of the virtual character performing the set of target actions is generated, and a target animation including the set of target images is obtained by combining the set of target images.
2. The method according to claim 1, characterized in that The set of target actions includes a set of climbing actions; The obtaining, based on the judgment result, the displacement speed or the displacement distance of the root joint relative to the target associated object as the first associated data includes: If the distances between the contact points in the target-associated object are equal, the ratio of the total distance between the multiple contact points to the duration corresponding to the set of climbing actions is used as the displacement speed of the root joint relative to the target-associated object.
3. The method according to claim 2, characterized in that The set of target actions includes a set of climbing actions; The obtaining, based on the judgment result, the displacement speed or the displacement distance of the root joint relative to the target associated object as the first associated data includes: If there are multiple contact points with unequal spacing in the target-associated object, then for the two frames of images corresponding to the set of climbing actions, the average value of the distance difference between the limbs of the virtual character in the two frames of images is used as the displacement distance of the root joint relative to the target-associated object in the two frames of images.
4. The method according to claim 1, characterized in that: Also includes: The displacement trajectories of the multiple body key points relative to the target associated object in the target scene are obtained as the first associated data.
5. The method according to claim 4, characterized in that Before obtaining the displacement trajectories of the plurality of body key points relative to the target associated object in the target scene as the first associated data, the method further includes: Obtaining a set of reference images of a virtual character performing a set of target actions in a reference scene; Extracting second association data between the set of target actions and the reference scene from the set of reference images, wherein the second association data includes displacement trajectories of a plurality of body key points of the virtual character relative to a reference association object in the reference scene; The step of obtaining displacement trajectories of the plurality of body key points relative to the target associated object in the target scene as the first associated data includes: Based on the correspondence between the reference associated object and the target associated object, the second associated data is transformed to obtain the first associated data.
6. The method according to claim 5, characterized in that The multiple body key points include limbs, and the first associated data includes displacement trajectories of the limbs relative to the target scene object.
7. The method according to claim 6, characterized in that The set of target actions includes a set of climbing actions; The step of extracting second association data between the set of target actions and the reference scene from the set of reference images comprises: calibrating a plurality of contact points on the reference associated object corresponding to the set of climbing actions; From the set of reference images, displacement trajectories of the limbs of the virtual character relative to multiple contact points on the reference associated object when the virtual character performs the set of climbing actions are obtained.
8. The method according to claim 7, characterized in that The correspondence between the reference associated object and the target associated object includes a correspondence between each contact point on the reference associated object and each contact point on the target associated object; The transforming the second associated data based on the correspondence between the reference associated object and the target associated object to obtain the first associated data includes: Determine, based on the correspondence between each contact point on the reference associated object and each contact point on the target associated object, a ratio of the spacing between each contact point on the target associated object to the spacing between each contact point on the corresponding reference associated object; The second association data is scaled and transformed based on the ratio to obtain first association data between the set of climbing actions and the target association object.
9. An animation generating device, characterized in that: The device is loaded with a target scene, and the device comprises: A trigger module, used to trigger an action execution instruction in the target scene, wherein the action execution instruction is used to instruct the virtual character to perform a set of target actions in the target scene; an acquisition module, configured to determine, in response to the action execution instruction, a plurality of body key points of the virtual character when executing the set of target actions, the plurality of body key points including root joints; determine whether the spacing between a plurality of contact points corresponding to the set of target actions on a target-associated object in the target scene is equal; and obtain a displacement speed or a displacement distance of the root joint relative to the target-associated object as first associated data based on the determination result, the first associated data being determined by obtaining a displacement trajectory of the plurality of body key points relative to the target-associated object in the target scene; A generating module, configured to generate a set of target images of the virtual character performing the set of target actions based on the first association data, so as to obtain a target animation including the set of target images; The generation module is specifically used to generate a set of target images of the virtual character performing the set of target actions based on the displacement trajectory, and obtain a target animation including the set of target images by combining the set of target images.
10. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable codes, and when the executable codes are executed by the processor, the processor executes the animation generation method according to any one of claims 1 to 8.
Citation Information
Patent Citations
System and method for automatically adapting gait of virtual character to terrain
CN103514622A
Dynamic bone implementation method and device in animation
CN107067451A
