Animation generation method and apparatus, motion controller training method and apparatus, and device
The action controller processes the information and postures of the virtual character in the stand-up state, simulates their stand-up movements, and solves the problem that the virtual character stand-up animation effect in the prior art is not smooth and diverse, and achieves higher quality animation generation.
Patent Information
- Application Number
- PCT/CN2024/102623
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-04
- Filing Date
- 2024-06-28
- Publication Date
- 2025-03-13
AI Technical Summary
It is difficult to generate high-quality virtual character stand-up animations in the prior art, and the animation effects are not smooth and diverse enough.
The action controller processes the target information and posture of the virtual character in the stand-up state, simulates its stand-up movement, and generates the posture of the next frame of the screen in real time.
It improves the accuracy and authenticity of virtual characters' pose transformation, making the animation effect more accurate and realistic.
Smart Images

Figure CN2024102623_13032025_PF_FP_ABST
Abstract
Description
Animation generation method, motion controller training method, device and equipment
[0001] This application claims priority to the Chinese patent application filed on September 4, 2023, with application number 202311130806.8, and invention name “Animation generation method, training method, device and equipment for motion controller”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to an animation generation method, a motion controller training method, a device, and equipment. Background Art
[0003] In games, there are often scenes where virtual characters fall to the ground after being hit and then pick themselves up. Players expect the virtual characters' movements to be both smooth and varied during these fall-and-get-up scenes. Therefore, generating high-quality get-up animations is a research focus in this field.
[0004] Summary of the Invention
[0005] The present invention provides an animation generation method, a motion controller training method, an apparatus, and a device that can generate the pose of a virtual character in the next frame in real time, improving the accuracy and realism of pose transitions, and making the standing animation effect more accurate and realistic. The technical solution is as follows.
[0006] On the one hand, an animation generation method is provided, which is executed by a computer device, and the method includes: obtaining target information and a first posture of a virtual character in a first screen, the target information including an operation on the virtual character and the motion state of the virtual character, the motion state being a standing state or a walking or running state, and the first posture being used to represent the posture of the virtual character in the first screen; when the virtual character is in the standing state, processing the target information and the first posture by an action controller to obtain action information of the virtual character, and the action controller being used to determine subsequent actions of the virtual character; simulating the standing action of the virtual character based on the action information and the first posture to obtain a second posture of the virtual character, and the second posture being used to represent the posture of the virtual character in a second screen, and the second screen being the next frame of the first screen; and displaying the second posture of the virtual character in the second screen to present the standing animation of the virtual character.
[0007] On the other hand, a method for training a motion controller is provided, which is performed by a computer device. The method includes: based on the motion controller, obtaining training samples of a virtual character and target training samples of the training samples, the training samples including sample target information, sample posture, and sample action information of the virtual character in the corresponding screen, the sample target information including operations on the virtual character and the motion state of the virtual character, and the sample action information determined by the motion controller based on the sample target information and the sample posture; the screen corresponding to the target training sample is the next frame of the screen corresponding to the training sample, and the sample posture in the target training sample is simulated based on the sample posture and the sample action information in the training sample; based on the training samples, the target training samples, and a discriminant network, obtaining a first loss, the first loss being used to represent the error of a first discrimination result, the first discrimination result being obtained by the discriminant network for posture changes, the first discrimination result indicating the possibility that the resource change is generated based on the motion controller, the posture change being the change of the virtual character from the posture of the training sample to the posture of the target training sample; and training the motion controller based on the first loss.
[0008] On the other hand, an animation generation device is provided, which includes: an acquisition module for acquiring target information and a first posture of a virtual character in a first screen, the target information including operations on the virtual character and the motion state of the virtual character, the motion state being a standing state or a walking or running state, and the first posture being used to represent the posture of the virtual character in the first screen; a processing module for processing the target information and the first posture through an action controller when the virtual character is in the standing state to obtain action information of the virtual character, and the action controller being used to determine subsequent actions of the virtual character; a simulation module for simulating the standing-up action of the virtual character based on the action information and the first posture to obtain a second posture of the virtual character, and the second posture being used to represent the posture of the virtual character in a second screen, which is the next frame of the first screen; and a display module for displaying the second posture of the virtual character in the second screen to present the standing-up animation of the virtual character.
[0009] In another aspect, a training device for a motion controller is provided, the device comprising: a first acquisition module for acquiring, based on the motion controller, training samples of a virtual character, the training samples comprising sample target information, sample poses, and sample action information of the virtual character in a corresponding frame, the sample target information comprising operations on the virtual character and the motion state of the virtual character, and the sample action information determined by the motion controller based on the sample target information and the sample poses; a second acquisition module for acquiring a target training sample for the training sample, the frame corresponding to the target training sample being the next frame of the frame corresponding to the training sample, the sample pose in the target training sample being simulated based on the sample poses and sample action information in the training sample; a first processing module for acquiring, based on the training sample, the target training sample, and a discriminant network, the first loss being used to represent an error in a first discrimination result, the first discrimination result being acquired by the discriminant network for a pose change, the first discrimination result indicating the likelihood that the resource change was generated by the motion controller, the pose change being a change in the pose of the virtual character from the pose of the training sample to the pose of the target training sample; and a first training module for training the motion controller based on the first loss.
[0010] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the animation generation method or the motion controller training method in the embodiment of the present application.
[0011] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the animation generation method or the motion controller training method in the embodiment of the present application.
[0012] On the other hand, a computer program product is provided, including a computer program, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the animation generation method or the motion controller training method provided in the above-mentioned various aspects or various optional implementations of each aspect.
[0013] An embodiment of the present application provides an animation generation method, which takes the posture of a virtual character in the current screen, the operation on the virtual character, and the motion state of the virtual character as input, and inputs them into an action controller for processing, so that the action controller applies the influence of the operation of the object on the basis of the current posture and motion state of the virtual character, thereby more accurately calculating the action information of the virtual character, in line with the intention of the object; then, the standing-up action of the virtual character is simulated through the action information and the first posture of the virtual character, so that the posture change of the virtual character can comply with the law of motion, that is, the posture change of the virtual character is more realistic; and the posture of the virtual character can be changed according to the guidance of the action information, and the posture of the virtual character in the next frame is generated in real time, which improves the accuracy and authenticity of the posture change, that is, the effect of the standing-up animation is more accurate and realistic. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] FIG1 is a schematic diagram of an implementation environment of an animation generation method provided according to an embodiment of the present application.
[0015] FIG2 is a flowchart of an animation generation method provided according to an embodiment of the present application.
[0016] FIG3 is a flowchart of another animation generation method provided according to an embodiment of the present application.
[0017] FIG4 is a flowchart of a method for determining a motion state according to an embodiment of the present application.
[0018] FIG5 is a schematic diagram of a model of a virtual character provided according to an embodiment of the present application.
[0019] FIG6 is a schematic diagram of generating a standing-up animation according to an embodiment of the present application.
[0020] FIG7 is a flowchart of a method for training a motion controller according to an embodiment of the present application.
[0021] FIG8 is a flowchart of another method for training a motion controller according to an embodiment of the present application.
[0022] FIG9 is a method for training a motion controller according to an embodiment of the present application.
[0023] FIG10 is a block diagram of an animation generating device provided according to an embodiment of the present application.
[0024] FIG11 is a block diagram of another animation generating device provided according to an embodiment of the present application.
[0025] FIG12 is a block diagram of a motion controller training device according to an embodiment of the present application.
[0026] FIG13 is a block diagram of another motion controller training device provided according to an embodiment of the present application.
[0027] FIG14 is a structural block diagram of a terminal provided according to an embodiment of the present application.
[0028] FIG15 is a schematic structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0029] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on the quantity and execution order.
[0030] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more.
[0031] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, storage, display, etc.), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the posture and target information involved in this application are obtained with full authorization.
[0032] In related technologies, three fixed animations are usually stored in the resource library first: a walking and running animation, an upward standing animation, and a downward standing animation. Under normal conditions, the virtual character is in a normal walking and running state, so a walking and running animation is simply played in a loop. When it is determined that the virtual character is about to be knocked down, the RagDoll system physically simulates the virtual character's falling animation; when it is determined that the virtual character has fallen to the ground, the virtual character's current posture is smoothly transitioned to the first frame of the upward standing animation or the downward standing animation according to the virtual character's body orientation, and then the corresponding animation segment is played to complete the standing action, and then the walking and running animation continues to be played in a loop.
[0033] However, the above technical solution requires a lot of work to determine when to activate the RagDoll system. It's also inaccurate. For example, if a virtual character is about to be hit by a vehicle, a judgment needs to be made before the collision occurs, and the animation needs to be switched to the RagDoll system. If the switch is made too late, the virtual character will be in a walking and running animation mode, which lacks physical simulation properties. As a result, even after the collision, the virtual character will not react, and the car will be thrown away. This performance is undoubtedly unacceptable. If the switch is made too early, the character's joints in the RagDoll system don't generate torque, causing the virtual character to collapse before a collision even occurs. Therefore, the above judgment mechanism requires developers to write and fine-tune each judgment condition and timing, which is labor-intensive and inaccurate, resulting in poor animation effects.
[0034] The animation generation method and the motion controller training method provided in the embodiments of the present application can be executed by a computer device. In some embodiments, the computer device is a terminal or a server. First, taking the computer device as an example of a terminal, the implementation environment of the animation generation method provided in the embodiments of the present application is introduced. Figure 1 is a schematic diagram of the implementation environment of an animation generation method provided according to an embodiment of the present application. Referring to Figure 1, the implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0035] In some embodiments, terminal 101 is a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, smart voice interaction device, smart home appliance, in-vehicle terminal, etc., but is not limited thereto. Terminal 101 has an application installed and running that supports virtual scenes. The application can be any of a first-person shooter (FPS), a third-person shooter, a multiplayer online battle arena (MOBA), a virtual reality application, a three-dimensional map program, or a multiplayer shooter survival game. Illustratively, terminal 101 is a terminal used by a user, who uses terminal 101 to manipulate a virtual character in a virtual scene to perform activities, including but not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up, shooting, attacking, and throwing. Illustratively, the virtual character is a virtual person, such as a simulated human character or an anime character. If the virtual character falls, terminal 101 can simulate the virtual character's standing up action through a motion controller based on the operation on the virtual character and the impact on the virtual character in the virtual environment, thereby generating a standing up animation.
[0036] Those skilled in the art will appreciate that the number of the above-mentioned terminals may be more or less. For example, the above-mentioned terminal may be only one, or the above-mentioned terminals may be dozens or hundreds, or a larger number. The embodiments of the present application do not limit the number of terminals and device types.
[0037] In some embodiments, server 102 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), big data and artificial intelligence platforms. Server 102 is used to provide background services for applications that support virtual scenes. In some embodiments, server 102 undertakes the main computing work and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work and terminal 101 undertakes the main computing work; or, server 102 and terminal 101 adopt a distributed computing architecture for collaborative computing.
[0038] In some embodiments, the server 102 can also train the motion controller to make the motion simulated by the terminal 101 through the motion controller more realistic. Accordingly, the server 102 can use the motion controller training method provided in the embodiment of the present application to train the motion controller. After training, the server 102 can send the parameters of the motion controller to the terminal 101 so that the terminal 101 can generate the standing animation of the virtual character according to the trained motion controller. That is, the implementation environment of the motion controller training method is the same as the implementation environment of the animation generation method, which will not be repeated here.
[0039] FIG2 is a flow chart of an animation generation method provided according to an embodiment of the present application. Referring to FIG2 , the present embodiment of the present application is described by taking execution by a terminal as an example. The method includes the following steps.
[0040] 201. The terminal obtains target information and a first posture of the virtual character in the first screen. The target information includes an operation on the virtual character and a motion state of the virtual character. The motion state is a standing state or a walking or running state. The first posture is used to represent the posture of the virtual character in the first screen.
[0041] In an embodiment of the present application, the terminal displays a first screen. A virtual character in a first posture is displayed in the first screen. The embodiment of the present application does not limit the specific form of the first posture. For example, the first screen includes a virtual character in a first posture and a virtual scene in which the virtual character is located. The operation included in the target information is the operation of the object on the virtual character, and the object refers to the user who controls the terminal. The operation is used to control the virtual character to perform activities. The object can perform operations on the virtual character by controlling the terminal to control the virtual character to perform activities. Among them, "activity" can be walking, running, or standing up, etc., which is not limited by the embodiment of the present application. The terminal obtains the operation of the object on the virtual character in the first screen, the motion state of the virtual character in the first screen, and the first posture of the virtual character in the first screen. Then, the terminal determines the target information of the virtual character based on the operation of the object on the virtual character and the motion state of the virtual character.
[0042] In the embodiment of the present application, the motion state is one of the multiple standing-up progresses and the walking-running state of the standing-up state, which is equivalent to the motion state being the standing-up state or the walking-running state; or, it is equivalent to the motion state being any one of the multiple standing-up progresses or the walking-running state. Among them, the multiple standing-up progresses of the standing-up state refer to the process of the virtual character standing up from falling to standing, that is, the display progress of the standing-up animation. In the embodiment of the present application, the standing-up state includes multiple standing-up progresses. When the motion state of the virtual character is any standing-up progress, the motion state of the virtual character is the standing-up state.
[0043] 202. When the virtual character is in a standing state, the terminal processes the target information and the first posture through the action controller to obtain action information of the virtual character. The action controller is used to determine subsequent actions of the virtual character.
[0044] In an embodiment of the present application, when the virtual character is in a standing-up state, or when the virtual character is in any standing-up progress of the standing-up state, the terminal can input the target information and the first posture of the virtual character as input information into the motion controller for processing to determine the subsequent action of the virtual character, and the subsequent action of the virtual character refers to the action of the virtual character in the screen after the first screen. The action controller can be a neural network, and the embodiment of the present application does not limit the structure of the action controller. The terminal outputs the action information of the virtual character through the action controller. The action information is used to represent the action of the virtual character in the screen after the first screen, and is also used to represent the internal torque exerted on the virtual character by the operation of the object, that is, the action information can reflect the influence of the object on the subsequent action of the virtual character.
[0045] 203. The terminal simulates the standing-up action of the virtual character based on the action information and the first posture to obtain a second posture of the virtual character, where the second posture is used to represent the posture of the virtual character in the second screen, which is the next frame of the first screen.
[0046] In an embodiment of the present application, the terminal simulates the virtual character's standing up action based on the action information and the first posture using knowledge of dynamics in the physical field. That is, based on knowledge of dynamics in the physical field, the terminal calculates the virtual character's action information and the first posture to determine the motion trajectory of the virtual character's subsequent action. The terminal can then determine the virtual character's second posture based on the first posture and the motion trajectory of the subsequent action. The second posture is the posture of the virtual character in the frame following the first frame.
[0047] 204. The terminal displays the second posture of the virtual character in the second screen to present a standing animation of the virtual character.
[0048] In an embodiment of the present application, after determining the posture of the virtual character in the next frame, the terminal displays the second screen. The second screen displays the virtual character in the second posture. That is, as the first screen switches to the second screen, the virtual character switches from the first posture to the second posture. Accordingly, the posture conversion process of the virtual character constitutes the standing-up animation of the virtual character. In an embodiment of the present application, after the virtual character falls to the ground, the terminal displays multiple consecutive screens in the above manner, which can reflect the virtual character's standing-up process from falling to standing up, and the virtual orange posture changes over time, which can present the virtual character's standing-up animation.
[0049] The solution provided by the embodiment of the present application takes the posture of the virtual character in the current screen, the operation on the virtual character, and the motion state of the virtual character as input, and inputs them into an action controller for processing, so that the action controller applies the influence of the object's operation on the basis of the current posture and motion state of the virtual character, thereby more accurately calculating the action information of the virtual character, in line with the intention of the object; then, the virtual character's standing-up action is simulated through the action information and the first posture of the virtual character, so that the posture change of the virtual character can comply with the law of motion, that is, the posture change of the virtual character is more realistic; and the posture of the virtual character can be changed according to the guidance of the action information, and the posture of the virtual character in the next frame is generated in real time, which improves the accuracy and authenticity of the posture change, that is, the effect of the standing-up animation is more accurate and realistic.
[0050] FIG3 is a flow chart of another animation generation method provided according to an embodiment of the present application. Referring to FIG3 , the present embodiment of the present application is described by taking execution by a terminal as an example. The animation generation method includes the following steps.
[0051] 301. The terminal obtains target information of the virtual character in the first screen, where the target information includes an operation of the object on the virtual character and a motion state of the virtual character, where the motion state is one of a plurality of standing-up progresses and a walking or running state.
[0052] In an embodiment of the present application, the terminal displays a virtual character in the first screen. Optionally, the virtual character is a bipedal character, which is not limited in the embodiment of the present application. Optionally, in the first screen, the virtual character is in a walking or running state or a standing state, which is not limited in the embodiment of the present application. Optionally, the walking or running state is divided into a walking state or a running state. Optionally, the standing state is divided into a plurality of standing-up progresses. The standing-up progress refers to the progress of the standing-up animation displayed in the process of the virtual character falling to the ground and standing up. The terminal obtains the object's operation on the virtual character in the first screen and the motion state of the virtual character. Then, the terminal determines the target information of the virtual character based on the object's operation on the virtual character and the motion state of the virtual character.
[0053] In some embodiments, in response to an object's operation on a virtual character, the terminal obtains the virtual character's expected movement direction and expected movement rate. The terminal then determines the virtual character's motion state in the first screen based on the expected duration of the standing-up animation and the first screen. The terminal then determines the virtual character's target information in the first screen based on the expected movement direction, expected movement rate, and movement state. The expected movement direction and expected movement rate are used to reflect the subsequent movement of the virtual character expected by the object. The embodiments of the present application do not impose any restrictions on the expected movement direction and expected movement rate.
[0054] In the embodiment of the present application, the operation on the virtual character is used to control the activity of the virtual character in the virtual scene. The direction corresponding to the operation is the expected movement direction, and the speed corresponding to the operation is the expected movement speed.
[0055] Optionally, the object triggers an operation on the virtual character through a virtual control displayed on the terminal; in the case where the virtual control is a draggable control, the dragging direction of the virtual control is the expected moving direction, and the product of the dragging distance of the virtual control and the moving rate corresponding to the unit distance is determined as the expected moving rate; or, in the case where the virtual control includes multiple directional controls, the terminal responds to the triggering operation of at least one directional control, determines the expected moving direction based on the direction corresponding to the triggered directional control, and determines the expected moving rate based on the moving rate corresponding to the triggered directional control.
[0056] In an embodiment of the present application, a virtual control is used to control the movement of a virtual character in a virtual scene. If the virtual control is a draggable control, the drag distance of the virtual control is positively correlated with the expected movement rate corresponding to the triggered operation. The movement rate corresponding to a unit distance is the movement rate corresponding to the operation triggered when the virtual control is dragged that unit distance.
[0057] For example, a virtual control that can be dragged is displayed in the first screen displayed by the terminal. The user triggers the dragging operation of the virtual control through the terminal. The terminal is equivalent to receiving the operation on the virtual character, so as to determine the expected moving direction and expected moving speed based on the dragging direction and dragging distance of the virtual control; and when the user no longer drags the virtual control through the terminal, it is equivalent to the terminal detecting that the dragging operation is over, and the terminal will display the virtual control at the display position before the virtual control was dragged, so that the virtual control automatically returns to its original position display.
[0058] In an embodiment of the present application, when the virtual control includes multiple directional controls, any directional control is used to control the movement of the virtual character in a corresponding direction at a corresponding movement rate. Different directional controls correspond to different movement directions, and the movement rates corresponding to different directional controls may be the same or different. The triggering operation for at least one directional control is any type of operation, for example, a click operation, a slide operation, etc. The user can simultaneously trigger one or more directional controls by manipulating the terminal. When a directional control is triggered, the direction corresponding to the directional control is determined as the desired movement direction, and the movement rate corresponding to the directional control is determined as the desired movement rate. When multiple directional controls are triggered simultaneously, the directions corresponding to the multiple triggered directional controls are superimposed to obtain the desired movement direction, and the average or sum of the desired movement rates corresponding to the multiple triggered directional controls is determined as the desired movement rate. For example, when multiple directional controls are triggered simultaneously, including a forward movement control and a rightward movement control, when determining the desired movement direction, the direction corresponding to the forward movement control is superimposed with the direction corresponding to the rightward movement control. The superimposed direction is the direction pointing to the right front, i.e., the desired movement direction is the direction pointing to the right front.
[0059] Optionally, the desired moving direction, the desired moving speed, and the motion state are combined to form the target information of the virtual character in the first frame. In the embodiment of the present application, the target information includes the desired moving direction, the desired moving speed, and the motion state.
[0060] Optionally, the target information is a vector, and the embodiments of the present application do not limit the form of the target information. For example, the target information g is a 4-dimensional vector. Among them, the first two dimensions of the target information g are used to represent the expected movement direction of the virtual character, which is composed of two dimensions of a unit vector on an XY plane, that is, the values of the first two dimensions of the target information g are used to represent a unit vector on an XY plane. The third dimension of the target information g is used to represent the expected movement rate of the virtual character, for example, the expected movement rate = 260 cm / s. The last dimension of the target information g is used to represent the motion state of the virtual character. Optionally. This motion state is called phase.
[0061] Optionally, the terminal pre-sets different numerical values for a variety of motion states, that is, different numerical values are used to represent different motion states; accordingly, during the process of the virtual character standing up, the terminal replaces the numerical values corresponding to the motion states in sequence to achieve the purpose of updating the motion state. Alternatively, the terminal pre-sets the initial value of the standing up state and the initial value of the walking and running state, and according to the number of frames of the standing up animation, gradually updates the numerical value corresponding to the motion state of the virtual character from the initial value of the standing up state to the initial value of the walking and running state to achieve the update of the motion state in the standing up animation. The embodiment of the present application does not limit the method for determining the motion state.
[0062] Optionally, the terminal determines the motion state of the virtual character based on the number of frames of the standing-up animation. Accordingly, the process of the terminal determining the motion state of the virtual character in the first frame based on the expected duration of the standing-up animation and the first frame includes: the terminal determining the number of frames corresponding to the completion of the standing-up animation based on the expected duration of the standing-up animation. Then, the terminal determines the unit progress value corresponding to each frame of the standing-up animation based on the number of frames and the initial value of the standing-up progress of the virtual character. Then, the terminal determines the motion state of the virtual character in the first frame based on the initial value, the unit progress value, and the timing of the first frame in the standing-up animation. The number of frames corresponding to the completion of the standing-up animation is equivalent to the number of frames corresponding to the standing-up animation. The initial value of the standing-up progress is used to represent the standing-up state of the virtual character in the first frame of the standing-up animation. The unit progress value is used to represent the size of the standing-up progress updated for each frame of the standing-up animation displayed. That is, the unit progress value is used to represent the difference between the standing-up progress of the virtual character in two adjacent frames, where the adjacent two frames are any two adjacent frames in the standing-up animation. The expected duration is any preset duration, for example, the expected duration is 3 seconds or 2 seconds, etc. Optionally, the expected duration is any duration set by a developer during the development process.
[0063] Optionally, the terminal determines the product of the expected duration of the standing-up animation and the rendering frame rate of the animation as the number of frames required to complete the standing-up animation. The terminal determines the difference between the standing-up progress and the walking-running state based on the pre-set initial value of the standing-up progress and the initial value of the walking-running state. The difference is used to represent the process required for the virtual character to recover from the initial standing-up progress to the walking-running state. Then, the terminal determines the ratio between the difference and the number of frames corresponding to the standing-up animation as the unit progress value corresponding to each frame in the standing-up animation. The terminal determines the target value corresponding to the first frame based on the timing of the first frame in the standing-up animation. The target value is used to represent the number of frames between the first frame (the current frame) and the first frame in the standing-up animation (the frame corresponding to the initial value of the standing-up progress). That is, the target value is used to represent the position of the first frame in the standing-up animation. Then, the terminal subtracts the first product from the initial value of the standing-up progress to obtain the numerical value corresponding to the motion state of the virtual character in the first frame. The first product is the product of the unit progress value and the target value. That is, the movement state of the virtual character in the first screen = the initial value of the standing progress - the unit progress value * the target value.
[0064] The rendering frame rate refers to the number of frames rendered per unit time, that is, the number of images rendered per unit time. The difference between the standing-up progress and the walking-running state is the difference between the initial value of the standing-up progress and the initial value of the walking-running state. Optionally, the process of determining the target value based on the timing includes: determining the difference between the timing of the first image in the standing-up animation and 1 as the target value corresponding to the first image.
[0065] Optionally, the terminal also records the motion state of the virtual character in each picture. Accordingly, the terminal subtracts the unit progress value from the numerical value corresponding to the motion state of the virtual character in the previous frame of the first picture to obtain the motion state of the virtual character in the first picture, that is, the numerical value corresponding to the motion state of the virtual character in the previous frame minus the unit progress value is the numerical value corresponding to the motion state of the virtual character in the first picture. The embodiment of the present application does not limit the initial value of the walking and running state and the initial value of the progress of getting up. In the process of the virtual character falling to the ground and getting up, as the virtual character gets up, the numerical value corresponding to the motion state of the virtual character gradually changes from the initial value of the progress of getting up to the initial value of the walking and running state.
[0066] For example, Figure 4 is a flowchart of a method for determining a motion state according to an embodiment of the present application. Referring to Figure 4 , when a virtual character is in a normal walking or running state, the terminal determines that the value corresponding to the virtual character's motion state is always equal to 0. In this case, 0 is the initial value of the walking or running state. When the virtual character is in the walking or running state, the terminal invokes the balance condition determination for each frame to determine whether the virtual character in the current frame meets the balance condition. When the virtual character is subjected to a strong impact, such as being hit by a virtual vehicle, the virtual character will not be able to maintain balance in a real-world situation, meaning that the virtual character's balance condition will be broken. At this point, the terminal determines that the virtual character is in a standing state. In other words, the terminal directly converts the virtual character's motion state from walking or running to standing up. Accordingly, the terminal changes the value corresponding to the motion state from 0 to 1. In this case, 1 is the initial value of the standing up state. If the expected standing up animation duration is 3 seconds, and the animation rendering rate uses a frame rate of 30 frames per second, the number of frames required for the standing up animation is 90. When the virtual character is in the standing up state, the standing up progress corresponding to each frame is reduced by 1 / 90. In this way, after 90 frames, the motion state will return to 0 (walking and running state). At this time, the terminal can call the balance condition judgment again. If the virtual character meets the balance condition, the terminal will restore the virtual character's motion state to walking and running state. If the virtual character does not meet the balance condition, the terminal will enter the standing state again, set the value corresponding to the motion state to 1, and continue to try to stand up.
[0067] Among them, the embodiment of the present application does not limit the method of determining the balance condition. Optionally, when the virtual character is in a walking or running state, the terminal determines whether the virtual character meets the balance condition based on the position and angle of the virtual character's pelvis. Then, when the virtual character does not meet the balance condition, the terminal updates the movement state of the virtual character from a walking or running state to a standing state. When the virtual character meets the balance condition, the terminal maintains the movement state of the virtual character in a walking or running state. The balance condition is a condition that needs to be met when the virtual character's body maintains balance. Optionally, the balance condition indicates the conditions that need to be met by the position and angle of the virtual character's pelvis when the virtual character's body maintains balance.
[0068] For example, the balance condition includes three conditions: the height of the pelvis is greater than 50 cm, the roll angle of the pelvis is less than 45°, and the pitch angle of the pelvis is less than 60°. If the height of the virtual character's pelvis is greater than 50 cm, the roll angle of the pelvis is less than 45°, and the pitch angle of the pelvis is less than 60°, the terminal determines that the virtual character meets the balance condition. Among them, the roll angle refers to the angle at which the virtual character's pelvis tilts in the left / right direction. The pitch angle refers to the angle at which the virtual character's pelvis tilts in the front / back direction. If the virtual character's pelvis does not meet any of the above three conditions, the terminal determines that the virtual character does not meet the balance condition.
[0069] 302. The terminal obtains a first posture of the virtual character in the first picture.
[0070] In an embodiment of the present application, the terminal obtains the angle values of multiple rotatable joints on the virtual character. The angle values of the multiple rotatable joints are used to reflect the postures of the multiple rotatable joints. Then, the terminal determines the first posture of the virtual character based on the angle values of the multiple rotatable joints, the position vector of the virtual character's pelvis, and the posture vector of the pelvis. Among them, whenever the terminal simulates the action of the virtual character, the terminal will record the quaternion of the displacement and posture of the virtual character's basic position (component) in the world coordinate system, the quaternion of the displacement and posture of the virtual character's pelvis relative to the basic position, and the quaternion of the posture of all rotatable joints participating in the simulation relative to the basic position. In the embodiment of the present application, joints can also be called bones. The basic position is used to reflect the position of the virtual character in the virtual scene. The basic position can be the position of a certain sole of the virtual character's foot, or it can be the center position of the two soles (two feet) of the virtual character, and the embodiment of the present application is not limited to this.
[0071] Optionally, the first posture includes the angle values of multiple rotatable joints, the position vector of the pelvis of the virtual character, and the posture vector of the pelvis, that is, the angle values of multiple rotatable joints, the position vector of the pelvis of the virtual character, and the posture vector of the pelvis constitute the first posture.
[0072] For example, FIG5 is a schematic diagram of a model of a virtual character provided according to an embodiment of the present application. Referring to FIG5 , the virtual character has two feet. The base position (component) of the virtual character is located directly below the pelvis (pelvis) of the virtual character, and the base position of the virtual character is on the plane where the two feet of the virtual character are located. The terminal calculates the rotation of all rotatable joints participating in the dynamic simulation relative to their parent joints based on the quaternion of the displacement and posture of the base position of the virtual character in the world coordinate system, the quaternion of the displacement and posture of the pelvis of the virtual character relative to the base position, and the quaternion of the posture of all rotatable joints participating in the simulation relative to the base position.
[0073] The embodiments of the present application do not limit the number and position of multiple rotatable joints. For example, in addition to the pelvis, the virtual character can also have 18 rotatable joints, please see Table 1 for details. The degree of freedom of each rotatable joint is 1-dimensional or 3-dimensional. Therefore, it can be seen from Table 1 that the 18 rotatable joints can generate a total of 40 degrees of freedom. The terminal can determine 40 angle values based on 18 sets of quaternions representing the posture rotation of the joints relative to the base position. Then, the terminal uses the 40 angle values, plus the 3-dimensional position vector of the virtual character's pelvis in the world coordinate system and the posture vector represented by the 6-dimensional forward-up vector, a total of 49-dimensional vectors, to constitute the feature vector s of the current first posture of the virtual character.
[0074] Table 1
[0075] It should be noted that the embodiment of the present application does not limit the execution timing of step 301 and step 302. The terminal can execute step 301 and step 302 at the same time, that is, the terminal simultaneously obtains the target information and the first posture of the virtual character in the first screen. Alternatively, the terminal can first execute step 301 and then execute step 302, that is, the terminal first obtains the target information of the virtual character in the first screen, and then obtains the first posture of the virtual character. Alternatively, the terminal can first execute step 302 and then execute step 301, that is, the terminal first obtains the first posture of the virtual character in the first screen, and then obtains the target information of the virtual character.
[0076] 303. When the virtual character is in a standing state, the terminal processes the target information and the first posture through the action controller to obtain action information of the virtual character. The action controller is used to determine subsequent actions of the virtual character.
[0077] In an embodiment of the present application, the action information is used to represent the internal torque exerted on the virtual character by the operation of the object. When the virtual character is in a standing state, the terminal inputs the target information and the first posture of the virtual object into the action controller, and the target information and the first posture are processed by the action controller to obtain the action information of the virtual character. Optionally, the action information is a 40-dimensional vector. Optionally, the physics engine of the terminal simulates the posture of the virtual character in the next frame based on the internal torque reflected by the action information and the external force and external torque given to the virtual character by the virtual environment. Optionally, the action controller is a three-layer multi-layer perceptron (MLP) neural network, which is not limited in the embodiment of the present application. Optionally, the action controller is also called a policy network, which is used to determine the subsequent actions of the virtual character.
[0078] In some embodiments, the terminal splices the feature vector of the first posture and the feature vector of the target information through the motion controller to obtain a character feature vector. Then, the terminal determines the motion information of the virtual character based on the motion controller and the character feature vector. Among them, the dimension of the character feature vector is equal to the dimension of the feature vector of the first posture plus the dimension of the feature vector of the target information. Accordingly, the dimension of the character feature vector = 49 + 4 = 53 dimensions. The solution provided in the embodiment of the present application splices the feature vector of the first posture and the feature vector of the target information so that the spliced character feature vector can more accurately reflect the current state of the virtual character and the influence of the object on the current state of the virtual character, thereby more accurately calculating the motion information of the virtual character, in line with the intention of the object, and facilitating more accurate simulation of the posture of the virtual character in the next frame, thereby making the effect of the standing-up animation more accurate and realistic.
[0079] The process by which the terminal determines the motion information of the virtual character based on the motion controller and the character feature vector includes: the terminal processes the character feature vector through the motion controller to obtain initial motion information. The terminal then performs Gaussian distribution sampling using the initial motion information as the mean and a preset value as the standard deviation to obtain the motion information. The preset value can be an arbitrary value.
[0080] Optionally, the process of processing the character feature vector by the action controller includes: performing a feature transformation on the character feature vector through a network layer in the action controller to obtain initial action information. In an embodiment of the present application, after the feature vector of the first posture and the feature vector of the target information are input into the action controller, the network layer in the action controller splices the feature vector of the first posture and the feature vector of the target information into a character feature vector and inputs it into a subsequent network layer of the action controller. The subsequent network layer of the action controller performs a feature transformation on the character feature vector and outputs the initial action information.
[0081] Optionally, the Gaussian distribution sampling process includes: constructing a Gaussian distribution with the initial action information as a mean and a preset value as a standard deviation; and sampling the Gaussian distribution using a preset algorithm to obtain the initial action information. The preset algorithm can be any sampling algorithm, such as an inverse transform method, a rejection sampling method, an importance sampling method, or the like.
[0082] The embodiment of the present application does not limit the preset value. The solution provided by the embodiment of the present application, after the initial action information is calculated by the action controller, Gaussian distribution sampling is performed on the initial action information, so that the final action information is random, thereby making the posture of the virtual character in the next frame more diverse; and, by sampling with the initial action information as the mean, there will not be much difference between the initial information obtained by sampling and the initial action information generated by the action controller, that is, on the basis of improving the diversity of postures, the posture of the virtual character in the next frame will not be too different from the posture controlled by the action controller, thereby ensuring the rationality of the posture change of the virtual character.
[0083] In some embodiments, the terminal may calculate the initial action information of the virtual character using the following formula 1.
[0084] Formula 1: m(s t ,g t )=W2*tanh(W1*tanh(W0*[s t ,g t ]+b0)+b1)+b2.
[0085] Among them, s t The feature vector used to represent the first posture; g t The feature vector used to represent the target information; [s t ,g t ] is used to represent the character feature vector; m is used to represent the initial action information, which is a 40-dimensional vector; matrices W0, W1, W2 and bias vectors b0, b1, b2 are used to represent the network parameters of the action controller, and tanh is used to represent the hyperbolic tangent function.
[0086] In some embodiments, the server may calculate the action information of the virtual character using the following formula 2.
[0087] Formula 2: a t ~N(m,0.15).
[0088] Among them, a t Used to represent the action information of the virtual character; m is used to represent the initial action information; 0.15 is used to represent the preset value, that is, the standard deviation; N is used to represent Gaussian distribution sampling.
[0089] 304. The terminal simulates the standing-up action of the virtual character based on the action information and the first posture to obtain a second posture of the virtual character. The second posture is used to represent the posture of the virtual character in the second screen, which is the next frame of the first screen.
[0090] In an embodiment of the present application, the terminal performs a dynamic simulation of the virtual character's standing up motion based on the motion information and the first posture. In this application, dynamic simulation is also referred to as physical simulation. Specifically, the terminal uses dynamic knowledge to calculate the virtual character's motion information and the first posture to obtain a motion trajectory for the virtual character's subsequent motion. Then, based on the first posture and the motion trajectory for the subsequent motion, the terminal determines the virtual character's second posture.
[0091] In some embodiments, the terminal may also determine the external torque applied to the virtual character based on the environmental impact exerted by the virtual environment on the virtual character. Then, the terminal adjusts the first posture based on the external torque of the virtual environment on the virtual character and the internal torque (action information) of the object on the virtual character to obtain the second posture of the virtual character. The solution provided in the embodiment of the present application not only takes into account the impact of the object on the virtual character, but also takes into account the impact of factors in the virtual environment on the virtual character, so that the posture changes of the virtual character are more accurate and realistic, that is, the effect of the standing-up animation is more accurate and realistic.
[0092] For example, Figure 6 is a schematic diagram of generating a standing-up animation according to an embodiment of the present application. Referring to Figure 6, in response to the object's operation on the virtual character, the terminal obtains the target information of the virtual character in the first screen. The target information includes the object's operation on the virtual character and the motion state of the virtual character. The terminal obtains the first posture of the virtual character in the first screen. Then, the terminal inputs the target information and the first posture of the virtual object into the motion controller, and processes the target information and the first posture through the motion controller to obtain the motion information of the virtual character. Then, the terminal combines the external torque of the virtual environment on the virtual character, and performs a dynamic simulation of the standing-up action of the virtual character according to the motion information and the first posture. The dynamic simulation includes forward dynamics and numerical integration. Then, the terminal obtains the second posture of the virtual character.
[0093] 305. The terminal displays the second posture of the virtual character in the second screen to present a standing animation of the virtual character.
[0094] In this embodiment of the present application, after determining the second posture of the virtual character, the terminal renders and displays a second screen. The second screen displays the virtual character in the second posture. That is, as the first screen switches to the second screen, the virtual character transitions from the first posture to the second posture. Accordingly, the virtual character's posture transition process constitutes the virtual character's standing animation.
[0095] The solution provided by the embodiment of the present application takes the posture of the virtual character in the current screen, the operation on the virtual character, and the motion state of the virtual character as input, and inputs them into an action controller for processing, so that the action controller applies the influence of the object's operation on the basis of the current posture and motion state of the virtual character, thereby more accurately calculating the action information of the virtual character, in line with the intention of the object; then, the virtual character's standing-up action is simulated through the action information and the first posture of the virtual character, so that the posture change of the virtual character can comply with the law of motion, that is, the posture change of the virtual character is more realistic; and the posture of the virtual character can be changed according to the guidance of the action information, and the posture of the virtual character in the next frame is generated in real time, which improves the accuracy and authenticity of the posture change, that is, the effect of the standing-up animation is more accurate and realistic.
[0096] FIG7 is a flow chart of a method for training an action controller according to an embodiment of the present application. Referring to FIG7 , the method is described by taking the method executed by a server as an example in the present embodiment. The method for training an action controller includes the following steps.
[0097] 701. The server obtains multiple training samples of the virtual character based on the motion controller, each training sample includes sample target information, sample posture and sample action information of the virtual character in the corresponding picture, the sample target information includes the operation of the object on the virtual character and the motion state of the virtual character, and the sample action information is determined by the motion controller based on the sample target information and the sample posture.
[0098] Optionally, the server obtains multiple training samples from the terminal, and the multiple training samples are generated based on the terminal's motion controller. The process of generating multiple training samples can be the same as the principle of executing steps 301-305, and will not be repeated here. This embodiment of the application does not limit the number of multiple training samples. The server trains the motion controller using the multiple training samples.
[0099] 702. For any training sample, the server obtains a target training sample of the training sample. The picture corresponding to the target training sample is the next frame of the picture corresponding to the training sample. The sample posture in the target training sample is simulated based on the sample posture and sample action information in the training sample.
[0100] In this embodiment of the present application, for any training sample, the server obtains, from multiple training samples, a training sample corresponding to the next frame of the image corresponding to the training sample, as the target training sample for the training sample. The sample pose in the target training sample is simulated by the motion generator based on the sample pose and sample motion information in the training sample.
[0101] It should be noted that the embodiment of the present disclosure is described by taking the example of determining the target training sample of any training sample from multiple training samples. In another embodiment, there is no need to perform the above steps 701-702, but other methods are adopted to obtain the training samples of the virtual character and the target training samples of the training samples based on the action controller.
[0102] 703. The server inputs the training sample and the target training sample into the discriminant network to obtain a first loss. The first loss is used to represent the error generated by the discriminant network in identifying posture changes based on the motion controller. The posture change refers to the change of the virtual character from the posture of the training sample to the posture of the target training sample.
[0103] In an embodiment of the present application, for any training sample, the server inputs the training sample and its target training sample into the discriminant network. The server then uses the discriminant network to determine whether the posture change between the two input training samples was generated by the motion controller. The server can calculate a first loss based on the multiple training samples and their respective target training samples.
[0104] In an embodiment of the present application, the process of obtaining the first loss is equivalent to obtaining the first loss based on the training sample, the target training sample, and the discriminant network. The first loss is used to represent the error of the first discrimination result. The first discrimination result is obtained by the discriminant network for posture changes, and the first discrimination result indicates the likelihood that the resource change is generated based on the motion controller. Optionally, the process of obtaining the first loss value includes: inputting the training sample and the target training sample into the discriminant network, the discriminant network outputting the first discrimination result, and determining the first loss based on the first discrimination result.
[0105] 704. The server trains the action controller based on the first loss.
[0106] In an embodiment of the present application, the server adjusts the parameters of the motion controller with the goal of minimizing the first loss. Optionally, the server sends the trained motion controller parameters to the terminal, and the terminal updates the parameters of the local motion controller. Optionally, the server directly sends the trained motion controller to the terminal, so that the terminal updates the motion controller.
[0107] The solution provided in the embodiment of the present application can more accurately calculate the sample action information of the virtual character for the training samples corresponding to any screen by applying the influence of the operation of the object through the action controller on the basis of the sample posture and sample action information of the virtual character in the screen, thereby obtaining training samples with better quality; then, for the training samples corresponding to the two adjacent screens, the discriminant network is used to discriminate whether the posture changes of the virtual characters in the two adjacent screens are generated by the action generator, so that the first loss obtained can accurately reflect the authenticity of the posture changes generated by the action controller; then, the action controller is trained by the first loss, so that the posture changes generated by the action controller become more and more accurate and realistic, thereby improving the performance of the action controller.
[0108] FIG8 is a flowchart of another method for training an action controller according to an embodiment of the present application. Referring to FIG8 , the method is described by taking the method executed by a server as an example in the present embodiment. The method for training an action controller includes the following steps.
[0109] 801. The server obtains multiple training samples of the virtual character based on the motion controller. Each training sample includes sample target information, sample posture and sample action information of the virtual character in the corresponding picture. The sample target information includes the operation of the object on the virtual character and the motion state of the virtual character. The sample action information is determined by the motion controller based on the sample target information and the sample posture.
[0110] Optionally, the server obtains multiple training samples from the terminal, and the multiple training samples are generated based on the motion controller. The generation process of the multiple training samples can be the same as the principle of the execution process of steps 301 to 305, and will not be repeated here. The embodiment of the present application does not limit the number of multiple training samples. Optionally, the number of training samples used in each round of training is 4096. The multiple training samples come from multiple games, or from different virtual scenes of the same game, and the embodiment of the present application does not limit this.
[0111] In some embodiments, the multiple training samples are derived from multiple game rounds. Accordingly, the terminal, based on the motion controller, obtains multiple training samples for the virtual character by randomly selecting a frame from four reference animations for each game round. The four reference animations include a walking animation, a running animation, an upward and downward animation. The frames in the four reference animations represent the posture changes of the virtual character in the corresponding state in real life. The terminal uses the posture of the virtual character in the frame as the initial posture for the current game round and performs multiple processing and simulations through the motion controller to obtain sample target information, sample posture, and sample action information for the virtual character in multiple frames of the current game round. The terminal then uses the sample target information, sample posture, and sample action information for the virtual character in each frame of the current game round as a training sample corresponding to the current game round. That is, the sample target information, sample posture, and sample action information for the virtual character in any frame of the current game round is used as a training sample for the current game round, resulting in multiple training samples for the current game round. The server can then directly obtain the multiple training samples from the terminal. The solution provided in the embodiment of the present application enriches the initial posture of each game by randomly extracting a frame from four reference animations and using the posture of the virtual character in the frame as the initial posture of the current game; on this basis, multiple training samples are obtained from multiple games. Since the movement trajectory of the virtual character in each game is generally different, correspondingly, the posture changes of the virtual character from the initial posture in each game will also be different, which enriches the posture of the virtual character used in the training process, helps to improve the performance of the motion controller, and enables the trained motion controller to generate a rich variety of actions.
[0112] Optionally, the process of multiple processing and multiple simulations through the action controller includes: taking the extracted picture as the first picture as an example, according to the above steps 301-305, obtaining the sample target information of the virtual character in the first picture; processing the sample target information and initial posture of the virtual character in the first picture through the action controller to obtain the first sample action information of the virtual character; simulating the action of the virtual character based on the first sample action information and the initial posture to obtain the sample posture of the virtual character in the second picture; obtaining the sample target information of the virtual character in the second picture; processing the sample target information and the sample posture of the virtual character in the second picture through the action controller to obtain the second sample action information of the virtual character; simulating the action of the virtual character based on the second sample action information and the sample posture of the virtual character in the second picture to obtain the sample posture of the virtual character in the third picture, repeating the above process, can obtain the sample target information, sample posture and sample action information of the virtual character in multiple pictures.
[0113] It should be noted that the process of performing multiple processing and multiple simulations by the motion controller is the same as the above steps 301-305, and will not be repeated here.
[0114] For example, before any game begins, the terminal randomly selects a reference animation from four pre-obtained reference animations. Each reference animation has a 25% probability of being selected. The terminal then randomly selects a frame from the reference animation and uses the avatar's posture in this frame as the avatar's initial posture s0 for that game. During the game, the terminal then processes and simulates the avatar's posture changes during that game, starting from initial posture s0, using the action generator to generate the avatar's posture changes for that game. If the extracted animation is a walking or running animation, the terminal determines the value (phase) corresponding to the avatar's motion state to be 0. If the extracted animation is an upward or downward rise animation, the terminal determines the value corresponding to the avatar's motion state to be determined by the remaining animation time. For example, if the upward rise animation lasts 3 seconds, and the terminal extracts the posture at the 1.2 second mark as the initial posture, then the remaining portion of the upward rise animation is 1.8 seconds, and the value corresponding to the avatar's motion state is 1.8 / 3 = 0.6. The upper stand-up animation refers to the start of the stand-up animation where the avatar is lying face up on the ground, then bends over and uses both hands to support the ground to stand up. The lower stand-up animation refers to the start of the stand-up animation where the avatar is lying face down on the ground, then uses both hands to support the ground to stand up.
[0115] In some embodiments, when the virtual character does not meet the balance condition, the terminal stops the current game and obtains the target screen of the current game. The target screen is the last frame of the current game. Then, a frame is randomly extracted from the four reference animations and the target screen, and the posture of the virtual character in the extracted screen is used as the initial posture of the next game. The motion controller is used for multiple processing and multiple simulations again to obtain sample target information, sample posture and sample action information of the virtual character in multiple screens of the next game. Then, the terminal uses the sample target information, sample posture and sample action information of the virtual character in multiple screens of the next game as multiple training samples corresponding to the next game. Due to the low performance of the motion controller at the beginning of training, if the virtual character does not meet the balance condition and the virtual character's standing animation is simulated, the virtual character will only toss and wriggle on the ground after falling, and it is impossible to collect training samples useful for normal walking and running training. The solution provided in the embodiment of the present application ends the current game when the virtual character does not meet the balance conditions, that is, stops obtaining training samples from the current game, and then restarts the next game to collect training samples, so that the quality of the training samples is higher, which is conducive to the subsequent improvement of the performance of the motion controller.
[0116] For example, after each game is terminated, if the number of collected training samples has not yet reached the required number (e.g., 4096 frames), the terminal can start the next game and continue collecting training samples. At this point, the terminal saves the pose of the avatar from the last frame of the previous game. The terminal then performs a random sampling operation, giving it a 20% probability of initializing the character's pose for the next game using this saved pose, and setting the value corresponding to the avatar's motion state to 1. The terminal then processes and simulates this using the motion generator to obtain the avatar's pose changes for the next game. The next game will last at least three seconds. There is an 80% probability that the terminal will initialize the pose for the next game using the same method as before, randomly sampling from four reference animations. This trajectory termination and pose initialization mechanism allows deep reinforcement learning algorithm training to account for a wide variety of possible poses of the avatar, from walking and running to falling, not just the falling poses depicted in the reference animations. Simulations also demonstrate that the animation generation effect ensures a smooth transition to the final standing position regardless of the starting pose.
[0117] In some embodiments, if the upward or downward standing animation is selected during the initialization of the pose, the terminal will not perform a balance check during the remaining animation time (for example, the 1.8 seconds mentioned above), and the game will not be terminated. After this time has elapsed, the terminal will perform a balance check for the avatar in each subsequent frame. If the avatar is determined to be unbalanced, the terminal will terminate the game and move on to the next one.
[0118] 802. For any training sample, the server obtains a target training sample of the training sample. The picture corresponding to the target training sample is the next frame of the picture corresponding to the training sample. The sample posture in the target training sample is simulated based on the sample posture and sample action information in the training sample.
[0119] In this embodiment of the present application, for any training sample, the server obtains, from multiple training samples, a training sample corresponding to the next frame of the image corresponding to the training sample, as the target training sample for the training sample. The sample pose in the target training sample is simulated by the motion controller based on the sample pose and sample motion information in the training sample.
[0120] 803. The server inputs the training sample and the target training sample into the discriminant network to obtain a first loss. The first loss is used to represent the error generated by the discriminant network in identifying posture changes based on the motion controller. The posture change refers to the change of the virtual character from the posture of the training sample to the posture of the target training sample.
[0121] In an embodiment of the present application, for any training sample, the server may simultaneously input the training sample and the target training sample of the training sample into the discriminant network. The server then uses the discriminant network to determine whether the posture change between the input training sample and the target training sample of the training sample was generated by the motion controller, thereby obtaining a first discrimination result. The server then calculates a first loss based on the first discrimination results of the multiple training samples.
[0122] In some embodiments, the server may calculate the discrimination result of the training sample using the following formula 3.
[0123] Formula 3: D(s t ,s t+1 )=W8*tanh(W7*tanh(W6*[s t ,s t+1 ]+b6)+b7)+b8.
[0124] Among them, S t The feature vector used to represent the sample posture in the training sample; S t+1 The feature vector used to represent the sample posture in the target training sample; [S t ,s t+1 ] is used to represent the feature vector of the sample posture after splicing, with a dimension of 49×2=98 dimensions; matrices W6, W7, W8 and bias vectors b6, b7, b8 are used to represent the network parameters of the discriminant network; D is used to represent the first discrimination result of the training sample, which is a vector with a dimension of only 1, and tanh is used to represent the hyperbolic tangent function.
[0125] In some embodiments, in addition to training based on multiple training samples generated by the motion controller, the server also obtains multiple reference samples from the four reference animations described above to train the motion controller. These multiple reference samples are used to reflect the pose changes of the virtual character in real-world situations. Accordingly, the server can calculate the first loss using the following formula 4.
[0126] Formula 4:
[0127] Among them, π is used to represent the action controller; (S t ,s t+1 )∈π is used to indicate that the posture change of the virtual character is simulated by the terminal through the motion controller; E is used to indicate the four reference animations; (s t ,s t+1 )∈E is used to indicate that the posture changes of the virtual character are directly extracted by the server from four fixed reference animations; D(S t ,s t+1 ) is used to represent the first discrimination result of the training sample; L DIt is used to represent the first loss, that is, the loss of the discriminant network D. The role of the discriminant network D is to identify (s t ,s t+1 ) is a posture change based on the simulation of the terminal's motion controller or a data set of posture changes in real situations. t ,s t+1 ) is simulated based on the terminal's motion controller. During the training process, we hope that the discriminator network outputs -1. If it is a dataset of posture changes from real situations, we hope that the discriminator outputs 1 during the training process.
[0128] 804. The server adjusts the parameters of the discriminant network according to the first loss.
[0129] In the embodiment of the present application, the server adjusts the parameters of the discriminant network with the goal of minimizing the first loss, so that the discriminant network can more accurately judge whether the sample posture in the training sample is simulated by the motion controller. When the subsequent motion controller is finally trained well, the motion controller can control the virtual character in the terminal to make a very similar action to the reference animation. At this time, the posture change (s t ,s t+1 ) can confuse the discriminant network, causing the output of the discriminant network to slowly move from -1 to 1.
[0130] 805. The server inputs the training sample and the target training sample into the discriminant network after adjusting the parameters to obtain a second discrimination result.
[0131] In this embodiment of the present application, the server again discriminates the training sample and the target training sample using the discriminant network after parameter adjustment to obtain a second discrimination result for the training sample. The principle of the server calculating the second discrimination result is the same as the principle of calculating the first discrimination result in step 703, and will not be repeated here.
[0132] 806. The server determines a reward value for the training sample based on the second discrimination result, where the reward value is used to represent the realism of the posture change of the virtual character controlled by the motion controller.
[0133] In an embodiment of the present application, the server sets a reward value for the discrimination results of the training samples to encourage the gesture changes controlled by the motion controller to become more and more realistic. Specifically, the closer the gesture changes simulated by the terminal through the motion controller are to the actual gesture changes in the reference animation, the higher the reward value determined by the server; the further the gesture changes simulated by the terminal through the motion controller are from the actual gesture changes in the reference animation, the lower the reward value determined by the server. In other words, the reward value is positively correlated with the realism of the gesture changes simulated by the motion controller.
[0134] In some embodiments, the server calculates the reward value of the training sample using the following formula 5.
[0135] Formula 5: r t =max(0,1-0.25*(D1(s t ,s t+1 )-1) 2 ).
[0136] Among them, r t Used to represent the reward value of the training sample; D1(s t ,s t+1 ) is used to represent the second discrimination result of the training sample, and D1 is the discrimination network after adjusting the parameters; t The feature vector used to represent the sample posture in the training sample; s t+1 The feature vector used to represent the sample pose in the target training sample.
[0137] 807. The server trains the action controller based on the reward value of the training sample.
[0138] In an embodiment of the present application, the server can input the training sample and the target training sample into the value network, respectively, to obtain the value of the training sample and the value of the target training sample. The value is used to represent the quality of the corresponding training sample. Then, the server trains the action controller based on the reward value of the training sample, including: the server trains the action controller based on the reward value of the training sample, the value of the training sample, and the value of the target training sample.
[0139] In some embodiments, the server may calculate the value of the training sample using the following formula 6.
[0140] Formula 6: V(s t )=W5*tanh(W4*tanh(W3*s t +b3)+b4)+b5.
[0141] Among them, s t The feature vector used to represent the sample posture in the training sample; V(s t ) is used to represent the value of the training sample, which is a quantity with only one dimension; matrices W3, W4, W5 and bias vectors b3, b4, b5 are used to represent the network parameters of the discriminant network, and tanh is used to represent the hyperbolic tangent function.
[0142] Optionally, the server trains the motion controller based on the reward value, value, and target value of the training sample, including: determining a dominance value for the training sample based on the reward value, value, and target value of the training sample. The dominance value represents the contribution of the training sample to training the motion controller. The server then determines a second loss based on the plurality of training samples and their dominance values. The second loss represents an error in the motion controller's determination of a subsequent motion of the virtual character. The server trains the motion controller based on the second loss.
[0143] In some embodiments, the server may calculate the advantage value of the training sample using the following formula 7.
[0144] Formula 7: A t =r t +0.95*V(s t+1 )-V(s t ).
[0145] Among them, A t Used to represent the advantage value of the training sample; r t Used to represent the reward value of the training sample; s t The feature vector used to represent the sample posture in the training sample; V(s t ) is used to represent the value of the training sample; s t+1 The feature vector used to represent the sample posture in the target training sample; V(s t+1 ) is used to represent the value of the target training sample.
[0146] In some embodiments, the server may calculate the second loss using the following formula eight.
[0147] Formula 8: L π =∑A t [a t -,(s t ,g t )] 2 .
[0148] Among them, π is used to represent the action controller; L π Used to represent the second loss, that is, the loss of the action controller; A t Used to represent the advantage value of the training sample; a t Used to represent the sample action information of the training sample;, used to represent the initial action information of the training sample; s t It is used to represent the sample pose of the training sample; g is used to represent the sample target information of the training sample.
[0149] In some embodiments, the server can also determine a third loss based on the advantage values of multiple training samples. The server then trains the value network using the third loss. The server can calculate the third loss using the following formula 9.
[0150] Formula 9: L V =∑[r t +0.95*V(s t+1 )-V(s t )] 2 .
[0151] Among them, V is used to represent the value network; L V Used to represent the third loss, that is, the loss of the value network; r t Used to represent the reward value of the training sample; s t The feature vector used to represent the sample posture in the training sample; V(s t ) is used to represent the value of the training sample; s t+1 The feature vector used to represent the sample posture in the target training sample; V(s t+1 ) is used to represent the value of the target training sample.
[0152] To more clearly describe the motion controller training method provided by an embodiment of the present application, the following description is further described with reference to the accompanying figures. Figure 9 illustrates a motion controller training method provided by an embodiment of the present application. Referring to Figure 9, the server initializes the parameters of the motion controller π, the value network V, and the discriminant network D. The server then sends the parameters of the motion controller π to the terminal. Based on the parameters of the motion controller π, the terminal simulates the posture of the virtual character to obtain training samples. The server obtains the training samples from the terminal. If the number of training samples is sufficient, the server adjusts the parameters of the discriminant network D based on the multiple training samples. The server then calculates the reward and advantage values of the training samples. Based on the reward and advantage values of the training samples, the server calculates the loss of the motion controller π and the loss of the value network V, thereby adjusting the parameters of the motion controller π and the value network V. The server then sends the parameters of the motion controller π to the terminal to determine whether the standing-up animation generated by the motion controller π meets the requirements. If the standing-up animation meets the requirements, the terminal stores the parameters of the motion controller π. Otherwise, the terminal continues to provide training samples to the server.
[0153] The solution provided in the embodiment of the present application can more accurately calculate the sample action information of the virtual character for the training samples corresponding to any screen by applying the influence of the operation of the object through the action controller on the basis of the sample posture and sample action information of the virtual character in the screen, thereby obtaining training samples with better quality; then, for the training samples corresponding to the two adjacent screens, the discriminant network is used to discriminate whether the posture changes of the virtual characters in the two adjacent screens are generated by the action generator, so that the first loss obtained can accurately reflect the authenticity of the posture changes generated by the action controller; then, the action controller is trained by the first loss, so that the posture changes generated by the action controller become more and more accurate and realistic, thereby improving the performance of the action controller.
[0154] FIG10 is a block diagram of an animation generation device according to an embodiment of the present application. The animation generation device is used to execute the steps of the above animation generation method. Referring to FIG10 , the device includes: an acquisition module 1001, a processing module 1002, a simulation module 1003, and a display module 1004.
[0155] The acquisition module 1001 is used to obtain the target information and the first posture of the virtual character in the first screen. The target information includes the operation of the object on the virtual character and the movement state of the virtual character. The movement state is a standing state or a walking or running state. The first posture is used to represent the posture of the virtual character in the first screen.
[0156] The processing module 1002 is used to process the target information and the first posture through the action controller when the virtual character is in a standing state to obtain the action information of the virtual character. The action controller is used to determine the subsequent action of the virtual character. The action information is used to represent the internal torque applied to the virtual character by the operation of the object.
[0157] The simulation module 1003 is used to simulate the virtual character's standing action based on the action information and the first posture to obtain the second posture of the virtual character. The second posture is used to represent the posture of the virtual character in the second picture, and the second picture is the next frame of the first picture.
[0158] The display module 1004 is configured to display the second posture of the virtual character in the second frame to present a standing animation of the virtual character.
[0159] In some embodiments, FIG11 is a block diagram of another animation generation device provided according to an embodiment of the present application. Referring to FIG11 , the acquisition module 1001 includes: an acquisition unit 10011 , a first determination unit 10012 , and a second determination unit 10013 .
[0160] The acquisition unit 10011 is configured to acquire an expected movement direction and an expected movement speed of the virtual character in response to an operation on the virtual character, wherein the expected movement direction and the expected movement speed are used to reflect the expected subsequent movement of the virtual character.
[0161] The first determining unit 10012 is configured to determine a motion state of the virtual character in the first frame based on the expected duration of the standing-up animation and the first frame.
[0162] The second determining unit 10013 is configured to determine target information of the virtual character in the first picture.
[0163] In some embodiments, the standing-up state includes a standing-up progress, and the standing-up progress is the progress of the standing-up animation displayed in the process of the virtual character falling to the ground and standing up; referring to FIG11 , the first determining unit 10012 is used to determine the number of frames corresponding to the standing-up animation based on the expected duration of the standing-up animation; based on the number of frames and the initial value of the standing-up progress of the virtual character, a unit progress value is determined, and the initial value is used for the standing-up state of the virtual character in the first frame of the standing-up animation, and the unit progress value is used to represent the difference between the standing-up progress of the virtual character in two adjacent frames, and the adjacent two frames are any two adjacent frames in the standing-up animation; based on the initial value, the unit progress value and the timing of the first frame in the standing-up animation, the motion state of the virtual character in the first frame is determined.
[0164] In some embodiments, referring to FIG11 , an acquisition module 1001 is used to acquire angle values of multiple rotatable joints on a virtual character, where the angle values of the multiple rotatable joints are used to reflect the postures of the multiple rotatable joints; and a first posture of the virtual character is determined based on the angle values of the multiple rotatable joints, the position vector of the pelvis of the virtual character, and the posture vector of the pelvis.
[0165] In some embodiments, referring to FIG. 11 , the processing module 1002 includes: a splicing unit 10021 and a third determining unit 10022 .
[0166] The splicing unit 10021 is used to splice the feature vector of the first posture and the feature vector of the target information through the motion controller to obtain a character feature vector.
[0167] The third determining unit 10022 is configured to determine the action information of the virtual character based on the action controller and the character feature vector.
[0168] In some embodiments, referring to FIG11 , the third determining unit 10022 is configured to process the character feature vector through the motion controller to obtain initial motion information; and perform Gaussian distribution sampling with the initial motion information as the mean and a preset value as the standard deviation to obtain motion information.
[0169] In some embodiments, referring to FIG11 , the apparatus further includes: a judgment module 1005 for judging whether the virtual character meets the balance condition based on the position of the pelvis and the angle of the pelvis of the virtual character when the virtual character is in a walking or running state; updating the motion state of the virtual character from the walking or running state to the standing state when the virtual character does not meet the balance condition; and maintaining the motion state of the virtual character in the walking or running state when the virtual character meets the balance condition.
[0170] An embodiment of the present application provides an animation generation device, which takes the posture of a virtual character in the current screen, the operation on the virtual character, and the motion state of the virtual character as input, and inputs them into a motion controller for processing, so that the motion controller applies the influence of the operation of the object on the basis of the current posture and motion state of the virtual character, thereby more accurately calculating the motion information of the virtual character, in line with the intention of the object; then, the standing-up action of the virtual character is simulated through the motion information and the first posture of the virtual character, so that the posture change of the virtual character can comply with the law of motion, that is, the posture change of the virtual character is more realistic; and the posture of the virtual character can be changed according to the guidance of the current motion information, and the posture of the virtual character in the next frame is generated in real time, thereby improving the accuracy and authenticity of the posture change, that is, making the effect of the standing-up animation more accurate and realistic.
[0171] It should be noted that the animation generation device provided in the above embodiment is only illustrated by the division of the above functional modules when running an application. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the animation generation device provided in the above embodiment and the animation generation method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0172] Figure 12 is a block diagram of a motion controller training device according to an embodiment of the present application. The motion controller training device is configured to execute the steps of the motion controller training method described above. Referring to Figure 12 , the device includes a first acquisition module 1201, a second acquisition module 1202, a first processing module 1203, and a first training module 1204.
[0173] The first acquisition module 1201 is used to obtain training samples of the virtual character based on the motion controller. The training samples include sample target information, sample posture and sample action information of the virtual character in the corresponding picture. The sample target information includes the operation of the virtual character and the motion state of the virtual character. The sample action information is determined by the motion controller based on the sample target information and the sample posture.
[0174] The second acquisition module 1202 is used to acquire a target training sample of the training sample. The picture corresponding to the target training sample is the next frame of the picture corresponding to the training sample. The sample posture in the target training sample is simulated based on the sample posture and sample action information in the training sample.
[0175] The first processing module 1203 is used to obtain a first loss based on the training sample, the target training sample and the discriminant network. The first loss is used to represent the error of the first discrimination result. The first discrimination result is obtained by the discriminant network for posture change. The first discrimination result indicates the possibility that the resource change is generated based on the action controller. The posture change refers to the change of the virtual character from the posture of the training sample to the posture of the target training sample.
[0176] The first training module 1204 is configured to train the motion controller based on the first loss.
[0177] In some embodiments, the first acquisition module 1201 is configured to acquire a plurality of training samples of the virtual character based on the motion controller;
[0178] The second acquisition module 1202 is configured to determine, for any training sample, a target training sample from multiple training samples.
[0179] In some embodiments, multiple training samples come from multiple games; based on the motion controller, the process of obtaining multiple training samples of the virtual character includes: for any game, randomly extracting a frame from four reference animations, the four reference animations including walking animation, running animation, standing up animation and standing up animation; taking the posture of the virtual character in the picture as the initial posture of the current game, performing multiple processing and multiple simulations through the motion controller to obtain sample target information, sample posture and sample action information of the virtual character in multiple pictures of the current game; using the sample target information, sample posture and sample action information of the virtual character in each picture of the current game as the training sample corresponding to the current game.
[0180] In some embodiments, the process of obtaining multiple training samples of a virtual character based on a motion controller also includes: if the virtual character does not meet the balance condition, stopping the current game and obtaining the target screen of the current game, where the target screen is the last frame of the current game; randomly extracting a frame from the four reference animations and the target screen, using the posture of the virtual character in the screen as the initial posture of the next game, and performing multiple processing and multiple simulations through the motion controller again to obtain sample target information, sample posture and sample action information of the virtual character in multiple screens of the next game; and using the sample target information, sample posture and sample action information of the virtual character in each screen of the next game as the training sample corresponding to the next game.
[0181] In some embodiments, FIG13 is a block diagram of another motion controller training device according to an embodiment of the present application. Referring to FIG13 , a first training module 1204 includes: an adjustment unit 12041 , a processing unit 12042 , a determination unit 12043 , and a training unit 12044 .
[0182] The adjustment unit 12041 is used to adjust the parameters of the discriminant network through the first loss.
[0183] The processing unit 12042 is used to input the training sample and the target training sample into the discriminant network after adjusting the parameters to obtain a second discrimination result.
[0184] The determination unit 12043 is used to determine a reward value of the training sample based on the second discrimination result, where the reward value is used to represent the realism of the posture change of the virtual character controlled by the motion controller.
[0185] The training unit 12044 is used to train the action controller based on the reward value of the training sample.
[0186] In some embodiments, referring to FIG13 , the apparatus further includes: a second processing module 1205 for inputting the training sample and the target training sample into the value network respectively to obtain the value of the training sample and the value of the target training sample, where the value is used to represent the quality of the corresponding training sample.
[0187] The training unit 12044 is used to train the motion controller based on the reward value of the training sample, the value of the training sample and the value of the target training sample.
[0188] In some embodiments, referring to FIG13 , the training unit 12044 is used to determine the advantage value of the training sample based on the reward value of the training sample, the value of the training sample and the value of the target training sample, where the advantage value is used to represent the contribution of the training sample to the training action controller; determine a second loss based on multiple training samples and the advantage values of multiple training samples, where the second loss is used to represent the error in the action controller determining the subsequent action of the virtual character; and train the action controller based on the second loss.
[0189] In some embodiments, referring to FIG. 13 , the apparatus further includes: a second training module 1206 for determining a third loss based on the advantage values of a plurality of training samples; and training the value network using the third loss.
[0190] An embodiment of the present application provides a training device for a motion controller. For training samples corresponding to any screen, the sample motion information of the virtual character can be calculated more accurately by applying the influence of the operation of the object through the motion controller on the basis of the sample posture and sample motion information of the virtual character in the screen, thereby obtaining training samples with better quality; then, for training samples corresponding to two adjacent screens, a discriminant network is used to discriminate whether the posture changes of the virtual characters in the two adjacent screens are generated by the action generator, so that the first loss obtained can accurately reflect the authenticity of the posture changes generated by the motion controller; then, the motion controller is trained by the first loss, so that the posture changes generated by the motion controller become more and more accurate and realistic, thereby improving the performance of the motion controller.
[0191] It should be noted that the motion controller training device provided in the above embodiment is merely an example of the division of the aforementioned functional modules when running an application. In actual applications, the aforementioned functions can be distributed among different functional modules as needed, i.e., the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the motion controller training device provided in the above embodiment and the motion controller training method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0192] In the embodiments of the present application, the computer device can be configured as a terminal or a server. When the computer device is configured as a terminal, the terminal can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. When the computer device is configured as a server, the server can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. The technical solution provided in the present application can also be implemented through interaction between the terminal and the server. The embodiments of the present application do not limit this.
[0193] FIG14 is a block diagram of a terminal 1400 according to an embodiment of the present application. Terminal 1400 may be a portable mobile terminal, such as a smartphone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer, or a desktop computer. Terminal 1400 may also be referred to as user equipment, a portable terminal, a laptop terminal, a desktop terminal, or other similar names. Typically, terminal 1400 includes a processor 1401 and a memory 1402.
[0194] The processor 1401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0195] Memory 1402 may include one or more computer-readable storage media, which may be non-transitory. Memory 1402 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in memory 1402 is used to store at least one computer program, which is used to be executed by processor 1401 to implement the animation generation method or motion controller training method provided in the method embodiment of the present application.
[0196] In some embodiments, terminal 1400 may optionally include a peripheral device interface 1403 and at least one peripheral device. Processor 1401, memory 1402, and peripheral device interface 1403 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 1403 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 1404, a display screen 1405, a camera assembly 1406, an audio circuit 1407, and a power supply 1408.
[0197] The peripheral device interface 1403 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 1401 and the memory 1402. In some embodiments, the processor 1401, the memory 1402, and the peripheral device interface 1403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1401, the memory 1402, and the peripheral device interface 1403 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0198] RF circuit 1404 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. RF circuit 1404 communicates with communication networks and other communication devices via electromagnetic signals. RF circuit 1404 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. In some embodiments, RF circuit 1404 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 the like. RF circuit 1404 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, RF circuit 1404 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0199] The display screen 1405 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1405 is a touch screen display, the display screen 1405 also has the ability to collect touch signals on the surface or above the surface of the display screen 1405. The touch signal can be input as a control signal to the processor 1401 for processing. At this time, the display screen 1405 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, there can be one display screen 1405, which is set on the front panel of the terminal 1400; in other embodiments, there can be at least two display screens 1405, which are respectively set on different surfaces of the terminal 1400 or in a folding design; in other embodiments, the display screen 1405 can be a flexible display screen, which is set on the curved surface or folding surface of the terminal 1400. Even more, the display screen 1405 can be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1405 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0200] The camera assembly 1406 is used to capture images or videos. In some embodiments, the camera assembly 1406 includes a front camera and a rear camera. Typically, the front camera is set on the front panel of the terminal, and the rear camera is set on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1406 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0201] The audio circuit 1407 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input into the processor 1401 for processing, or input into the radio frequency circuit 1404 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each located in different parts of the terminal 1400. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 1401 or the radio frequency circuit 1404 into sound waves. The speaker may 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 purposes such as ranging. In some embodiments, the audio circuit 1407 may also include a headphone jack.
[0202] Power supply 1408 is used to power various components in terminal 1400. Power supply 1408 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 1408 includes a rechargeable battery, the rechargeable battery can be wired or wirelessly rechargeable. A wired rechargeable battery is charged via a wired line, while a wireless rechargeable battery is charged via a wireless coil. The rechargeable battery can also support fast charging technology.
[0203] In some embodiments, the terminal 1400 further includes one or more sensors 1409 , including but not limited to: an acceleration sensor 1410 , a gyroscope sensor 1411 , a pressure sensor 1412 , an optical sensor 1413 , and a proximity sensor 1414 .
[0204] Accelerometer 1410 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by terminal 1400. For example, accelerometer 1410 can be used to detect the components of gravity acceleration along the three coordinate axes. Processor 1401 can control display screen 1405 to display the user interface in either a landscape or portrait view based on the gravity acceleration signal collected by accelerometer 1410. Accelerometer 1410 can also be used to collect game or user motion data.
[0205] The gyroscope sensor 1411 can detect the orientation and rotation angle of the terminal 1400. It can also work with the accelerometer 1410 to collect the user's 3D movements on the terminal 1400. Based on the data collected by the gyroscope sensor 1411, the processor 1401 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
[0206] The pressure sensor 1412 can be provided on the side frame of the terminal 1400 and / or below the display screen 1405. When the pressure sensor 1412 is provided on the side frame of the terminal 1400, it can detect the user's gripping signal of the terminal 1400, and the processor 1401 can perform left-hand or right-hand recognition or shortcut operations based on the gripping signal collected by the pressure sensor 1412. When the pressure sensor 1412 is provided below the display screen 1405, the processor 1401 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 1405. Operable controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0207] Optical sensor 1413 is used to detect ambient light intensity. In one embodiment, processor 1401 can control the display brightness of display screen 1405 based on the ambient light intensity detected by optical sensor 1413. Specifically, when the ambient light intensity is high, the display brightness of display screen 1405 is increased; when the ambient light intensity is low, the display brightness of display screen 1405 is decreased. In another embodiment, processor 1401 can also dynamically adjust the shooting parameters of camera assembly 1406 based on the ambient light intensity detected by optical sensor 1413.
[0208] Proximity sensor 1414, also known as a distance sensor, is typically located on the front panel of terminal 1400. Proximity sensor 1414 is used to detect the distance between the user and the front of terminal 1400. In one embodiment, when proximity sensor 1414 detects that the distance between the user and the front of terminal 1400 is gradually decreasing, processor 1401 controls display screen 1405 to switch from the screen-on state to the screen-off state. When proximity sensor 1414 detects that the distance between the user and the front of terminal 1400 is gradually increasing, processor 1401 controls display screen 1405 to switch from the screen-off state to the screen-on state.
[0209] Those skilled in the art will understand that the structure shown in FIG14 does not constitute a limitation on the terminal 1400 , and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0210] Figure 15 is a schematic diagram of the structure of a server provided according to an embodiment of the present application. The server 1500 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1501 and one or more memories 1502, wherein the memory 1502 stores at least one computer program, and the at least one computer program is loaded and executed by the processor 1501 to implement the animation generation method or the motion controller training method provided by the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server may also include other components for implementing device functions, which will not be described in detail here.
[0211] The present application also provides a computer-readable storage medium that stores at least one computer program, which is loaded and executed by a processor of a terminal to implement the operations performed by the terminal in the animation generation method or the motion controller training method of the above-mentioned embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0212] The present application also provides a computer program product, including a computer program stored in a computer-readable storage medium. A processor of a terminal reads the computer program from the computer-readable storage medium and executes the computer program, causing the terminal to perform the animation generation method or motion controller training method provided in the various optional implementations described above.
[0213] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0214] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. An animation generation method, executed by a computer device, comprising: Acquire target information and a first posture of the virtual character in the first picture, wherein the target information includes an operation on the virtual character and a motion state of the virtual character, wherein the motion state is a standing state or a walking and running state, and the first posture is used to represent the posture of the virtual character in the first picture; When the virtual character is in the standing state, the target information and the first posture are processed by a motion controller to obtain motion information of the virtual character, and the motion controller is used to determine a subsequent motion of the virtual character; Based on the action information and the first posture, simulating a standing action of the virtual character to obtain a second posture of the virtual character, wherein the second posture is used to represent a posture of the virtual character in a second picture, and the second picture is a frame next to the first picture; The second posture of the virtual character is displayed in the second picture to present a standing animation of the virtual character.
2. The method according to claim 1, wherein: The process of obtaining target information of the virtual character in the first screen includes: In response to the operation on the virtual character, obtaining an expected moving direction and an expected moving speed of the virtual character, wherein the expected moving direction and the expected moving speed are used to reflect the expected subsequent movement of the virtual character; Determining a motion state of the virtual character in the first picture based on the expected duration of the standing-up animation and the first picture; The target information is determined based on the expected moving direction, the expected moving speed, and the motion state.
3. The method according to claim 1 or 2, wherein: The standing up state includes a standing up progress, and the standing up progress is a progress of a standing up animation displayed in a process in which the virtual character stands up from falling to the ground; and determining the motion state of the virtual character in the first picture based on the expected duration of the standing up animation and the first picture includes: Determining the number of frames corresponding to the standing up animation based on the expected duration of the standing up animation; Based on the number of frames and the initial value of the virtual character's standing-up progress, a unit progress value is determined, wherein the initial value is used for the standing-up state of the virtual character in the first frame of the standing-up animation, and the unit progress value is used to represent the difference between the standing-up progress of the virtual character in two adjacent frames, wherein the two adjacent frames are any two adjacent frames in the standing-up animation; Based on the initial value, the unit progress value and the timing of the first picture in the standing-up animation, a motion state of the virtual character in the first picture is determined.
4. The method according to any one of claims 1 to 3, wherein: The process of obtaining the first posture of the virtual character in the first picture includes: Acquire angle values of a plurality of rotatable joints on the virtual character, where the angle values of the plurality of rotatable joints are used to reflect the postures of the plurality of rotatable joints; A first posture of the virtual character is determined based on the angle values of the plurality of rotatable joints, a position vector of the pelvis of the virtual character, and a posture vector of the pelvis.
5. The method according to any one of claims 1 to 4, wherein: When the virtual character is in the standing state, the target information and the first posture are processed by the action controller to obtain the action information of the virtual character, including: By means of the motion controller, the feature vector of the first posture and the feature vector of the target information are concatenated to obtain a character feature vector; Based on the motion controller and the character feature vector, motion information of the virtual character is determined.
6. The method according to any one of claims 1 to 5, wherein: The step of determining the action information of the virtual character based on the action controller and the character feature vector comprises: Processing the character feature vector through the action controller to obtain initial action information; The action information is obtained by performing Gaussian distribution sampling with the initial action information as the mean and a preset value as the standard deviation.
7. The method according to any one of claims 1 to 6, wherein: The method further comprises: When the virtual character is in the walking and running state, judging whether the virtual character meets the balance condition based on the position of the pelvis of the virtual character and the angle of the pelvis; When the virtual character does not meet the balance condition, updating the motion state of the virtual character from the walking and running state to the standing state; When the virtual character meets the balance condition, the movement state of the virtual character is maintained in the walking and running state.
8. A method for training an action controller, executed by a computer device, the method comprising: Based on the action controller, a training sample of the virtual character is obtained, the training sample includes sample target information, sample posture and sample action information of the virtual character in the corresponding picture, the sample target information includes the operation on the virtual character and the motion state of the virtual character, and the sample action information is determined by the action controller based on the sample target information and the sample posture; Acquire a target training sample of the training sample, wherein the picture corresponding to the target training sample is the next frame of the picture corresponding to the training sample, and the sample posture in the target training sample is simulated based on the sample posture and sample action information in the training sample; Based on the training sample, the target training sample and the discriminant network, a first loss is obtained, the first loss is used to represent an error of a first discriminant result, the first discriminant result is obtained by the discriminant network for a posture change, the first discriminant result indicates a possibility that the resource change is generated based on the action controller, the posture change refers to a change of the virtual character from a posture of the training sample to a posture of the target training sample; The action controller is trained based on the first loss.
9. The method according to claim 8, wherein: The step of obtaining the training samples of the virtual character and the target training samples based on the action controller includes: Based on the action controller, obtaining a plurality of training samples of the virtual character; For any training sample, a target training sample of the training sample is determined from the multiple training samples.
10. The method according to claim 8 or 9, wherein: The multiple training samples come from multiple games; The step of obtaining a plurality of training samples of the virtual character based on the action controller comprises: For any game, a frame is randomly selected from four reference animations, wherein the four reference animations include a walking animation, a running animation, an upward and downward standing animation; Taking the posture of the virtual character in the screen as the initial posture of the current game, the action controller performs multiple processing and multiple simulations to obtain sample target information, sample posture and sample action information of the virtual character in multiple screens of the current game; The sample target information, sample posture and sample action information of the virtual character in each screen of the current game are used as training samples corresponding to the current game.
11. The method according to any one of claims 8 to 10, wherein: The method further comprises: When the virtual character does not meet the balance condition, the current game is stopped to obtain a target screen of the current game, where the target screen is the last frame of the current game; A frame is randomly selected from the four reference animations and the target frame, and the posture of the virtual character in the frame is used as the initial posture of the next game, and the action controller is used to perform multiple processing and multiple simulations again to obtain sample target information, sample posture and sample action information of the virtual character in multiple frames of the next game; The sample target information, sample posture and sample action information of the virtual character in each screen of the next game are used as training samples corresponding to the next game.
12. The method according to any one of claims 8 to 11, wherein: The step of training the action controller based on the first loss includes: Adjusting the parameters of the discriminant network by using the first loss; Inputting the training sample and the target training sample into the discriminant network after adjusting the parameters to obtain a second discriminant result; Based on the second discrimination result, determining a reward value of the training sample, wherein the reward value is used to represent the authenticity of the posture change of the virtual character controlled by the motion controller; The action controller is trained based on the reward value of the training sample.
13. The method according to any one of claims 8 to 12, wherein: The method further comprises: Inputting the training sample and the target training sample into a value network respectively to obtain the value of the training sample and the value of the target training sample, wherein the value is used to represent the quality of the corresponding training sample; The step of training the action controller based on the reward value of the training sample comprises: The action controller is trained based on the reward value of the training sample, the value of the training sample and the value of the target training sample.
14. The method according to any one of claims 8 to 13, wherein: The step of training the action controller based on the reward value of the training sample, the value of the training sample and the value of the target training sample includes: Determine, based on the reward value of the training sample, the value of the training sample and the value of the target training sample, an advantage value of the training sample, wherein the advantage value is used to indicate the contribution of the training sample to training the action controller; Determine a second loss based on the plurality of training samples and the advantage values of the plurality of training samples, wherein the second loss is used to represent an error in determining a subsequent action of the virtual character by the action controller; The action controller is trained based on the second loss.
15. The method according to any one of claims 8 to 14, wherein: The method further comprises: Determining a third loss based on the advantage values of the plurality of training samples; The value network is trained through the third loss.
16. An animation generating device, comprising: an acquisition module, configured to acquire target information and a first posture of the virtual character in the first picture, wherein the target information includes an operation on the virtual character and a motion state of the virtual character, wherein the motion state is a standing state or a walking and running state, and the first posture is used to represent the posture of the virtual character in the first picture; a processing module, configured to process the target information and the first posture through a motion controller to obtain motion information of the virtual character when the virtual character is in the standing state, wherein the motion controller is configured to determine a subsequent motion of the virtual character; a simulation module, configured to simulate a standing action of the virtual character based on the action information and the first posture, to obtain a second posture of the virtual character, wherein the second posture is used to represent a posture of the virtual character in a second picture, and the second picture is a next frame of the first picture; The display module is used to display the second posture of the virtual character in the second picture to present the standing animation of the virtual character.
17. A training device for a motion controller, the device comprising: A first acquisition module is used to acquire a training sample of a virtual character based on an action controller, wherein the training sample includes sample target information, sample posture and sample action information of the virtual character in a corresponding picture, wherein the sample target information includes an operation on the virtual character and a motion state of the virtual character, and the sample action information is determined by the action controller based on the sample target information and the sample posture; A second acquisition module is used to acquire a target training sample of the training sample, wherein the picture corresponding to the target training sample is the next frame of the picture corresponding to the training sample, and the sample posture in the target training sample is simulated based on the sample posture and sample action information in the training sample; A first processing module is configured to obtain a first loss based on the training sample, the target training sample and the discriminant network, wherein the first loss is used to represent an error of a first discriminant result, the first discriminant result is obtained by the discriminant network for a posture change, the first discriminant result indicates a possibility that the resource change is generated based on the action controller, and the posture change refers to a change of the virtual character from a posture of the training sample to a posture of the target training sample; A first training module is used to train the action controller based on the first loss.
18. A computer device, comprising a processor and a memory, wherein the memory is used to store at least one computer program, wherein the at least one computer program is loaded by the processor and executes the animation generation method described in any one of claims 1 to 7; or, wherein the at least one computer program is loaded by the processor and executes the motion controller training method described in any one of claims 8 to 15.
19. A computer-readable storage medium, wherein the computer-readable storage medium is used to store at least one computer program, wherein the at least one computer program is used to execute the animation generation method described in any one of claims 1 to 7; or, the at least one computer program is used to execute the motion controller training method described in any one of claims 8 to 15.
20. A computer program product, comprising a computer program, wherein the computer program is stored in a computer-readable storage medium, a processor of a computer device reads the computer program from the computer-readable storage medium, the computer program is loaded by the processor and executes the animation generation method described in any one of claims 1 to 7; or, the at least one section of the computer program is loaded by the processor and executes the training method for the motion controller described in any one of claims 8 to 15.
Citation Information
Patent Citations
Motion determination model training method and device for virtual object, equipment and medium
CN112221140A
AI model training method for FPS game and device thereof, equipment and storage medium
CN113663335A
Data processing method and device of virtual model, equipment and medium
CN115797517A
Dynamic simulation attitude control method, training method, device and equipment
CN116524076A
Animation generation method, motion controller training method, device and equipment
CN116883561A