Method, apparatus, device, and storage medium for generating walking animation of virtual character

By predicting the movement speed and direction of the virtual character, the footing point and the position of each leg are calculated, and combining reverse dynamics and gait fusion, realistic walking animation is generated, which solves the sliding phenomenon of multi-legged mecha virtual characters and realizes a natural walking animation effect.

CN114283229BActive Publication Date: 2025-07-11TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111628788.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2021-11-19
Filing Date
2021-12-28
Publication Date
2025-07-11
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

In realistic battle style games, multi-legged mecha virtual characters are prone to slip during walking, resulting in unnatural animation.

Method used

By predicting the movement speed and direction of the virtual character, the footing point and swing stage position of each leg is calculated, combining reverse dynamics and gait fusion to generate realistic walking animations.

Benefits of technology

It effectively eliminates the slipping problem, generates natural walking animations that adapt to different speeds and directions, and improves the fidelity of the sports performance of virtual characters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114283229B_ABST
    Figure CN114283229B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and storage medium for generating a walking animation of a virtual character, belonging to the field of animation production. The method includes: predicting the landing points of each leg of the virtual character during the walking process according to the moving speed and moving direction of the virtual character; calculating the positions of the feet of each leg during the swing phase according to two adjacent landing points of each leg; performing inverse kinematics calculation based on the positions of the feet of each leg during the swing phase to obtain the positions of the bone points of each leg during the swing phase; and generating a walking animation of the virtual character based on the positions of the bone points of each leg during the swing phase through gait fusion.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims the priority of a Chinese patent application with the application number 202111374361.9 and the invention title "Method, Device, Equipment and Storage Medium for Generating Walking Animation of Virtual Characters" filed on November 19, 2021, the entire content of which is incorporated herein by reference. Technical Field

[0002] This application relates to the field of animation production, and particularly to a method, device, equipment and storage medium for generating walking animation of virtual characters. Background Art

[0003] In realistic battle-style games, virtual characters of multi-legged mechs often appear. The characteristics of multi-legged mechs are a strong sense of weight and oppression, just like a stable and advancing mobile fortress that cannot be stopped.

[0004] In the related art, animation blending technology is used to generate the walking animation of multi-legged mechs. For each bone that needs to be blended in the multi-legged mech, the transformation matrices in the source animation pose and the target animation pose are respectively obtained, and with a weight value α that changes from 0 to 1 over time, it is blended by interpolation to obtain a new transformation matrix. For example, when the multi-legged mech changes from a walking pose to a standing pose, the animation sequences of the walking pose and the standing pose will be played simultaneously during the transition period, and the playing weight α will be slowly transferred from the walking pose to the standing pose according to the progress of the transition, so as to achieve a smooth transition effect.

[0005] However, since the moving speed and moving direction of the virtual character are constantly changing, in some cases, such as when the position of the supporting leg of the multi-legged mech is relatively far apart in the two animation sequences, the user will clearly see this supporting leg "slide" a certain distance along the ground. This inconsistent phenomenon that does not occur in the real world is the "skipping" phenomenon. Summary of the Invention

[0006] This application provides a method, device, equipment and storage medium for generating walking animation of virtual characters, and provides a programmatic walking animation generation solution. The technical solution is as follows:

[0007] According to one aspect of this application, a method for generating walking animation of virtual characters is provided. In the method for generating walking animation of virtual characters, each leg of the virtual character alternately executes a swing phase and a support phase during walking. The method includes:

[0008] Predict the landing points of each leg of the virtual character during the walking process according to the moving speed and moving direction of the virtual character;

[0009] Calculate the position of the foot of each leg during the swing phase based on two adjacent landing points of each leg;

[0010] Perform inverse dynamics calculation based on the position of the foot of each leg during the swing phase to obtain the position of the bone points of each leg during the swing phase;

[0011] Generate the walking animation of the virtual character based on the position of the bone points of each leg during the swing phase through gait fusion.

[0012] According to another aspect of the present application, there is provided a device for generating a walking animation of a virtual character. Each leg of the virtual character alternately executes a swing phase and a support phase during walking. The device includes:

[0013] A prediction module for predicting the landing points of each leg of the virtual character during the walking process according to the moving speed and moving direction of the virtual character;

[0014] A calculation module for calculating the position of the foot of each leg during the swing phase based on two adjacent landing points of each leg;

[0015] An IK module for performing inverse dynamics calculation based on the position of the foot of each leg during the swing phase to obtain the position of the bone points of each leg during the swing phase;

[0016] A fusion module for generating the walking animation of the virtual character based on the position of the bone points of each leg during the swing phase through gait fusion.

[0017] According to one aspect of the present application, there is provided a computer device, which includes: a processor and a memory. The memory stores a computer program, and the computer program is loaded and executed by the processor to implement the method for generating a walking animation of a virtual character as described above.

[0018] According to another aspect of the present application, there is provided a computer-readable storage medium, which stores a computer program, and the computer program is loaded and executed by a processor to implement the method for generating a walking animation of a virtual character as described above.

[0019] According to another aspect of the present application, there is provided a computer program product, which includes computer instructions. The computer instructions are stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for generating a walking animation of a virtual character provided in the above aspect.

[0020] The beneficial effects brought by the technical solutions provided in the embodiments of the present application at least include:

[0021] By first calculating the foot movements of each leg according to the movement speed and direction of the virtual character, and then performing gait fusion of each leg, it is possible to generate the walking animations of each leg of the virtual character in a procedural form. Regardless of the movement speed and direction of the virtual character, corresponding walking animations can always be adaptively generated, and the sliding problem caused by traditional animation blending techniques will not occur. Brief Description of the Drawings

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for description in the embodiments. Obviously, the following-described drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0023] Figure 1 Shows the structural block diagram of a computer system provided by an embodiment;

[0024] Figure 2 Shows the analysis schematic diagram of the walking movement of a humanoid virtual character provided by an embodiment;

[0025] Figure 3 Shows the flowchart of the method for generating the walking animation of a virtual character provided by an embodiment;

[0026] Figure 4 Shows the schematic diagram of the bone points on the mecha legs of different forms provided by an embodiment;

[0027] Figure 5 Shows the schematic diagram of the gait progress when different legs are gait-fused provided by an embodiment;

[0028] Figure 6 Shows the schematic diagram of the method for generating the walking animation of a virtual character provided by an embodiment;

[0029] Figure 7 Shows the schematic diagram of the prediction principle of the landing point provided by another embodiment;

[0030] Figure 8 Shows the data structure diagram of the gait parameters provided by an embodiment;

[0031] Figure 9 Shows the schematic diagram of the method for generating the walking animation of a virtual character provided by an embodiment;

[0032] Figure 10 Shows the schematic diagram of mixing different gait parameters into a transition animation provided by an embodiment;

[0033] Figure 11 Schematic diagram showing a method for generating a walking animation of a virtual character provided by an embodiment;

[0034] Figure 12 Schematic diagram showing a leg swinging curve with swing optimization provided by an embodiment;

[0035] Figure 13 Schematic diagram showing a leg swinging curve when encountering a small obstacle provided by an embodiment;

[0036] Figure 14 Schematic diagram showing a method for generating a walking animation of a virtual character provided by an embodiment;

[0037] Figure 15 Schematic diagram showing a method for generating a walking animation of a virtual character provided by an embodiment;

[0038] Figure 16 Vibration model diagram of the skeleton of a virtual character during inertial vibration provided by an embodiment;

[0039] Figure 17 Schematic diagram showing the sequential vibration of multi - level skeleton nodes provided by an embodiment;

[0040] Figure 18 Landing point correction diagram of a virtual character when encountering an uneven ground provided by an embodiment;

[0041] Figure 19 Body correction diagram of a virtual character when encountering an uneven ground provided by an embodiment;

[0042] Figure 20 Foot correction diagram of a virtual character when encountering an uneven ground provided by an embodiment;

[0043] Figure 21 Body adjustment diagram of a virtual character when encountering a raised ground provided by another embodiment;

[0044] Figure 22 Structural block diagram of a device for generating a walking animation of a virtual character provided by an embodiment;

[0045] Figure 23 Structural block diagram of a computer device provided by an embodiment. Detailed implementation manners

[0046] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0047] It should be understood that "a number of" as mentioned herein refers to one or more, and "a plurality of" refers to two or more. "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.

[0048] First, a brief introduction to the nouns involved in the embodiments of the present application is given:

[0049] Virtual environment: It is a virtual environment displayed (or provided) when an application runs on a terminal. This virtual environment can be a simulation environment of the real world, a semi-simulation and semi-fictional environment, or a purely fictional environment. The virtual environment can be any one of a two-dimensional virtual environment, a 2.5D virtual environment, and a three-dimensional virtual environment, and the present application does not limit this. The following embodiments take the virtual environment as a three-dimensional virtual environment as an example for illustration.

[0050] Optionally, this virtual environment can provide a battle environment for virtual characters. Exemplarily, in a battle royale type game, at least one virtual character conducts a single-round battle in the virtual environment. The virtual character achieves the purpose of surviving in the virtual environment by avoiding attacks initiated by enemy units and dangers existing in the virtual environment (such as a gas circle, a swamp, etc.). When the health value of the virtual character in the virtual environment is zero, the life of the virtual character in the virtual environment ends. The virtual character that finally successfully passes the route within the level is the winning side. Each client can control one or more virtual characters in the virtual environment.

[0051] Virtual character: It refers to an active object in the virtual environment. This active object can be a virtual person, a virtual animal, an anime character, a virtual mecha, etc. For example: a person, an animal, or a mecha displayed in a three-dimensional virtual environment. Optionally, the virtual character is a three-dimensional solid model created based on animation bone technology. Each virtual character has its own shape and volume in the three-dimensional virtual environment and occupies a part of the space in the three-dimensional virtual environment. In some embodiments, the virtual character is a humanoid virtual character with 2 legs. In other embodiments, the virtual character can be a multi-legged virtual character with more than 2 legs, such as a multi-legged virtual mecha.

[0052] Figure 1 The block diagram of the computer system provided by an exemplary embodiment of the present application is shown. The computer system 100 includes: a first terminal 120, a server 140, a second terminal 160, and a third terminal 180.

[0053] The first terminal 120 installs and runs an application program that supports a virtual environment. The application program can be any one of a three-dimensional map program, a horizontal shooting game, a horizontal adventure game, a horizontal level-passing game, a horizontal strategy game, a Virtual Reality (VR) application program, and an Augmented Reality (AR) program. The first terminal 120 is the terminal used by the first user. The first user uses the first terminal 120 to control the activities of the first virtual character located in the virtual environment. The activities include but are not limited to: adjusting the body posture, walking, running, jumping, cycling, driving, aiming, picking up, using throwing props, and attacking other virtual characters. Exemplarily, the first virtual character is a first virtual person, such as a simulated human object or an anime character object. Exemplarily, the first user controls the activities of the first virtual character through the UI control on the virtual environment screen.

[0054] The first terminal 120 is connected to the server 140 through a wireless network or a wired network.

[0055] The server 140 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Exemplarily, the server 140 includes a processor 144 and a memory 142. The memory 142 further includes a receiving module 1421, a control module 1422, and a sending module 1423. The receiving module 1421 is used to receive requests sent by the client, such as the request for detecting the position of the enemy virtual character; the control module 1422 is used to control the rendering of the virtual environment screen; the sending module 1423 is used to send responses to the client, such as sending the position of the third virtual character to the client. The server 140 is used to provide background services for the application program that supports the three-dimensional virtual environment. Optionally, the server 140 undertakes the main computing work, and the first terminal 120, the second terminal 160, and the third terminal 180 undertake the secondary computing work; or, the server 140 undertakes the secondary computing work, and the first terminal 120, the second terminal 160, and the third terminal 180 undertake the main computing work; or, the server 140, the first terminal 120, the second terminal 160, and the third terminal 180 adopt a distributed computing architecture for collaborative computing.

[0056] The second terminal 160 installs and runs an application that supports a virtual environment. The second terminal 160 is a terminal used by a second user, and the second user uses the second terminal 160 to control a second virtual character located in the virtual environment to perform activities. The third terminal 180 installs and runs an application that supports a virtual environment. The third terminal 180 is a terminal used by a third user, and the third user uses the third terminal 180 to control a third virtual character located in the virtual environment to perform activities.

[0057] Optionally, the first virtual character, the second virtual character, and the third virtual character are in the same virtual environment. The first virtual character and the second virtual character belong to different camps, and the second virtual character and the third virtual character belong to the same camp.

[0058] Optionally, the applications installed on the first terminal 120, the second terminal 160, and the third terminal 180 are the same, or the applications installed on the three terminals are of the same type on different operating system platforms (Android or IOS). The first terminal 120 can generally refer to one of multiple terminals, the second terminal 160 can generally refer to one of multiple terminals, and the third terminal 180 can generally refer to one of multiple terminals. This embodiment only takes the first terminal 120, the second terminal 160, and the third terminal 180 as examples for illustration. The device types of the first terminal 120, the second terminal 160, and the third terminal 180 are the same or different, and the device types include at least one of: smart phones, smart watches, smart TVs, tablets, e-book readers, MP3 players, MP4 players, laptop computers, and desktop computers. The following embodiments take the terminal including a smart phone as an example for illustration.

[0059] Those skilled in the art can know that the number of the above terminals can be more or less. For example, the above terminals can be only one, or the above terminals can be dozens or hundreds, or more. The embodiments of the present application do not limit the number and device type of the terminals.

[0060] The walking animation is an animation used to simulate the walking movement of a virtual character using n legs, where n is an integer greater than 1. Simply put, the walking movement is a continuous cycle of alternating movement of each leg. Figure 2The figure shows a schematic diagram of a humanoid virtual character during a walking cycle. The movement of the legs is divided into a stance phase and a swing phase. During the stance phase, the feet are in contact with the ground, and the body is propelled forward by the static friction between the feet and the ground. During the swing phase, the feet move in the direction the body is about to move, searching for a suitable landing point to prepare for the next support. In a walking cycle, each leg experiences these two phases once, and to maintain body balance, the stance phases of the legs are staggered. This application refers to the cooperation between the legs as gait, and the time required to complete this cycle is the gait cycle.

[0061] This application proposes a technical solution for generating the walking animation of a virtual character programmatically, which can generate a walking animation adapted to the current motion state programmatically under different motion states of the virtual character to eliminate the "skidding" problem that appears in traditional animation production methods.

[0062] Figure 3 The figure shows a flowchart of a method for generating the walking animation of a virtual character according to a schematic embodiment of this application. This embodiment is illustrated by taking the method as being executed by a terminal. The method includes:

[0063] Step 302: Predict the landing points of each leg of the virtual character according to the moving speed and moving direction of the virtual character;

[0064] Under different motion states, the moving speed of the virtual character is different. The motion states include at least one of the following situations: walking, running, crawling, etc. The moving direction of the virtual character can be manually controlled by the user (player). Under different moving speeds and moving directions, there are also differences in the walking animation of the virtual character.

[0065] In real life, humans walk by pushing the ground with their feet to propel the body forward, that is, "walking" causes "movement". In the virtual world, on the contrary, the movement of the virtual character is usually directly controlled by the movement system. To make the virtual character look like it is "walking" rather than "skidding", a walking animation is added to the virtual character, that is, "movement" causes "walking". When making the walking animation, it is usually tailored based on the moving speed of the virtual character in the game, so that the walking animation of the virtual character has a "down-to-earth" feeling. Matching the "footsteps" with the "movement" is the basic goal of motion animation.

[0066] Since the position of the foot does not change during the support phase, the calculation of foot movement mainly focuses on the swing phase. The swing phase is essentially the movement process of the foot from the lift-off point to the landing point. As long as the positions of the lift-off point and the landing point are known, the position of the foot during the swing process can be continuously updated by interpolation.

[0067] The terminal predicts multiple landing points or a sequence of landing points for each leg of the virtual character according to the movement speed and direction of the virtual character. For two adjacent landing points, the previous landing point is the lift-off point corresponding to the next landing point.

[0068] Assume that the virtual character has n legs, where n is an integer greater than 1. Then, a sequence of landing points for each leg of the virtual character is predicted respectively. Among them, the swing phases of at least two legs appear alternately. For example, the swing phases of the two legs of a humanoid virtual character appear alternately; another example is that in a crab mecha with 8 legs, the swing phases of the odd legs and the even legs appear alternately.

[0069] Step 304: Calculate the position of the foot of each leg during the swing phase according to two adjacent landing points of each leg;

[0070] For one swing phase, when two adjacent landing points of each leg are determined, the lift-off point and the landing point of the foot have been determined. When the lift-off point and the landing point during the swing phase are known, the position of the foot of each leg during the swing phase can be calculated based on the leg swing curve.

[0071] Step 306: Perform inverse dynamics calculation based on the position of the foot of each leg during the swing phase to obtain the position of the bone points of each leg during the swing phase;

[0072] There are multiple bone points on each leg of the virtual character. The bone points are usually located at the joints of the leg bones. As Figure 4 shown, in various leg structures, each leg can have 3 - 4 bone points. Among them, the leg bone close to the torso is the parent bone, and the leg bone close to the foot is the child bone.

[0073] In forward kinematics (FK), the orientation of the child bone is obtained from the orientation of the parent bone and the relative transformation of the child bone, that is, first determine the position of the thigh, and then determine the positions of the calf and the foot based on the movement of the thigh. In inverse kinematics (IK), however, first determine the orientation of the child bone, and then inversely deduce the orientation of the n-level parent bones in its inheritance chain, that is, first determine the position of the foot, and then inversely deduce the positions of the calf and the thigh.

[0074] Step 308: Perform gait fusion based on the positions of the bone points of each leg during the swing phase to generate a walking animation for the virtual character.

[0075] Among the n legs of the virtual character, there are at least two legs whose swing phases appear alternately. Let the gait cycle = the duration of the swing phase + the duration of the support phase. Since the gait progress of each leg may be different, the gait progress of each leg may be different.

[0076] After calculating the positions of the bone points of each leg during the swing phase, it is necessary to perform gait fusion on the gait progress of each leg through gait management so that the virtual character can reasonably call each leg for walking motion. As Figure 5 shown, consider the gait cycles of 4 legs as a circular progress bar. They will each arrange the paragraphs occupied by the support phase and the swing phase on the progress bar, and the entire gait progress is like a pointer that advances the update of the gait progress of each leg at a uniform angular velocity.

[0077] Schematically, Figure 5 the gait management process shown can be represented by a set of gait parameters, which include at least one of: gait cycle, the starting time point of each leg, swing cycle, midpoint of the step, and swing height. Among them, each parameter in the gait parameters can be custom - set or custom - adjusted so that the action animation of the virtual character meets the design expectations.

[0078] Perform programmed fusion on the positions of the bone points of each leg during the swing phase based on gait management to generate a walking animation for n legs.

[0079] In summary, the method provided in this embodiment, by first calculating the foot movements of each leg according to the moving speed and moving direction of the virtual character, and then performing gait fusion on each leg, can generate a walking animation for n legs in a programmed form. Regardless of the moving speed and moving direction of the virtual character, it can always adaptively generate the corresponding walking animation without the sliding problem caused by traditional animation blending.

[0080] Figure 6 The flowchart of the method for generating a walking animation of a virtual character shown in a schematic embodiment of the present application is shown. This embodiment is illustrated by taking the method as being executed by a terminal. The method includes:

[0081] Step 602: According to the moving speed and moving direction of the virtual character, predict the predicted movement trajectory of the virtual character in the map;

[0082] When the virtual character is in a stable gait, the gait cycle is equal to the sum of the durations of the support phase and the swing phase of any leg, and the time proportions of the support phase and the swing phase in the entire gait cycle are also a constant value k. Among them, k can be configured according to needs.

[0083] T 支撑 = T·k

[0084] T 摆动 = T·(1 - k)

[0085] Among them, T 支撑 is the duration of the support phase in a gait cycle, and T 摆动 is the duration of the swing phase in a gait cycle. And the postures presented by the virtual character at the start and end of a gait cycle should be the same. Therefore, the displacement S 摆动 of the foot is equivalent to the displacement S 身体 of the virtual character itself. Since the absolute position of the foot does not change during the support phase, all displacements of the foot are generated during the swing phase.

[0086] S 支撑 = 0

[0087] S 摆动 = S 身体

[0088] Since the essence of the swing phase is the movement process of the foot from the lift-off point to the landing point, as long as the positions of the lift-off point and the landing point can be known, the position of the foot during the swing can be continuously updated by interpolation (periodically interpolating according to the frame interval duration of each frame). The lift-off point is known. The main problem next is how to predict the position of the landing point.

[0089] For the displacement of the virtual character, it can be directly estimated through the movement speed of the virtual character, or the movement system provided by the client (such as a game) itself (such as the Movement Component in Unreal Engine 4) can be used for more accurate prediction. Schematically, with a small time step (such as 0.2 seconds), the virtual character is simulated to move several times at the current movement speed and movement direction, so as to obtain a predicted movement trajectory T raj , schematically, multiple sampling points on this predicted movement trajectory such as Figure 7 P0 - P8 in.

[0090] Traj = {P0, P1, P2…P n}

[0091] Among them, n is an integer. P iis the i-th sampling point on the predicted movement trajectory. The time step between two adjacent sampling points is a preset value.

[0092] Step 604: Using the current posture of each leg of the virtual character as the prediction starting point, sample the landing points of each leg on the predicted movement trajectory;

[0093] Combined with reference Figure 7 , assuming the virtual character includes n legs, the gait cycle is equal to the duration T 摆动 of the swing phase and the duration T 支撑 of the support phase. This step may include the following sub-steps:

[0094] 1. When the current posture of the i-th leg of the virtual character is the state at the t-th second of the swing phase, calculate the sum of the remaining duration of the swing phase and half of the duration of the support phase as the prediction duration.

[0095] Among them, the remaining duration of the swing phase is (T 摆动 -t), and half of the duration of the support phase is 1 / 2*T 支撑 , then the prediction duration t′ = (T 摆动 -t) + 1 / 2*T 支撑 .

[0096] 2. Taking the position of the virtual character's current posture on the predicted movement trajectory as the starting point, determine the position of the virtual character's body at landing by advancing the predicted length along the predicted movement trajectory, where the predicted length is equal to the product of the prediction duration and the movement speed.

[0097]

[0098] P 步伐中点 = Traj(t′)

[0099] F 落脚点 = P 步伐中点 + F local

[0100] 3. Based on the body position of the virtual character at landing and the relative position relationship F local , calculate the landing point of the i-th leg of the virtual character on the predicted movement trajectory.

[0101] Among them, i is a positive integer not greater than n, and the relative position relationship is the pre-configured relative position between the body of the virtual character and the i-th leg. In the above formula, P represents the position of the torso and F represents the position of the foot.

[0102] That is, assuming that for the i-th leg of the virtual character at the t-th second after the start of the swing phase, if the remaining swing duration (T 摆动-t) Input the predicted movement trajectory for sampling, and the position and orientation information of the virtual character when the foot of the i-th leg lands can be obtained. As long as the relative position between the foot of the virtual character and the body when the foot lands is known, the landing point can be deduced. However, in this embodiment, the relative position at this time is not mastered, but a similar piece of information that can be known is the midpoint P of the stride of this leg 步伐中点 . The so-called midpoint of the stride refers to the midpoint of the line connecting the starting point and the landing point. When taking the virtual character's body as the reference system, it can be seen that the entire gait cycle is a cycle in which the foot moves back and forth around this midpoint of the stride. From the animation level, the relative position between the midpoint of the stride and the body will directly affect the posture performance of the virtual character when walking. Therefore, in this embodiment, the relative position between the midpoint of the stride and the body is also used as a configuration parameter F local , which is pre-configured or adjusted by the animator

[0103] Therefore, in this embodiment, the sampling time point of the landing point can be postponed by half of the duration of the support phase. At this postponed sampling time point, the foot is exactly at the position of the midpoint of the stride. After sampling the body information at this time in this embodiment, the position of the foot can be deduced. Since the absolute position of the foot does not change during the entire support phase, the foot position calculated at this time is the landing point to be predicted

[0104] Step 606: Determine the leg swing curve based on the positions of two adjacent landing points

[0105] The leg swing curve is used to indicate the swing trajectory of the foot during the swing phase. Under normal circumstances, the leg swing curve is represented by a parabola 70, as Figure 7 shown. The two endpoints of the parabola are the foot lift-off point and the landing point respectively. The height h of the parabola, that is, the highest swing height of the foot during the swing phase, can also be pre-configured or adjusted by the animator

[0106] Step 608: Perform interpolation calculation on the foot of each leg based on the leg swing curve, and calculate the position of the foot of each leg during the swing phase

[0107]

[0108] where F t is the position of the foot of each leg on the leg swing curve at the t-th second during the swing phase. Schematically, the time step of t can be determined according to the frame interval of the display frame. For example, if there are 60 frames per second, the time step of t is 1 / 60 second

[0109] Step 610: Perform inverse kinematics calculation based on the position of the foot of each leg during the swing phase, and obtain the position of the bone points of each leg during the swing phase

[0110] In the case where the virtual character is a multi-legged mecha, various leg structures can be designed for the multi-legged mecha. The two-step inverse kinematics (IK) commonly used for human characters is not suitable. Here, the Cyclic Coordinate Decent Inverse Kinematics (CCDIK) or the Forward and Backward Reaching Inverse Kinematics (FABRIK) algorithm is recommended. That is, perform CCDIK calculation based on the position of the foot of each leg in the swing phase to obtain the position of the bone points of each leg in the swing phase; or, perform FABRIK calculation based on the position of the foot of each leg in the swing phase to obtain the position of the bone points of each leg in the swing phase. They both have the following advantages:

[0111] · Support any number of joints, providing a large room for leg structure design.

[0112] · Support angle limits for joint rotation, and can implement specific mechanical joint structures of the mecha.

[0113] · Have good performance and can meet the needs of real-time game operations.

[0114] After experimental comparison, in the case where the virtual character is a multi-legged mecha, FABRIK performs better than CCDIK on the hoof-shaped leg structure.

[0115] Step 612: Obtain pre-configured gait parameters;

[0116] The gait parameters are a set of parameters used in gait fusion. For the same virtual character, the gait parameters are one set or multiple sets.

[0117] Schematically, different sets of gait parameters correspond to different motion states. For example, the stealth state corresponds to the first set of gait parameters, the walking state corresponds to the second set of gait parameters, and the running state corresponds to the third set of gait parameters.

[0118] Schematically, different sets of gait parameters correspond to different moving directions. For example, moving north corresponds to the first set of gait parameters, moving south corresponds to the second set of gait parameters, moving east corresponds to the third set of gait parameters, and moving west corresponds to the fourth set of gait parameters.

[0119] In this embodiment, a set of gait parameters is used as an example for illustration. The gait parameters include: gait cycle and a list of foot parameters. Optionally, the list of foot parameters includes at least one of: start of swing, swing period, swing height, and midpoint of step. Among them, the start of swing is the starting time point of the swing phase, that is, the time when the foot is lifted; the swing period is the duration of one swing phase; the swing height refers to the highest swing height of the foot during a single swing phase; and the midpoint of step refers to the midpoint position during one support phase.

[0120] Step 614: Perform gait fusion on the positions of the bone points of each leg during the swing phase based on the gait parameters to generate a walking animation of the virtual character.

[0121] Among the n legs of the virtual character, the swing phases of at least two legs appear alternately. Let the gait cycle = the duration of the swing phase + the duration of the support phase. Since the gait progress of each leg may be different, the gait progress of each leg may be different.

[0122] After calculating the positions of the bone points of each leg during the swing phase, it is necessary to perform gait fusion on the gait progress of each leg through gait management so that the virtual character can reasonably call each leg for walking motion. As Figure 5 shown, regarding the gait cycles of 4 legs as a circular progress bar, they will each arrange the paragraphs occupied by the support phase and the swing phase on the progress bar, and the entire gait progress is like a pointer that advances the update of the gait progress of each leg at a uniform angular velocity.

[0123] Schematically, Figure 5 the gait management process shown can be represented by a set of gait parameters. The gait parameters include at least one of: the total duration of the gait cycle, the starting time point of each leg, the swing period, the midpoint of step, and the swing height. Among them, each parameter in the gait parameters can be custom-set or custom-adjusted so that the action animation of the virtual character meets the design expectations.

[0124] Schematically, the gait parameters include: the total duration of the gait cycle and the leg parameters of each leg within the gait cycle; within the total duration of the gait cycle, perform gait fusion on the positions of the bone points of each leg during the swing phase according to the leg parameters of each leg within the gait cycle to generate the walking animations of each leg of the virtual character.

[0125] The terminal displays the walking animations of each leg of the virtual character. Schematically, the above calculation process can be performed in real time frame by frame, or the calculation results of multiple frames can be pre-calculated and cached, and the display can be performed according to the cached calculation results. This embodiment does not limit this.

[0126] In summary, the method provided in this embodiment can generate walking animations for n legs in a programmed form by first calculating the foot movements of each leg according to the moving speed and direction of the virtual character, and then performing gait fusion for each leg. Regardless of the moving speed and direction of the virtual character, corresponding walking animations can always be adaptively generated, and the sliding problem caused by traditional animation blending will not occur.

[0127] Since different groups of gait parameters correspond to different motion states, for example, the stealth state corresponds to the first group of gait parameters, the walking state corresponds to the second group of gait parameters, and the running state corresponds to the third group of gait parameters. In some embodiments, the gait parameters include the first gait parameter (group) in the first motion form and the second gait parameter (group) in the second motion form. As Figure 9 described above, the above method further includes:

[0128] Step 616: Interpolate the first gait parameter and the second gait parameter to obtain the first mixed gait parameter;

[0129] Assume that the duration of the transition animation from the first motion form to the second motion form is n seconds, and the number of frames per second is m frames. Then, the first gait parameter A and the second gait parameter B can be interpolated n*m times to obtain the first mixed gait parameter corresponding to each frame.

[0130] As Figure 10 shown, at the i-th interpolation, the first mixed gait parameter = (1 - α) * the first gait parameter A + α * the second gait parameter B, where the value range of α is from 0 to 1. α is divided into n*m times and gradually increases from 0 to 1. That is, the first mixed gait parameter includes n*m groups of gait parameters, demonstrating the gradual change process from the first motion form to the second motion form.

[0131] Step 618: Based on the first mixed gait parameter, perform gait fusion on the positions of the bone points of each leg during the swing phase to generate a transition animation of the virtual character switching from the first motion form to the second motion form.

[0132] Before the transition animation, the terminal displays the first walking animation in the first motion form, which is generated based on the first gait parameter (group); after the transition animation, the terminal displays the second walking animation in the second motion form, which is generated based on the second gait parameter (group).

[0133] In summary, the method provided in this embodiment realizes the smooth transition effect between different motion states through the one-dimensional fusion between different groups of gait parameters, enabling the virtual character displayed on the terminal to present relatively smooth and fluent action changes when switching between different motion states.

[0134] Since gait parameters of different groups correspond to different moving directions, for example, moving north corresponds to the first group of gait parameters, moving south corresponds to the second group of gait parameters, moving east corresponds to the third group of gait parameters, and moving west corresponds to the fourth group of gait parameters. In some embodiments, the gait parameters include the third gait parameter (group) in the first moving direction and the fourth gait parameter (group) in the second moving direction; as Figure 11 shown, the method further includes:

[0135] Step 620: Interpolate the third gait parameter and the fourth gait parameter to obtain a second mixed gait parameter;

[0136] Assume that the duration of the transition animation from the first motion form to the second motion form is n seconds and the number of frames per second is m frames. Then, the third gait parameter C and the fourth gait parameter D can be two-dimensionally interpolated to obtain the second mixed gait parameter corresponding to the third moving direction.

[0137] Wherein, the third moving direction is a moving direction between the first moving direction and the second moving direction.

[0138] Schematically, let the gait parameter of the virtual character at different times in place be the fifth gait parameter O. The calculation process of the second mixed gait parameter is as follows:

[0139] α = current speed in the first moving direction / maximum speed in the first moving direction;

[0140] β = current speed in the second moving direction / maximum speed in the second moving direction;

[0141] The first intermediate gait parameter C' = (1 - α) * O + α * C;

[0142] The second intermediate gait parameter D' = (1 - β) * O + β * D;

[0143] Let γ = β / (α + β), and finally obtain:

[0144] The second mixed gait parameter = (1 - γ) * C' + γ * D'.

[0145] That is, the first weight α is equal to the current speed in the first moving direction divided by the maximum speed in the first moving direction, and the second weight β is equal to the current speed in the second moving direction divided by the maximum speed in the second moving direction. The first weight is used to fuse the third gait parameter and the fifth gait parameter to obtain the first intermediate gait parameter; the second weight is used to fuse the fourth gait parameter and the fifth gait parameter to obtain the second intermediate gait parameter. Calculate the third weight as β / (α + β); the third weight is used to mix the first intermediate gait parameter and the second intermediate gait parameter to obtain the second mixed gait parameter.

[0146] Step 622: Based on the second mixed gait parameters, perform gait fusion on the positions of the bone points of each leg during the swing phase to generate the walking animations of n legs in the third moving direction.

[0147] Before the transition animation, the terminal displays the walking animation in the first moving direction, and the walking animation in the first moving direction is generated based on the third gait parameter (group); after the transition animation, the terminal displays the walking animation in the second moving direction, and the walking animation in the second moving direction is generated based on the fourth gait parameter (group).

[0148] In summary, the method provided in this embodiment realizes the smooth transition effect between different motion states through the two-dimensional fusion between different groups of gait parameters, so that the virtual character displayed on the terminal presents relatively smooth and fluent action changes when switching between different motion states.

[0149] That is, in addition to Figure 9 the one-dimensional mixing shown, the dimension of the mixing can also be increased like in animations. For example, for the movement of the virtual character in different directions - forward, lateral, and backward movements, games usually adopt different animation performances, and animators will produce animation sequences for 4 or 8 directions of movement, and perform two-dimensional animation mixing through an animation mixing space. Gait mixing can also follow the same principle, and animators configure corresponding gait parameter sets for each moving direction. During the operation of the client, the terminal will perform two-dimensional mixing of the gait parameters according to the moving direction and speed of the virtual character.

[0150] Since the performance obtained by directly using a parabola as the leg swing curve is relatively rigid. To solve this problem, in some embodiments, the interpolation process is improved, and a time-based curve is introduced to control the α coefficient of the interpolation. For example, in the horizontal direction, a curve that first accelerates and then decelerates can be used to determine the α coefficient of the interpolation, as shown in Figure 12 the left figure (1) of 抬脚点 , that is, at the t-th second of the leg swing phase, the position of the foot in the horizontal direction is determined as: F 落脚点 +α*(F 抬脚点 -F Figure 12 ) of the right figure (2), that is, at the t-th second of the leg swing phase, the position of the foot in the vertical direction is determined as h corresponding to the moment t. These changes combined will make the entire leg swing action appear more powerful.

[0151] In some other embodiments, in the walking animation made by an animator, the motion data of the foot bones can be recorded to generate a corresponding leg swing curve. The animator can also directly manually edit this leg swing curve. Curve editors are provided in some game engines, and the animator can easily operate on them.

[0152] In some other embodiments, when a huge mecha is moving forward, it will step over relatively short obstacles. To avoid the intersection of 3D models in the leg swing route, the leg swing curve should also be offset according to the obstacles. When there are obstacles under the body of the virtual character, a spline curve is determined based on the positions of two adjacent landing points and the highest point of the obstacle; the spline curve is superimposed on the leg swing curve to obtain an updated leg swing curve. A spline curve is a smooth curve passing through a series of given points, and the given points are two adjacent landing points and the highest point of the obstacle. Schematically, as Figure 13 shown, taking the leg swing distance as the length and the foot width as the radius, a horizontal capsule 1320 is constructed. A collision detection is performed on this capsule 1320 from top to bottom to obtain all the collision convex points on the ground. Since only the convex points that will block the leg swing curve need to be considered, the convex points with heights lower than the leg swing curve can be filtered out first. A spline curve is generated using the remaining convex points and superimposed on the original leg swing curve, and a new route can be obtained, enabling the virtual mecha to step over these obstacles.

[0153] The above embodiments illustrate the generation of the walking animation of a virtual character in a purely procedural manner, and basically correct performance effects can be obtained through this method. However, for a high-quality game, just being correct is far from enough. Every gesture of a virtual character is a carrier for expressing the personality characteristics of this virtual character. Taking the large multi-group mecha mentioned in the embodiments of this application as an example, whether it is clumsy or flexible is precisely to be expressed through its walking actions. Therefore, in the following content, what the embodiments of this application mainly consider is how to make the animation of the character appear more vivid. In some embodiments, as Figure 14 shown, the above method further includes:

[0154] Step 624: Obtain the torso animation of the virtual character;

[0155] If the problem of "skipping" is not considered, pre-produced animation sequences are undoubtedly the best means of performance. Animators can express all their ideas through animation production tools such as 3ds Max or Maya. Although the above embodiments generate animation sequences in a procedural manner, if the animation sequences can be incorporated, it will undoubtedly greatly improve the final performance effect.

[0156] Therefore, animators still create motion animations for virtual characters in a certain motion form as usual. The motion animations include: torso animations corresponding to body parts and walking animations corresponding to legs. In this embodiment, the walking animations in the motion animations created by animators are removed, and the remaining animation part is the torso animation of the virtual character.

[0157] Step 626: Blend the torso animation of the virtual character with the walking animation of each leg to obtain the overall movement animation of the virtual character.

[0158] Then, blend the torso animation created by the animator with the walking animation calculated by the program. Most game engines provide corresponding animation toolchains. Taking Unreal Engine 4 as an example, in the animation blueprint, based on the torso animation, the calculated walking animation can be passed in, and finally the overall movement animation of the virtual character is output.

[0159] The torso animation needs to be synchronized with the gait cycle of the walking animation. Since the gait cycle in the game may change dynamically, in this embodiment, the torso animation will be scaled in real time to ensure that the length of the torso animation is consistent with the gait cycle, and the gait progress is directly used as the playback progress of the torso animation.

[0160] Schematically, scale the animation duration of the torso animation of the virtual character according to the gait cycle to obtain the scaled torso animation. Among them, the animation duration of the scaled torso animation is equal to the duration of the gait cycle. Blend the scaled torso animation with the walking animation of each leg to obtain the overall movement animation of the virtual character.

[0161] In summary, the method provided in this embodiment can make the torso and legs of the virtual character have animation effects adapted to the walking process by blending the torso animation of the virtual character with the walking animation of each leg, and the overall motion visual performance is more vivid and realistic.

[0162] In addition to restoring the effects of the animation sequence as much as possible, some physical simulations reflecting inertia can also be added to the virtual character to further increase the sense of realism of the performance. For example, when the virtual character starts, stops or turns, some parts of the body (such as antennae, cables, weapons, pendants, etc.) will swing inertially along with the direction of speed change. In some embodiments, as Figure 15 shown, the above method further includes:

[0163] Step 628: When there are elastic components on the body of the virtual character, determine at least two levels of bone nodes corresponding to the elastic components in the bone tree of the virtual character;

[0164] The bone tree of a virtual character is a tree established based on the importance of each bone in the virtual character. In one example, among at least two levels of bone nodes, the level of the bone node closer to the body center is higher than the level of the bone node closer to the body end.

[0165] Step 630: Starting from the root node among at least two levels of bone nodes, taking the upper-level bone node as the origin and the lower-level bone node as the oscillator, perform vibration calculation of the three-dimensional vibration model to determine the bone update position of the lower-level bone node until the bone update position of the elastic component is updated.

[0166] For a certain bone, when affected by inertia, it will rotate around the parent bone in the inertial direction. At the same time, it will be subject to a restoring force that pulls it back to its original orientation. As Figure 16 shown in the left figure of.

[0167] In this vibration model, the directly above is regarded as the stable orientation to be finally reached. The distance between the current bone and the parent bone is fixed at L. The projection of the current bone in the horizontal direction is regarded as the oscillator. The process of the current bone swinging around the parent bone is the process of the oscillator corresponding to its projection vibrating. Set the mass of the oscillator itself as m, the stiffness coefficient of the vibration system as k, and the damping coefficient as c. Assume the current position of the oscillator is x. According to Newton's second law, the force balance equation at this time is:

[0168]

[0169] Among them, represents the current velocity of the oscillator, represents the acceleration of the oscillator. Then define the parameter ω0 as the natural frequency of the system and ζ as the damping ratio, satisfying the equation:

[0170]

[0171] Substitute into the previous equation to obtain formula (1):

[0172]

[0173] The oscillator will swing back and forth, and the amplitude will become smaller and smaller, and finally approach equilibrium infinitely. Set the initial amplitude as As time goes by, the amplitude A(t) satisfies the equation:

[0174]

[0175] After transformation, it is obtained:

[0176]

[0177] Set To express the ratio of the amplitude at time t to the initial amplitude, it can be defined that when this ratio is reduced to a certain extent, the oscillator enters a stable state, and the time point at this moment is recorded as t s , we get formula (2):

[0178]

[0179] The time t required for the oscillator to enter a stable state s The damping ratio ζ and the damping ratio ζ are parameters that can be understood intuitively. They are used as configuration parameters to allow the animator to control the performance of the system. The natural frequency ω0 can be obtained using the above formula. Substituting ζ and ω0 into formula (1) yields the relationship between position, velocity, and acceleration. The vibration process is then integrated using the particle motion simulation (Verlet) method with a fixed time step Δt to update the position of the oscillator:

[0180]

[0181]

[0182] The calculation of the vibration model is now complete. Next, we need to convert the vibration model into three-dimensional form. For the bones in three-dimensional space, its projections on the X-axis and Y-axis are used as vibrators, and each vibrates along its axis, such as Figure 16 As shown in the right figure.

[0183] The vibration calculations on the X-axis and Y-axis are completed to obtain x(t+Δt) and y(t+Δt), respectively, and the vector V formed on the XY plane is XY =[x(t+Δt),y(t+Δt),0], whose length is L XY =|V XY |, from which we can get the position vector V of the bone:

[0184]

[0185] After completing the above calculation steps, a three-dimensional vibration model is obtained, and finally this model is applied to the character skeleton. For each pair of parent-child bones, it can be regarded as a three-dimensional vibration model with the parent bone as the origin and the child bone as the oscillator. After selecting the bone tree that needs to be affected by inertia in the skeleton, start from the root node and calculate step by step to the leaf node. In this way, the bone used as the oscillator will become the vibration origin of the next level of bones after the position is updated, thereby having a collateral effect on the vibration calculation of the next level of bones, forming a step-by-step progressive inertia effect, such as Figure 17 shown.

[0186] The use of this simplified vibration model can obtain a more realistic inertial vibration performance in the user's visual sense with less calculation amount.

[0187] The above embodiments are all based on the walking motion performance on flat ground. However, there are various winding and undulating terrains in the virtual world. Next, the influence of terrain on walking motion needs to be considered.

[0188] Footfall point correction on non-flat ground

[0189] As Figure 18 shown, first, make the landing point of the foot correctly land on the uneven ground surface. Starting from the footfall point F` on flat ground calculated previously 落脚点 , find a grounding point G in the vertical direction, and connect the grounding point G and the foot-lifting point F. Assume that the selected footfall point on flat ground should be the maximum distance that the leg swing can reach, simply referred to as the leg swing distance. Therefore, this leg swing distance is also used to intercept a reference point on the new connection line, and then a new grounding is done for the reference point to obtain the new footfall point F 落脚点 . That is, when the ground where the footfall point F` 落脚点 is located is an uneven ground, calculate the first projection point G of the footfall point F` 落脚点 on the uneven ground in the vertical direction; on the connection line between the footfall point F` 落脚点 and the first projection point G, intercept the reference point based on the leg swing distance; use the second projection point of the reference point on the uneven ground in the vertical direction as the updated footfall point F 落脚点 . By adopting this footfall point correction technology, the landing point of the foot can correctly land on the uneven ground surface.

[0190] In addition, as Figure 19 shown, it is also necessary to rotate the foot according to the normal direction of the ground at the current footfall point. Since the foot has a certain thickness, it is necessary to drive the position offset of the foot bone F. When applying the footfall point position to the animation, this section of offset cannot be omitted. That is, according to the normal direction of the ground where the updated footfall point (i.e., the current footfall point) is located, deflect the posture of the foot when landing, so that the sole plane of the foot is perpendicular to the normal direction of the ground at the current footfall point.

[0191] For virtual characters with more legs, there is a certain distance between the support points of each leg on the torso (i.e., the leg roots). It is necessary to consider the body tilt caused by each leg standing at different heights. The terminal calculates the support vectors of each leg of the virtual character. The support vector is used to indicate the inclination of the current footfall point of the leg relative to the torso of the virtual character; based on the support vectors of each leg, calculate the posture angles of the torso of the virtual character; perform tilt compensation on the torso of the virtual character based on the posture angles. Among them, the posture angles include yaw, pitch, and roll.

[0192] Figure 20The sagittal view of the virtual character standing in an inclined posture is shown. Starting from point O on the ground where the virtual character's body is located, a connection is made to the position F where the foot is located to obtain After the plane where it is located, a perpendicular line is drawn from the support point H of the torso to intersect the plane to obtain the intersection point N. This is the support vector of this leg relative to the torso.

[0193] The same calculation is performed for each leg of the virtual character. The support vectors of all the obtained legs are grouped front-back and left-right respectively. The attitude angle Pitch of the torso is calculated based on the support vectors of all the front legs and all the back legs, and the attitude angle Roll of the torso is calculated based on the support vectors of all the left legs and all the right legs.

[0194] Sometimes there will be Figure 21 This kind of convex terrain in. When the virtual character stands on top, in order to keep the feet on the ground, a posture with the body arched will be formed, as if being lifted by something invisible. Therefore, it is also necessary to correct the height of the torso. By averaging the height differences between each foot F and the body position O of the virtual character in the current state, the correction value of the torso height can be obtained, and then this value is applied to the body bones of the virtual character to correct the torso to a reasonable height, such as raising the height difference That is, when the virtual character is above the convex ground, calculate the average height difference between the landing points of each leg of the virtual character and the vertex of the convex ground; raise and compensate the height of the torso of the virtual character according to the average height difference. In this way, the torso height of the virtual character standing on the convex terrain is more in line with the performance of the mecha in the real world.

[0195] Figure 22 The block diagram of the walking animation generation device of the virtual character provided by an exemplary embodiment of the present application is shown. This device is applied to the terminal by using hardware or a combination of software and hardware. Each leg of the virtual character alternately executes a swing phase and a support phase during walking. The device includes:

[0196] A prediction module 220, configured to predict the landing points of each leg of the virtual character during the walking process according to the moving speed and moving direction of the virtual character;

[0197] A calculation module 222, configured to calculate the position of the foot of each leg during the swing phase according to two adjacent landing points of each leg;

[0198] An IK module 224, configured to perform inverse kinematics calculation based on the position of the foot of each leg during the swing phase to obtain the position of the bone points of each leg during the swing phase;

[0199] A fusion module 226, configured to perform gait fusion based on the positions of the skeletal points of each leg during the swing phase, and generate a walking animation of the virtual character.

[0200] In an alternative design of this embodiment, the fusion module 226 is configured to obtain pre-configured gait parameters; perform gait fusion on the positions of the skeletal points of each leg during the swing phase based on the gait parameters, and generate a walking animation of the virtual character.

[0201] In an alternative design of this embodiment, the gait parameters include: a gait cycle and leg parameters of each leg within the gait cycle; the fusion module 226 is configured to, within the gait cycle, perform gait fusion on the positions of the skeletal points of each leg during the swing phase according to the leg parameters of each leg within the gait cycle, and generate a walking animation of the virtual character;

[0202] wherein the leg parameters include at least one of a foot-lifting time point, a duration of the swing phase, and a step midpoint of the support phase.

[0203] In an alternative design of this embodiment, the gait parameters include first gait parameters in a first motion form and second gait parameters in a second motion form;

[0204] The device further includes:

[0205] A transition module 228, configured to interpolate the first gait parameters and the second gait parameters to obtain first mixed gait parameters; perform gait fusion on the positions of the skeletal points of each leg during the swing phase based on the first mixed gait parameters, and generate a transition animation of the n legs switching from the first motion form to the second motion form.

[0206] In an alternative design of this embodiment, the gait parameters include third gait parameters in a first moving direction and fourth gait parameters in a second moving direction;

[0207] The device further includes:

[0208] A transition module 228, configured to interpolate the third gait parameters and the fourth gait parameters to obtain second mixed gait parameters; perform gait fusion on the positions of the skeletal points of each leg during the swing phase based on the second mixed gait parameters, and generate a walking animation of the n legs in a third moving direction;

[0209] wherein the third moving direction is a moving direction between the first moving direction and the second moving direction.

[0210] In an alternative design of this embodiment, predicting the landing point of each leg of the virtual character according to the moving speed and moving direction of the virtual character includes:

[0211] Predicting the predicted movement trajectory of the virtual character in the map according to the moving speed and moving direction of the virtual character;

[0212] Taking the current posture of each leg of the virtual character as the prediction starting point, sampling the landing points of each leg on the predicted movement trajectory.

[0213] In an alternative design of this embodiment, the virtual character includes n legs. Taking the current posture of each leg of the virtual character as the prediction starting point and sampling the landing points of each leg on the predicted movement trajectory includes:

[0214] When the current posture of the i-th leg of the virtual character is the state at the t-th second of the swing phase, calculating the sum of the remaining duration of the swing phase and half of the duration of the support phase as the prediction duration;

[0215] Taking the position of the current posture of the virtual character on the predicted movement trajectory as the starting point, and determining the position of the virtual character's body at the time of landing as the position advancing the predicted length along the predicted movement trajectory, where the predicted length is equal to the product of the prediction duration and the moving speed;

[0216] Based on the body position of the virtual character at the time of landing and the relative position relationship, calculating the landing point of the i-th leg of the virtual character on the predicted movement trajectory;

[0217] Wherein, i is a positive integer not greater than n, and the relative position relationship is the pre-configured relative position between the body of the virtual character and the i-th leg.

[0218] In an alternative design of this embodiment, the calculation module 222 is configured to determine a leg swing curve based on the positions of two adjacent landing points, where the leg swing curve is used to indicate the swing trajectory of the foot during the swing phase; performing interpolation calculation on the foot of each leg based on the leg swing curve to calculate the position of the foot of each leg during the swing phase.

[0219] In an alternative design of this embodiment, the IK module 224 is configured to perform CCDIK calculation according to two adjacent landing points of each leg to obtain the positions of the bone points of each leg during the swing phase; or perform FABRIK calculation according to two adjacent landing points of each leg to obtain the positions of the bone points of each leg during the swing phase.

[0220] In an alternative design of this embodiment, the fusion module 226 is configured to obtain the torso animation of the virtual character; fuse the torso animation of the virtual character with the walking animation of each leg to obtain the overall movement animation of the virtual character.

[0221] In an alternative design of this embodiment, the fusion module 226 is configured to scale the torso animation of the virtual character according to the gait cycle to obtain a scaled torso animation; fuse the scaled torso animation with the walking animation of each leg to obtain the overall movement animation of the virtual character.

[0222] In an alternative design of this embodiment, the calculation module 222 is further configured to, when there is an elastic component on the body of the virtual character, determine at least two levels of bone nodes corresponding to the elastic component in the bone tree of the virtual character; starting from the root node of the at least two levels of bone nodes, perform vibration calculation of a three-dimensional vibration model with the upper-level bone node as the origin and the lower-level bone node as the oscillator to determine the bone update position of the lower-level bone node until the bone update position of the elastic component is updated.

[0223] In an alternative design of this embodiment, the prediction module 220 is further configured to, when the ground where the landing point is located is an uneven ground, calculate a first projection point of the landing point on the uneven ground in the vertical direction; on the connection line between the landing point and the first projection point, intercept a reference point based on the swing leg distance; use the second projection point of the reference point on the uneven ground in the vertical direction as the updated landing point.

[0224] In an alternative design of this embodiment, the prediction module 220 is further configured to deflect the posture of the foot when landing according to the normal direction of the ground where the updated landing point is located.

[0225] In an alternative design of this embodiment, the fusion module 226 is further configured to calculate a support vector for each leg of the virtual character, where the support vector is used to indicate the inclination of the current leg's landing point relative to the torso of the virtual character; calculate the attitude angle of the torso of the virtual character based on the support vectors of the legs; perform tilt compensation on the torso of the virtual character based on the attitude angle.

[0226] In an alternative design of this embodiment, the fusion module 226 is further configured to, when the virtual character is above a convex ground, calculate the average height difference between the landing points of each leg of the virtual character and the vertex of the convex ground; raise and compensate the height of the torso of the virtual character according to the average height difference.

[0227] Figure 23 The structure block diagram of a computer device 2300 provided by an exemplary embodiment of the present application is shown. The computer device 2300 may be a portable mobile terminal, such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer or a desktop computer. The computer device 2300 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.

[0228] Generally, the computer device 2300 includes: a processor 2301 and a memory 2302.

[0229] The processor 2301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 2301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), PLA (Programmable Logic Array). The processor 2301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 2301 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 2301 may also include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0230] The memory 2302 may include one or more computer-readable storage media, which may be non-transitory. The memory 2302 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 2302 is used to store at least one instruction for being executed by the processor 2301 to implement the method for accelerating external network resources provided in the method embodiments of the present application.

[0231] In some embodiments, the computer device 2300 may further optionally include: a peripheral device interface 2303 and at least one peripheral device. The processor 2301, the memory 2302, and the peripheral device interface 2303 may be connected through a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 2303 through a bus, signal lines, or a circuit board. Exemplarily, the peripheral device may include at least one of a radio frequency circuit 2304, a display screen 2305, a camera assembly 2306, an audio circuit 2307, and a power supply 2308.

[0232] The peripheral device interface 2303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 2301 and the memory 2302. In some embodiments, the processor 2301, the memory 2302, and the peripheral device interface 2303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 2301, the memory 2302, and the peripheral device interface 2303 may be implemented on a separate chip or circuit board, and this embodiment does not limit this.

[0233] The radio frequency circuit 2304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 2304 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 2304 converts electrical signals into electromagnetic signals for transmission, or converts the received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 2304 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and so on. The radio frequency circuit 2304 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: the World Wide Web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 23G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 2304 may further include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0234] The display screen 2305 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 2305 is a touch display screen, the display screen 2305 also has the ability to collect touch signals on or above the surface of the display screen 2305. The touch signals can be input as control signals to the processor 2301 for processing. At this time, the display screen 2305 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 2305 can be one, set on the front panel of the computer device 2300; in other embodiments, the display screen 2305 can be at least two, respectively set on different surfaces of the computer device 2300 or in a folding design; in other embodiments, the display screen 2305 can be a flexible display screen, set on the curved surface or folding surface of the computer device 2300. Even, the display screen 2305 can be set to an irregular non-rectangular shape, that is, a special-shaped screen. The display screen 2305 can be prepared using materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0235] The camera assembly 2306 is used to collect images or videos. Optionally, the camera assembly 2306 includes a front camera and a rear camera. Generally, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, there are at least two rear cameras, which can be any one of a main camera, a depth camera, a wide-angle camera, and a telephoto camera, so as to implement the function of background blurring by fusing the main camera and the depth camera, panoramic shooting by fusing the main camera and the wide-angle camera, and VR (Virtual Reality) shooting function or other fused shooting functions. In some embodiments, the camera assembly 2306 may further include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. The dual-color temperature flash refers to the combination of a warm light flash and a cold light flash, which can be used for light compensation under different color temperatures.

[0236] The audio circuit 2307 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals and input them to the processor 2301 for processing, or input them to the radio frequency circuit 2304 to achieve voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively disposed at different parts of the computer device 2300. The microphone can also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signals from the processor 2301 or the radio frequency circuit 2304 into sound waves. The speaker can be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for uses such as ranging. In some embodiments, the audio circuit 2307 may further include a headphone jack.

[0237] The power supply 2308 is used to supply power to each component in the computer device 2300. The power supply 2308 can be alternating current, direct current, a primary battery or a rechargeable battery. When the power supply 2308 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0238] In some embodiments, the computer device 2300 further includes one or more sensors 2310. The one or more sensors 2310 include but are not limited to: an acceleration sensor 2311, a gyroscope sensor 2312, a pressure sensor 2313, an optical sensor 2314, and a proximity sensor 2315.

[0239] The acceleration sensor 2311 can detect the magnitudes of accelerations on the three coordinate axes of the coordinate system established by the computer device 2300. For example, the acceleration sensor 2311 can be used to detect the components of the gravitational acceleration on the three coordinate axes. The processor 2301 can control the display screen 2305 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 2311. The acceleration sensor 2311 can also be used for collecting game or user movement data.

[0240] The gyroscope sensor 2312 can detect the body orientation and rotation angle of the computer device 2300. The gyroscope sensor 2312 can cooperate with the acceleration sensor 2311 to collect the 3D actions of the user on the computer device 2300. Based on the data collected by the gyroscope sensor 2312, the processor 2301 can implement the following functions: motion sensing (such as changing the UI according to the user's tilting operation), image stabilization during shooting, game control, and inertial navigation.

[0241] The pressure sensor 2313 can be disposed on the side frame of the computer device 2300 and / or the lower layer of the display screen 2305. When the pressure sensor 2313 is disposed on the side frame of the computer device 2300, it can detect the holding signal of the user on the computer device 2300, and the processor 2301 can perform left / right hand recognition or shortcut operations according to the holding signal collected by the pressure sensor 2313. When the pressure sensor 2313 is disposed on the lower layer of the display screen 2305, the processor 2301 can control the operable controls on the UI interface according to the pressure operation of the user on the display screen 2305. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0242] The optical sensor 2314 is used to collect the ambient light intensity. In one embodiment, the processor 2301 can control the display brightness of the display screen 2305 according to the ambient light intensity collected by the optical sensor 2314. For example, when the ambient light intensity is high, the display brightness of the display screen 2305 is increased; when the ambient light intensity is low, the display brightness of the display screen 2305 is decreased. In another embodiment, the processor 2301 can also dynamically adjust the shooting parameters of the camera module 2306 according to the ambient light intensity collected by the optical sensor 2314.

[0243] The proximity sensor 2315, also known as the distance sensor, is usually set on the front panel of the computer device 2300. The proximity sensor 2315 is used to collect the distance between the user and the front of the computer device 2300. In one embodiment, when the proximity sensor 2315 detects that the distance between the user and the front of the computer device 2300 is gradually decreasing, the processor 2301 controls the display screen 2305 to switch from the lit state to the off state; when the proximity sensor 2315 detects that the distance between the user and the front of the computer device 2300 is gradually increasing, the processor 2301 controls the display screen 2305 to switch from the off state to the lit state.

[0244] Those skilled in the art can understand that Figure 23 the structure shown in does not constitute a limitation on the computer device 2300, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component layout.

[0245] This application also provides a computer-readable storage medium, in which at least one instruction, at least one program segment, a code set or an instruction set is stored, and the at least one instruction, the at least one program segment, the code set or the instruction set is loaded and executed by a processor to implement the method for generating a walking animation of a virtual character provided in the above method embodiment.

[0246] This application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for generating a walking animation of a virtual character provided in the above method embodiment.

[0247] The serial numbers of the above embodiments of this application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0248] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk or an optical disc, etc.

[0249] The above are only the optional embodiments of this application, and are not intended to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this application shall be included in the protection scope of this application.

Claims

1. A method for generating a walking animation of a virtual character, characterized in that, Each leg of the virtual character alternately executes a swing phase and a support phase during walking, and the method includes: Predict the landing points of each leg of the virtual character during the walking according to the moving speed and moving direction of the virtual character; Calculate the position of the foot of each leg in the swing phase according to two adjacent landing points of each leg; Perform inverse kinematics calculation based on the position of the foot of each leg in the swing phase to obtain the position of the bone points of each leg in the swing phase; Generate a walking animation of the virtual character based on the position of the bone points of each leg in the swing phase through gait fusion; 2. The method according to claim 1, characterized in that, The generating a walking animation of the virtual character based on the position of the bone points of each leg in the swing phase through gait fusion includes: Obtain pre-configured gait parameters; Generate a walking animation of the virtual character by performing gait fusion on the position of the bone points of each leg in the swing phase based on the gait parameters; 3. The method according to claim 2, wherein The gait parameters include: a gait cycle and leg parameters of each leg within the gait cycle; The generating a walking animation of the virtual character by performing gait fusion on the position of the bone points of each leg in the swing phase based on the gait parameters includes: Within the gait cycle, perform gait fusion on the position of the bone points of each leg in the swing phase according to the leg parameters of each leg within the gait cycle to generate a walking animation of the virtual character; Wherein, the gait cycle is an alternating cycle of the swing phase and the support phase, and the leg parameters include at least one of a foot-lifting time point, a duration of the swing phase, and a pace midpoint of the support phase; 4. The method according to claim 3, wherein The gait parameters include a first gait parameter in a first motion form and a second gait parameter in a second motion form; The method further includes: Interpolate the first gait parameter and the second gait parameter to obtain a first mixed gait parameter; Generate a transition animation of n legs switching from the first motion form to the second motion form by performing gait fusion on the position of the bone points of each leg in the swing phase based on the first mixed gait parameter; 5. The method according to claim 3, characterized in that, The gait parameters include a third gait parameter in a first moving direction and a fourth gait parameter in a second moving direction; The method further includes: Interpolate the third gait parameter and the fourth gait parameter to obtain a second mixed gait parameter; Generate a walking animation of n legs in a third moving direction by performing gait fusion on the position of the bone points of each leg in the swing phase based on the second mixed gait parameter; Wherein, the third moving direction is a moving direction between the first moving direction and the second moving direction; 6. The method according to any one of claims 1 to 5, characterized in that The predicting the landing points of each leg of the virtual character according to the moving speed and moving direction of the virtual character includes: Predict the predicted moving trajectory of the virtual character in the map according to the moving speed and moving direction of the virtual character; Using the current posture of each leg of the virtual character as the prediction starting point, sample the landing points of each leg on the predicted movement trajectory.

7. The method according to claim 6, characterized in that, The virtual character includes n legs. The step of using the current posture of each leg of the virtual character as the prediction starting point and sampling the landing points of each leg on the predicted movement trajectory includes: When the current posture of the i-th leg of the virtual character is the state at the t-th second of the swing phase, calculate the sum of the remaining duration of the swing phase and half of the duration of the support phase as the prediction duration; Using the position of the current posture of the virtual character on the predicted movement trajectory as the starting point, determine the body position of the virtual character when landing as the position advancing the predicted length along the predicted movement trajectory, where the predicted length is equal to the product of the prediction duration and the movement speed; Based on the body position of the virtual character when landing and the relative position relationship, infer the landing point of the i-th leg of the virtual character on the predicted movement trajectory; where i is a positive integer not greater than n, and the relative position relationship is the pre-configured relative position between the body of the virtual character and the i-th leg.

8. The method according to claim 6, wherein The method further includes: When the ground where the landing point is located is an uneven ground, calculate the first projection point of the landing point on the uneven ground in the vertical direction; On the line connecting the landing point and the first projection point, intercept a reference point based on the swing leg distance; Use the second projection point of the reference point on the uneven ground in the vertical direction as the updated landing point.

9. The method according to claim 8, wherein The method further includes: According to the normal direction of the ground where the updated landing point is located, deflect the posture of the foot when landing.

10. The method according to any one of claims 1 to 5, characterized in that, The step of calculating the position of the foot of each leg in the swing phase according to two adjacent landing points of each leg includes: Determine a swing leg curve based on the positions of two adjacent landing points, where the swing leg curve is used to indicate the swing trajectory of the foot in the swing phase; Perform interpolation calculation on the foot of each leg based on the swing leg curve to calculate the position of the foot of each leg in the swing phase.

11. The method according to claim 10, wherein The method includes: When there is an obstacle under the body of the virtual character, determine a spline curve based on the positions of two adjacent landing points and the highest point of the obstacle; Superimpose the spline curve and the swing leg curve to obtain an updated swing leg curve.

12. The method according to any one of claims 1 to 5, characterized in that, The step of performing inverse dynamics calculation based on the position of the foot of each leg in the swing phase to obtain the position of the bone points of each leg in the swing phase includes: Perform cyclic coordinate descent inverse kinematics (CCDIK) calculation according to two adjacent landing points of each leg to obtain the position of the bone points of each leg in the swing phase; or, Perform forward and backward reach inverse kinematics (FABIK) calculation according to two adjacent landing points of each leg to obtain the position of the bone points of each leg in the swing phase.

13. The method according to any one of claims 1 to 5, characterized in that The method further includes: Obtain the torso animation of the virtual character, where the torso animation is the animation of the virtual character's body during walking; Fuse the torso animation of the virtual character with the walking animation of the virtual character to obtain the overall movement animation of the virtual character.

14. The method according to claim 13, characterized in that, The fusing the torso animation of the virtual character with the walking animation of the virtual character to obtain the overall movement animation of the virtual character includes: Scale the duration of the torso animation of the virtual character according to the duration of the gait cycle to obtain the scaled torso animation; the gait cycle is the alternating cycle of the swing phase and the support phase; Fuse the scaled torso animation with the walking animation of the virtual character to obtain the overall movement animation of the virtual character.

15. The method according to any one of claims 1 to 5, characterized in that, The method further includes: When there is an elastic component on the body of the virtual character, determine at least two levels of bone nodes corresponding to the elastic component in the bone tree of the virtual character; Starting from the root node of the at least two levels of bone nodes, perform vibration calculation of a three-dimensional vibration model with the upper-level bone node as the origin and the lower-level bone node as the oscillator to determine the bone update position of the lower-level bone node until the bone update position of the elastic component is updated.

16. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Calculate the support vector of each leg of the virtual character, where the support vector is used to indicate the inclination of the landing point of the current leg relative to the torso of the virtual character; Based on the support vectors of each leg, calculate the attitude angle of the torso of the virtual character; Perform inclination compensation on the torso of the virtual character based on the attitude angle.

17. The method according to any one of claims 1 to 5, characterized in that The method further includes: When the virtual character is above a convex ground, calculate the average height difference between the landing points of each leg of the virtual character and the vertex of the convex ground; Elevate and compensate the height of the torso of the virtual character according to the average height difference.

18. An apparatus for generating a walking animation of a virtual character, characterized in that, Each leg of the virtual character alternately executes a swing phase and a support phase during walking, and the device includes: A prediction module for predicting the landing points of each leg of the virtual character during the walking process according to the moving speed and moving direction of the virtual character; A calculation module for calculating the position of the foot of each leg during the swing phase according to two adjacent landing points of each leg; An IK module for performing inverse kinematics calculation based on the position of the foot of each leg during the swing phase to obtain the position of the bone points of each leg during the swing phase; A fusion module for performing gait fusion based on the position of the bone points of each leg during the swing phase to generate the walking animation of the virtual character.

19. A computer device, characterized in that, The computer device includes: a processor and a memory, and the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the method for generating the walking animation of a virtual character according to any one of claims 1 to 17.

20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the method for generating the walking animation of a virtual character according to any one of claims 1 to 17.

21. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs to implement the method for generating a walking animation of a virtual character as described in any one of claims 1 to 17.

Citation Information

Patent Citations

  • Foot reverse motion control method and device, equipment and storage medium

    CN112348931A

  • Training method of action generation model, action generation method, device and equipment

    CN113559513A