Data processing method, device and equipment and readable storage medium
Through animation asset configuration diagrams and similar posture matching technology, the virtual object state machine settings are simplified, and smooth transitions between virtual object movement modes are achieved, reducing animation costs and improving animation quality.
Patent Information
- Application Number
- CN202410440063.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-12
- Publication Date
- 2025-10-21
AI Technical Summary
When switching the movement mode of a virtual object, traditional methods require drawing a large number of transition animations and setting up complex program logic, resulting in high animation costs and maintenance complexity.
The operation mapping data of the virtual object is obtained through the animation asset configuration diagram, and the target transition animation frame is generated using similar posture matching technology to achieve smooth transition between virtual object states.
It reduces animation costs, avoids numerous transition animation drawing and transition state settings, and improves the animation quality of virtual object movement.
Smart Images

Figure CN120823293A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, apparatus, device, and readable storage medium. Background Art
[0002] In the field of animation, virtual objects have a variety of movement modes, such as standing, walking, running, etc. Each movement mode can be expressed through a movement state and a corresponding main animation. However, when a virtual object switches between different movement modes, for example, when a virtual object changes from walking forward to running right forward, the final frame of the main animation where the virtual object ends up often differs greatly. Traditional solutions often require drawing a large number of transition animations and setting up multiple matching program logics. For example, it is necessary to draw an animation for starting to run with the left foot touching the ground while walking, and also to draw an animation for starting to run with the right foot touching the ground while walking. This requires paying attention to more picture details, is technically difficult, and has high animation costs. In addition, the transition animation needs to be set to a transition state, which causes the virtual object to explode in state during movement, resulting in high maintenance costs. Summary of the Invention
[0003] The embodiments of the present application provide a data processing method, apparatus, device, and readable storage medium, which can reduce animation costs while improving the animation quality of virtual object motion.
[0004] On the one hand, an embodiment of the present application provides a data processing method, including:
[0005] Obtain an animation asset configuration diagram for a virtual object; the animation asset configuration diagram is used to indicate M object states and N state transition conditions of the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent a state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state;
[0006] obtaining operation mapping data corresponding to the virtual object, and when the operation mapping data of the virtual object satisfies the target state transition condition, transitioning the virtual object from the first object state to the second object state, and obtaining a target animation frame of the virtual object in the first object state; the target animation frame being an animation frame within a main animation of the virtual object in the first object state when the virtual object transitions from the first object state to the second object state;
[0007] If the target transition animation corresponding to the target state transition condition is obtained, the target animation frame is matched with the target transition animation for similar posture, and the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation is obtained. The target transition animation is played starting from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played.
[0008] Wherein, the operation mapping data includes a speed parameter and an angle parameter; and the method further includes:
[0009] Acquiring historical operation data of the virtual object, and determining that the virtual object is in a first object state based on the historical operation data;
[0010] Acquire S state transition conditions associated with the first object state in the animation asset configuration diagram; the S state transition conditions include a target state transition condition, the target state transition condition corresponds to a speed threshold range and an angle threshold range; S is a positive integer;
[0011] If the speed parameter of the virtual object is within the speed threshold range, and the angle parameter of the virtual object is within the angle threshold range, it is determined that the operation mapping data of the virtual object meets the target state transition condition.
[0012] Among them, also include:
[0013] If the speed parameter of the virtual object is not within the speed threshold range, or the angle parameter of the virtual object is not within the angle threshold range, the main animation of the first object state continues to be played after the main animation of the first object state ends.
[0014] Among them, also include:
[0015] The historical operation data of the virtual object is obtained. If the operation mapping data is the same as the historical operation data, the main animation of the first object state is continued to be played after the main animation of the first object state is finished.
[0016] The step of performing similar posture matching on the target animation frame and the target transition animation to obtain a target transition animation frame having the highest posture similarity with the target animation frame includes:
[0017] Obtain T transition animation frames in the target transition animation, and posture feature vectors corresponding to the T transition animation frames, and obtain a target feature vector of the target animation frame; T is a positive integer;
[0018] Similarities are calculated for the target feature vector and T posture feature vectors respectively to obtain T posture similarities, and the transition animation frame with the highest posture similarity is determined as the target transition animation frame.
[0019] The step of performing similar posture matching on the target animation frame and the target transition animation to obtain a target transition animation frame having the highest posture similarity with the target animation frame includes:
[0020] Obtain T transition animation frames in the target transition animation, and the posture labels of the T transition animation frames, and obtain the target label of the target animation frame; T is a positive integer;
[0021] If there is a posture tag identical to the target tag among the T posture tags, the transition animation frame having the posture tag identical to the target tag is determined as the target transition animation frame.
[0022] Among them, also include:
[0023] If there is no posture tag identical to the target tag among the T posture tags, then obtain the target number of frames between the target animation frame and the end frame in the main animation of the first object state, and determine the target transition animation frame in the target transition animation based on the target number of frames; the number of frames between the start frame in the target transition animation and the target transition animation frame is the target number of frames.
[0024] Among them, also include:
[0025] If the target transition animation corresponding to the target state conversion condition is not obtained, the inertia trend vector of the target animation frame is obtained, and based on the inertia trend vector, similar posture matching is performed on the target animation frame and the main animation of the second object state to obtain the mixed transition animation frame with the highest posture similarity to the target animation frame in the main animation of the second object state, and the main animation of the second object state is played starting from the mixed transition animation frame.
[0026] Among them, also include:
[0027] If the target transition animation corresponding to the target state transition condition is not obtained, then obtain P first animation frames in the main animation of the first object state and Q second animation frames in the main animation of the second object state; P and Q are both positive integers;
[0028] Similar posture matching is performed on the P first animation frames and the Q second animation frames to obtain an animation frame group with the highest posture similarity, and the target transition animation is generated based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity.
[0029] The generating of the target transition animation based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity includes:
[0030] generating a first transition animation based on the main animation of the first object state and the first animation frame in the animation frame group with the highest posture similarity; a start frame of the first transition animation is the same as the start frame of the main animation of the first object state, and an end frame of the first transition animation is the first animation frame in the animation frame group with the highest posture similarity;
[0031] generating a second transition animation based on the main animation of the second object state and the second animation frame in the animation frame group with the highest posture similarity; a start frame of the second transition animation is the same as the start frame of the main animation of the second object state, and an end frame of the second transition animation is the second animation frame in the animation frame group with the highest posture similarity;
[0032] The first transition animation and the second transition animation are spliced into the target transition animation.
[0033] Among them, also include:
[0034] If the target transition animation corresponding to the target state transition condition is not obtained, then determining a transition state between the first object state and the second object state among the M object states in the animation asset configuration diagram; the transition state refers to an object state that has state transition conditions with both the first object state and the second object state, and the state transition condition between the first object state and the transition state has a first transition animation, and the state transition condition between the second object state and the transition state has a second transition animation;
[0035] The first transition animation and the second transition animation are spliced into a target transition animation.
[0036] The animation asset configuration diagram includes M coordinate vertices, and the M coordinate vertices are respectively used to indicate different object states of the virtual object; N state transition markings are included between the M coordinate vertices, and the N state transition markings are respectively used to indicate state transition conditions for transitioning between different object states.
[0037] In one aspect, an embodiment of the present application provides a data processing device, including:
[0038] An asset configuration module is configured to obtain an animated asset configuration diagram for a virtual object; the animated asset configuration diagram is configured to indicate M object states and N state transition conditions for the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent a state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; and the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state.
[0039] a state transition module, configured to obtain operation mapping data corresponding to the virtual object, and when the operation mapping data of the virtual object satisfies a target state transition condition, transition the virtual object from a first object state to a second object state, and obtain a target animation frame of the virtual object in the first object state; the target animation frame being the animation frame of the virtual object in the main animation of the first object state when the virtual object transitions from the first object state to the second object state;
[0040] The animation transition module is used to match the target animation frame with the target transition animation if the target transition animation corresponding to the target state transition condition is obtained, obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, play the target transition animation from the target transition animation frame, and when the target transition animation ends, play the main animation of the second object state.
[0041] In a possible implementation, the operation mapping data includes a speed parameter and an angle parameter; and the state conversion module is further configured to perform the following operations:
[0042] Acquiring historical operation data of the virtual object, and determining that the virtual object is in a first object state based on the historical operation data;
[0043] Obtaining S state transition conditions associated with the first object state in the animation asset configuration diagram; the S state transition conditions include a target state transition condition, the target state transition condition corresponding to a speed threshold range and an angle threshold range; S is a positive integer;
[0044] If the speed parameter of the virtual object is within the speed threshold range, and the angle parameter of the virtual object is within the angle threshold range, it is determined that the operation mapping data of the virtual object meets the target state transition condition.
[0045] In a possible implementation, the state transition module is further configured to perform the following operations:
[0046] If the speed parameter of the virtual object is not within the speed threshold range, or the angle parameter of the virtual object is not within the angle threshold range, then when the main animation of the first object state ends, the main animation of the first object state continues to be played.
[0047] In a possible implementation, the state transition module is further configured to perform the following operations:
[0048] The historical operation data of the virtual object is obtained. If the operation mapping data is the same as the historical operation data, the main animation of the first object state continues to be played after the main animation of the first object state ends.
[0049] In one possible implementation, the animation transition module is configured to perform similar posture matching between the target animation frame and the target transition animation, and when obtaining the target transition animation frame having the highest posture similarity with the target animation frame, specifically perform the following operations:
[0050] Obtain T transition animation frames in the target transition animation, and the posture feature vectors corresponding to the T transition animation frames, and obtain the target feature vector of the target animation frame; T is a positive integer;
[0051] The similarity between the target feature vector and the T posture feature vectors is calculated respectively to obtain T posture similarities, and the transition animation frame with the highest posture similarity is determined as the target transition animation frame.
[0052] In one possible implementation, the animation transition module is configured to perform similar posture matching between the target animation frame and the target transition animation, and when obtaining the target transition animation frame having the highest posture similarity with the target animation frame, specifically perform the following operations:
[0053] Get T transition animation frames in the target transition animation, as well as the posture labels of T transition animation frames, and get the target label of the target animation frame; T is a positive integer;
[0054] If there is a posture tag identical to the target tag among the T posture tags, the transition animation frame having the posture tag identical to the target tag is determined as the target transition animation frame.
[0055] In a possible implementation, the animation transition module is further configured to perform the following operations:
[0056] If there is no posture tag that is the same as the target tag among the T posture tags, then the target number of frames between the target animation frame and the end frame in the main animation of the first object state is obtained, and the target transition animation frame is determined in the target transition animation according to the target frame number; the number of frames between the start frame in the target transition animation and the target transition animation frame is the target frame number
[0057] In a possible implementation, the animation transition module is further configured to perform the following operations:
[0058] If the target transition animation corresponding to the target state conversion condition is not obtained, the inertia trend vector of the target animation frame is obtained, and the target animation frame and the main animation of the second object state are matched with each other based on the inertia trend vector. The mixed transition animation frame with the highest posture similarity with the target animation frame in the main animation of the second object state is obtained, and the main animation of the second object state is played starting from the mixed transition animation frame.
[0059] In a possible implementation, the animation transition module is further configured to perform the following operations:
[0060] If the target transition animation corresponding to the target state transition condition is not obtained, then obtain P first animation frames in the main animation of the first object state and Q second animation frames in the main animation of the second object state; P and Q are both positive integers;
[0061] Similar posture matching is performed on P first animation frames and Q second animation frames to obtain an animation frame group with the highest posture similarity, and a target transition animation is generated based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity.
[0062] In one possible implementation, when the animation transition module is configured to generate a target transition animation based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity, the module is specifically configured to perform the following operations:
[0063] generating a first transition animation based on the main animation of the first object state and the first animation frame in the animation frame group with the highest posture similarity; a start frame of the first transition animation is the same as the start frame of the main animation of the first object state, and an end frame of the first transition animation is the first animation frame in the animation frame group with the highest posture similarity;
[0064] generating a second transition animation based on the main animation of the second object state and the second animation frame in the animation frame group with the highest posture similarity; the end frame of the second transition animation is the same as the end frame of the main animation of the second object state, and the start frame of the second transition animation is the second animation frame in the animation frame group with the highest posture similarity;
[0065] Concatenate the first transition animation and the second transition animation into the target transition animation.
[0066] In a possible implementation, the animation transition module is further configured to perform the following operations:
[0067] If the target transition animation corresponding to the target state transition condition is not obtained, then determine the transition state between the first object state and the second object state among the M object states in the animation asset configuration diagram; the transition state refers to an object state that has state transition conditions with both the first object state and the second object state, and the state transition condition between the first object state and the transition state has a first transition animation, and the state transition condition between the second object state and the transition state has a second transition animation;
[0068] The first transition animation, the main animation of the transition state, and the second transition animation are spliced into the target transition animation.
[0069] In one possible implementation, the animation asset configuration diagram includes M coordinate vertices, which are used to indicate different object states of the virtual object; N state transition markings are included between the M coordinate vertices, which are used to indicate state transition conditions for transitioning between different object states.
[0070] An embodiment of the present application provides a computer device, including: a processor, a memory, and a network interface;
[0071] The processor is connected to the memory and the network interface, wherein the network interface is used to provide data communication functions, and the memory is used to store computer programs. When the computer program is executed by the processor, the computer device executes the method provided in the embodiment of the present application.
[0072] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method provided by the embodiment of the present application.
[0073] In one aspect, an embodiment of the present application provides a computer program product, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in the embodiment of the present application.
[0074] The embodiment of the present application analyzes the M object states and N state transition conditions of the virtual object through an animation asset configuration diagram, configures a main animation in each object state, and uses each state transition condition to characterize the state transition between different object states, thereby simplifying the state machine setting of the virtual object, making the relationship between different object states of the virtual object more direct, and avoiding the complex maintenance costs caused by setting the full link relationship between the object states and their transition states. The M object states include a first object state and a second object state, and the N state transition conditions include a target state transition condition for converting from the first object state to the second object state. By obtaining the operation mapping data corresponding to the virtual object, when the operation mapping data of the virtual object meets the target state transition condition, the virtual object is converted from the first object state to the second object state, and the animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state is determined as the target animation frame. If the target transition animation corresponding to the target state conversion condition is obtained, similar posture matching is performed on the target animation frame and the target transition animation to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played. It can be seen that the present application can avoid drawing numerous transition animations for different animation frames of the first object state, reduce animation costs, and avoid setting numerous transition states. By performing similar posture matching with the target animation frame in the transition animation and playing the target transition animation from the target transition animation frame with the highest posture similarity, a smooth transition between the main animation of the first object state and the main animation of the second object state can be achieved, thereby improving the animation quality when the virtual object moves. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0076] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;
[0077] Figure 2 This is a data processing scenario provided by the embodiment of the present application. Figure 1 ;
[0078] Figure 3 This is a data processing scenario provided by the embodiment of the present application. Figure 2 ;
[0079] Figure 4 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 1 ;
[0080] Figure 5 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 2 ;
[0081] Figure 6 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 3 ;
[0082] Figure 7 is a structural diagram of a data processing device provided in an embodiment of the present application;
[0083] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0085] See Figure 1 , Figure 1 This is a network architecture diagram provided by an embodiment of the present application. Figure 1 As shown, the network architecture may include a business server 100 and a terminal device cluster, and the terminal device cluster may include terminal device 10a, terminal device 10b, ..., terminal device 10n, wherein any terminal device in the terminal device cluster may have a communication connection with the business server 100, for example, there is a communication connection between terminal device 10a and the business server 100, and there is a communication connection between terminal device 10b and the business server 100, wherein the above-mentioned communication connection does not limit the connection method, and may be directly or indirectly connected through wired communication, or directly or indirectly connected through wireless communication, or through other methods, and this application does not impose any restrictions here.
[0086] It should be understood that Figure 1 Each terminal device in the terminal cluster shown can be installed with an application client. When the application client runs in each terminal device, it can be respectively connected to the above Figure 1The business servers 100 shown in the figure interact with each other so that the business server 100 can receive business data from each terminal device. Among them, the application client can be a game application, video editing application, social application, instant messaging application, live broadcast application, short video application, video application, music application, shopping application, novel application, payment application, browser, etc., which has image, video and other data information functions. Among them, the application client can be an independent client or an embedded sub-client integrated in a client (such as an instant messaging client, a social client, a video client, etc.), which is not limited here.
[0087] like Figure 1 As shown, the business server 100 can load the animation asset configuration diagram of the virtual object, and configure the main animation corresponding to the object state, the state transition conditions between different object states, and the transition animation corresponding to the state transition conditions in the animation asset configuration diagram.
[0088] Among them, the animation asset configuration diagram can be a configuration diagram of the object state, state transition conditions, main animation and transition animation of the virtual object. The animation asset configuration diagram includes M coordinate vertices, and the M coordinate vertices can be used to indicate different object states of the virtual object, and each object state is configured with a main animation. There are N state transition markings between the M coordinate vertices, and the N state transition markings are used to indicate the state transition conditions for transitioning between different object states, and each state transition condition is used to characterize the state transition between different object states. When the application client is a game application, the virtual object can be a game character that can be controlled by the user. When the application client is a video application, the virtual object can be an animated object that can be edited by the user. The object state can be the motion state of the virtual object, such as standing, walking, running, etc. The state transition condition can be a requirement that the operation mapping data of the virtual object meets a certain numerical range.
[0089] Users can control virtual objects through an application client in a terminal device cluster (which may include terminal device 10a, terminal device 10b, ..., terminal device 10n). For ease of understanding, taking the case where M object states include a first object state and a second object state (the first object state is different from the second object state), and N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state, and terminal device 10a runs the application client as an example, the terminal device 10a can send the operation input data entered by the user when controlling the virtual object in the application client to the business server 100.
[0090] The business server 100 can map the operation input data into operation mapping data that conforms to the animation asset configuration diagram of the virtual object. The operation input data can be a joystick value, a keyboard key value, a sensor sensing value, etc. The business server 100 can perform a certain conversion on the numerical value of the operation input data, for example, converting the operation input data into coordinate values in the coordinate system corresponding to the animation asset configuration diagram. The coordinate values in the coordinate system corresponding to the animation asset configuration diagram can be used to indicate the speed parameters and angle parameters of the virtual object, thereby ensuring the correctness of the business logic. The operation mapping data can include speed parameters and angle parameters, and each state transition condition can include a certain speed threshold range and a certain angle threshold range.
[0091] When the operation mapping data of the virtual object satisfies a target state transition condition, the service server 100 may transition the virtual object from a first object state to a second object state and obtain a target animation frame of the virtual object in the first object state. The target state transition condition may be satisfied when a speed parameter of the virtual object is within a speed threshold range and an angle parameter of the virtual object is within an angle threshold range.
[0092] The target animation frame is an animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state.
[0093] The service server 100 can obtain the target transition animation corresponding to the target state transition condition, perform pose matching between the target animation frame and the target transition animation, and obtain the target transition animation frame with the highest pose similarity to the target animation frame in the target transition animation. The service server 100 can send the target transition animation frame to the terminal device 10a, which can start playing the target transition animation from the target transition animation frame. When the target transition animation ends, the main animation of the second object state is played.
[0094] The embodiment of the present application analyzes the M object states and N state transition conditions of the virtual object through an animation asset configuration diagram, configures a main animation in each object state, and uses each state transition condition to characterize the state transition between different object states, thereby simplifying the state machine setting of the virtual object, making the relationship between different object states of the virtual object more direct, and avoiding the complex maintenance costs caused by setting the full link relationship between the object states and their transition states. The M object states include a first object state and a second object state, and the N state transition conditions include a target state transition condition for converting from the first object state to the second object state. By obtaining the operation mapping data corresponding to the virtual object, when the operation mapping data of the virtual object meets the target state transition condition, the virtual object is converted from the first object state to the second object state, and the animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state is determined as the target animation frame. If the target transition animation corresponding to the target state conversion condition is obtained, similar posture matching is performed on the target animation frame and the target transition animation to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played. It can be seen that the present application can avoid drawing numerous transition animations for different animation frames of the first object state, reduce animation costs, and avoid setting numerous transition states. By performing similar posture matching with the target animation frame in the transition animation and playing the target transition animation from the target transition animation frame with the highest posture similarity, a smooth transition between the main animation of the first object state and the main animation of the second object state can be achieved, thereby improving the animation quality when the virtual object moves.
[0095] See Figure 2 , Figure 2 This is a data processing scenario provided by the embodiment of the present application. Figure 1 .like Figure 2As shown, the business server 100 can load an animation asset configuration diagram of a virtual object. The animation asset configuration diagram includes M coordinate vertices, which can be used to indicate different object states of the virtual object. Each coordinate vertex has a unique coordinate value. Taking the animation asset configuration diagram as a rectangular coordinate system as an example, the horizontal axis of the coordinate system can indicate the speed parameter of the virtual object, and the vertical axis can be used to indicate the angle parameter of the virtual object. Each coordinate vertex can be configured with a main animation under the semantics of the object state. N state transition markings are included between the M coordinate vertices. The N state transition markings are used to indicate the state transition conditions for transitioning between different object states. Each state transition condition is used to characterize the state transition between different object states. The state transition condition can require that the operation mapping data of the virtual object meet a certain numerical range. Each state transition condition can include a certain speed threshold range and a certain angle threshold range. The horizontal coordinate of each coordinate vertex can be the maximum value of the speed threshold range when the speed parameter of the virtual object reaches the object state and meets the state transition condition, that is, the maximum speed that the virtual object can achieve when it is stable in the object state. The vertical coordinate of each coordinate vertex can be the maximum value of the angle threshold range required to reach the state where the virtual object's angle parameter satisfies the state transition condition, i.e., the maximum angle the virtual object can achieve while remaining stable in that state. Therefore, a computer device can determine the current state of a virtual object based on its coordinate values.
[0096] When the application client is a game application, the virtual object may be a game character controllable by the user; when the application client is a video application, the virtual object may be an animated object editable by the user.
[0097] Taking the animation asset configuration diagram as the targeted movement of the virtual object in the plane (the direction of the virtual object is always consistent with the plane projection direction of the camera), M is 12 as an example, the M object states may include state RL (Run Left), state RF (Run Forward), state RR (Run Right), state WL (WalkLeft), state WF (Walk Forward), state WR (Walk Right), state TL (Turn Left), state I (Idle), state TR (Turn Right), state WBL (Walk Back Left), state WB (Walk Back), and state WBR (WalkBack Right).
[0098] The business server 100 can configure the main animation corresponding to the object state in the animation asset configuration diagram. Each object state is configured with a main animation, for example, state RL is configured with main animation 1, state RF is configured with main animation 2, state RR is configured with main animation 3, state WF is configured with main animation 4, state I is configured with main animation 5, state WR is configured with main animation 6, etc. The main animation can be a loop animation (Loop Animation), which is not limited in this embodiment of the present application.
[0099] The business server 100 can configure state transition conditions between different object states in the animated asset configuration diagram. The animated asset configuration diagram includes N state transition lines between M coordinate vertices. These N state transition lines are used to indicate the state transition conditions for transitioning between different object states. Each state transition condition is used to represent a state transition between different object states. Each state transition line represents a transition from one object state to another, indicating a transition from the arrow's starting state to the arrow's pointed state. Each state transition line can be configured with a transition animation between the arrow's starting state and the arrow's pointed state.
[0100] For example, condition 1 is used to represent the transition from state RF to state RL, condition 2 is used to represent the transition from state RR to state RF, condition 3 is used to represent the transition from state RR to state WF, condition 4 is used to represent the transition from state RR to state I, and condition 5 is used to represent the transition from state RR to state WR. The business server 100 can configure a corresponding transition animation for each state transition condition. For example, transition animation 1 can be configured for condition 1, transition animation 2 can be configured for condition 2, transition animation 3 can be configured for condition 3, transition animation 4 can be configured for condition 4, transition animation 5 can be configured for condition 5, etc. The configuration method can name the animation data name. The embodiment of the present application can also not configure a transition animation for each state transition condition, and this is not limited here.
[0101] Users can control virtual objects through the application client in a terminal device cluster (which may include terminal device 10a, terminal device 10b, ..., terminal device 10n). For ease of understanding, taking the M object states including the first object state and the second object state (the first object state may be state RR, and the second object state may be state I), and the terminal device 10a running the application client as an example, the user can control the virtual object in state RR in the application client and input operation input data, and the terminal device 10a can send the operation input data to the business server 100.
[0102] The business server 100 can map the operation input data into operation mapping data that conforms to the animated asset configuration diagram of the virtual object. The operation input data can be joystick values, keyboard key values, sensor sensing values, etc. The business server 100 can perform certain conversions on the numerical values of the operation input data, for example, converting the operation input data into coordinate values in the coordinate system corresponding to the animated asset configuration diagram, thereby ensuring the correctness of the business logic. The operation mapping data can include speed parameters and angle parameters, and each state transition condition can include a certain speed threshold range and a certain angle threshold range. The business server 100 can determine that the virtual object is in state RR (i.e., the first object state) and obtain S state transition conditions associated with the first object state from the animated asset configuration diagram. The S state transition conditions may include condition 2, condition 3, condition 4, condition 5, etc. The business server 100 can compare the operation mapping data with conditions 2, condition 3, condition 4, and condition 5 respectively. When the operation mapping data meets a state transition condition, such as condition 4, the virtual object can be transitioned from state RR to state I. Meeting a certain state transition condition may be that a speed parameter of the virtual object is within a speed threshold range of the state transition condition, and an angle parameter of the virtual object is within an angle threshold range of the state transition condition.
[0103] Please also refer to Figure 3 , Figure 3 This is a data processing scenario provided by the embodiment of the present application. Figure 2 .like Figure 3 As shown, the main animation 3 corresponding to state RR can be called the first main animation, which can include first animation frame 1, first animation frame 2, first animation frame 3, ..., first animation frame P. The main animation 5 corresponding to state I can be called the second main animation, which can include second animation frame 1, second animation frame 2, second animation frame 3, ..., second animation frame Q. The transition animation 4 corresponding to condition 4 can be called the target transition animation, which can include transition animation frame 1, transition animation frame 2, transition animation frame 3, ..., transition animation frame T.
[0104] The business server 100 can obtain the target animation frame of the virtual object in state RR. The target animation frame is the animation frame in which the virtual object is located in the first main animation when the user inputs the operation input data. Take the target animation frame as the first animation frame 3 as an example. The business server 100 can match the target animation frame with each transition animation frame in the target transition animation for similar postures, and then match the transition animation frame 2 in the target transition animation with the highest posture similarity to the target animation frame. The business server 100 can determine the transition animation frame 2 as the target transition animation frame. The business server 100 can send the target transition animation frame to the terminal device 10a. The terminal device 10a can play the target transition animation from the target transition animation frame until it plays to the transition animation frame T. The terminal device 10a can continue to play the second main animation from the second animation frame 1.
[0105] It can be understood that the animation asset configuration diagram and the transition scheme of similar posture matching proposed in the embodiment of the present application can be applied to various types of animation fields, including but not limited to game development, virtual reality, animation production, interface design, etc. The animation asset configuration diagram and the transition scheme of similar posture matching can be used for the motion state conversion of game characters (virtual objects) to achieve a more vivid and natural motion effect. For example, when a character changes from a walking state to a running state, animation transition technology can be used to achieve a smooth transition. This solution can also be used for the movement of objects and characters in a virtual reality scene to enhance the realism and immersion of the scene. This solution can also be used when making movies or TV animations, and animation transition technology can be used to achieve smooth switching between different shots. This solution can also be used when designing mobile applications, and animation transition technology can be used to achieve smooth switching between different pages to improve the interactivity of the interface and user experience.
[0106] The embodiment of the present application analyzes the M object states and N state transition conditions of the virtual object through an animation asset configuration diagram, configures a main animation in each object state, and uses each state transition condition to characterize the state transition between different object states, thereby simplifying the state machine setting of the virtual object, making the relationship between different object states of the virtual object more direct, and avoiding the complex maintenance costs caused by setting the full link relationship between the object states and their transition states. The M object states include a first object state and a second object state, and the N state transition conditions include a target state transition condition for converting from the first object state to the second object state. By obtaining the operation mapping data corresponding to the virtual object, when the operation mapping data of the virtual object meets the target state transition condition, the virtual object is converted from the first object state to the second object state, and the animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state is determined as the target animation frame. If the target transition animation corresponding to the target state conversion condition is obtained, similar posture matching is performed on the target animation frame and the target transition animation to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played. It can be seen that the present application can avoid drawing numerous transition animations for different animation frames of the first object state, reduce animation costs, and avoid setting numerous transition states. By performing similar posture matching with the target animation frame in the transition animation and playing the target transition animation from the target transition animation frame with the highest posture similarity, a smooth transition between the main animation of the first object state and the main animation of the second object state can be achieved, thereby improving the animation quality when the virtual object moves.
[0107] See Figure 4 , Figure 4 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 1 The data processing method can be executed by a computer device, which can be Figure 1 The business server 100 shown in FIG. 1 is a diagram illustrating a data processing method executed by a computer device. The data processing method may include at least the following steps S101 to S103:
[0108] Step S101: Obtain an animation asset configuration diagram for a virtual object; the animation asset configuration diagram is used to indicate M object states and N state transition conditions of the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent a state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state;
[0109] Specifically, the computer device can obtain an animation asset configuration diagram for the virtual object, load the animation asset configuration diagram of the virtual object, and configure the main animation corresponding to the object state, the state transition conditions between different object states, and the transition animation corresponding to the state transition conditions in the animation asset configuration diagram.
[0110] The animation asset configuration diagram can be a configuration diagram for the virtual object's object state, state transition conditions, main animation, and transition animation. The animation asset configuration diagram includes M coordinate vertices, which can be used to indicate different object states of the virtual object. Each coordinate vertex has a unique coordinate value. For example, taking the animation asset configuration diagram as a rectangular coordinate system, the horizontal axis of the coordinate system can indicate the virtual object's speed parameter, and the vertical axis can be used to indicate the virtual object's angle parameter. Each coordinate vertex can be used to configure the main animation under the semantics of the object state.
[0111] N state transition lines are located between the M coordinate vertices. These N state transition lines are used to indicate the state transition conditions for transitioning between different object states. Each state transition condition is used to characterize the state transition between different object states. The state transition condition may require that the operation mapping data of the virtual object meet a certain numerical range. Each state transition condition may include a certain speed threshold range and a certain angle threshold range. The horizontal coordinate of each coordinate vertex may be the maximum value of the speed threshold range when the virtual object's speed parameter reaches the object state, i.e., the maximum speed the virtual object can achieve when it stabilizes in that object state. The vertical coordinate of each coordinate vertex may be the maximum value of the angle threshold range when the virtual object's angle parameter reaches the object state, i.e., the maximum angle the virtual object can achieve when it stabilizes in that object state. Each state transition line represents a transition from that object state to another state, representing a transition from the arrow starting state to the arrow pointing state. Each state transition line can be configured with a transition animation between the arrow starting state and the arrow pointing state. Therefore, a computer device can determine the current state of a virtual object based on the coordinate value of the virtual object.
[0112] When the application client is a game application, the virtual object can be a user-controllable game character. When the application client is a video application, the virtual object can be a user-editable animated object. The state transition condition can require that the operation mapping data of the virtual object meet a certain numerical range. The object state can be the movement state of the virtual object, such as standing, walking, running, etc.
[0113] Step S102: Acquire operation mapping data corresponding to the virtual object. When the operation mapping data of the virtual object satisfies a target state transition condition, transition the virtual object from a first object state to a second object state, and acquire a target animation frame of the virtual object in the first object state; the target animation frame is an animation frame within the main animation of the virtual object in the first object state when the virtual object transitions from the first object state to the second object state.
[0114] Specifically, for ease of understanding, take as an example a case where M object states include a first object state and a second object state, the first object state is different from the second object state, and N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state.
[0115] The computer device can obtain operation mapping data corresponding to the virtual object. The operation mapping data can be data that conforms to the animation asset configuration diagram of the virtual object. Operation input data can include joystick values, keyboard key values, sensor sensing values, etc. The computer device can perform certain numerical conversions on the operation input data, for example, converting the operation input data into coordinate values in the coordinate system corresponding to the animation asset configuration diagram. The coordinate values in the coordinate system corresponding to the animation asset configuration diagram can be used to indicate speed parameters and angle parameters, thereby ensuring the correctness of the business logic.
[0116] When obtaining the operation mapping data of the virtual object, the virtual object can be in a first object state. The animation asset configuration diagram can include a state machine of the virtual object. The state machine can maintain the current state of the virtual object. Therefore, after receiving the operation input data input by the virtual object, the computer device can use the state machine to find the current state of the virtual object. The current state of the virtual object can be the first object state. When the object state of the virtual object switches, the state machine will also synchronously switch the current state. For example, after the virtual object switches from the first object state to the second object state, the current state in the state machine is the second object state, which is convenient for subsequent state queries.
[0117] The operation mapping data may include a speed parameter and an angle parameter, and each state transition condition may include a certain speed threshold range and a certain angle threshold range. The computer device may judge the operation mapping data of the virtual object and the N state transition conditions. If the speed parameter of the operation mapping data is within the speed threshold range of the target state transition condition, and the angle parameter is within the angle threshold range of the target state transition condition, then it can be determined that the operation mapping data of the virtual object meets the target state transition condition. The computer device may transition the virtual object from a first object state to a second object state, and obtain a target animation frame of the virtual object in the first object state. The target animation frame is the animation frame of the virtual object in the main animation of the first object state when the virtual object transitions from the first object state to the second object state, that is, the animation frame of the virtual object in the main animation of the first object state when the operation mapping data of the virtual object is obtained.
[0118] Step S103: If the target transition animation corresponding to the target state transition condition is obtained, the target animation frame and the target transition animation are matched with similar postures to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played starting from the target transition animation frame. When the target transition animation is finished playing, the main animation of the second object state is played.
[0119] Specifically, if the target transition animation corresponding to the target state transition condition is obtained, the computer device can match the target animation frame with the target transition animation for similar postures. The target transition animation may include T transition animation frames. The computer device may determine the transition animation frame in the target transition animation that has the highest posture similarity with the target animation frame as the target transition animation frame. The computer device can start playing the target transition animation from the target transition animation frame, and when the target transition animation ends, play the main animation of the second object state. For example, if the target transition animation frame is the 10th frame in the target transition animation, the computer device can start playing the target transition animation from the 10th frame until the end frame of the target transition animation, and then play the complete main animation of the second object state.
[0120] The embodiment of the present application analyzes the M object states and N state transition conditions of the virtual object through an animation asset configuration diagram, configures a main animation in each object state, and uses each state transition condition to characterize the state transition between different object states, thereby simplifying the state machine setting of the virtual object, making the relationship between different object states of the virtual object more direct, and avoiding the complex maintenance costs caused by setting the full link relationship between the object states and their transition states. The M object states include a first object state and a second object state, and the N state transition conditions include a target state transition condition for converting from the first object state to the second object state. By obtaining the operation mapping data corresponding to the virtual object, when the operation mapping data of the virtual object meets the target state transition condition, the virtual object is converted from the first object state to the second object state, and the animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state is determined as the target animation frame. If the target transition animation corresponding to the target state conversion condition is obtained, similar posture matching is performed on the target animation frame and the target transition animation to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played. It can be seen that the present application can avoid drawing numerous transition animations for different animation frames of the first object state, reduce animation costs, and avoid setting numerous transition states. By performing similar posture matching with the target animation frame in the transition animation and playing the target transition animation from the target transition animation frame with the highest posture similarity, a smooth transition between the main animation of the first object state and the main animation of the second object state can be achieved, thereby improving the animation quality when the virtual object moves.
[0121] See Figure 5 , Figure 5 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 2 The data processing method can be executed by a computer device, which can be Figure 1 The business server 100 shown in FIG. 1 is shown. The following description will be made by taking the data processing method executed by a computer device as an example. The data processing method may include at least the following steps S201 to S208:
[0122] Step S201: Obtain an animation asset configuration diagram for a virtual object; the animation asset configuration diagram is used to indicate M object states and N state transition conditions of the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent a state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state;
[0123] For details, please refer to the above Figure 4 The specific description of step S101 of the corresponding embodiment will not be repeated here in this embodiment of the present application.
[0124] Step S202: Acquire historical operation data of the virtual object, and determine that the virtual object is in a first object state based on the historical operation data; obtain S state transition conditions associated with the first object state in the animation asset configuration diagram; the S state transition conditions include a target state transition condition, and the target state transition condition corresponds to a speed threshold range and an angle threshold range; S is a positive integer; if the speed parameter of the virtual object is within the speed threshold range, and the angle parameter of the virtual object is within the angle threshold range, then determine that the operation mapping data of the virtual object meets the target state transition condition.
[0125] Specifically, for ease of understanding, take as an example a case where M object states include a first object state and a second object state, the first object state is different from the second object state, and N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state.
[0126] The computer device can obtain the historical operation data of the virtual object. The historical operation data may include historical speed parameters and historical angle parameters. The historical speed parameters and historical angle parameters may be coordinate points on the animation asset configuration diagram. When the horizontal coordinate and vertical coordinate of the coordinate point both meet a certain coordinate vertex, the computer device can determine that the virtual object is in the object state of the coordinate vertex. The computer device can determine the object state of the virtual object when the user inputs the operation input data based on the historical operation data, that is, the first object state. The computer device can obtain S state transition conditions associated with the first object state. Please also refer to Figure 2 , Figure 2 This is a data processing scenario provided by the embodiment of the present application. Figure 1 .like Figure 2As shown, taking the animation asset configuration diagram as the targeted movement of the virtual object in the plane (the movement of the virtual object always facing forward), M is 12 as an example, and the M object states may include state RL, state RF, state RR, state WL, state WF, state WR, state TL, state I, state TR, state, state WB and state WBR. Each object state is configured with a main animation, for example, state RL is configured with main animation 1, state RF is configured with main animation 2, state RR is configured with main animation 3, state WF is configured with main animation 4, state I is configured with main animation 5, state WR is configured with main animation 6, etc. Among them, the main animation can be a looping animation, and the embodiment of the present application is not limited here. Each state transition condition is used to characterize the state transition between different object states. For example, condition 1 is used to characterize the transition from state RF to state RL, condition 2 is used to characterize the transition from state RR to state RF, condition 3 is used to characterize the transition from state RR to state WF, condition 4 is used to characterize the transition from state RR to state I, and condition 5 is used to characterize the transition from state RR to state WR.
[0127] The first object state may be state RR, and the S state transition conditions associated with state RR may include condition 2, condition 3, condition 4, condition 5, and the like. The computer device may obtain the operation input data input by the user when controlling the virtual object. The operation input data may be a joystick value, a keyboard key value, a sensor sensing value, and the like. The computer device may map the operation input data to operation mapping data that conforms to the animation asset configuration diagram of the virtual object. The operation input data may be subjected to a certain conversion, such as converting the operation input data into a coordinate value in the coordinate system corresponding to the animation asset configuration diagram, thereby ensuring the correctness of the business logic. When the coordinate value of the operation mapping data is located at the coordinate point corresponding to the object state in the animation asset configuration diagram, it can be determined which object state the operation mapping data is used to switch to. The coordinate system corresponding to the animation asset configuration diagram may be a rectangular coordinate system or a polar coordinate system, and there may be no fixed numerical relationship between the coordinate points. This is not limited in the embodiments of the present application. Taking the animation asset configuration diagram as a rectangular coordinate system as an example, the horizontal axis of the coordinate system can indicate the speed parameter of the virtual object, and the vertical axis can indicate the angle parameter of the virtual object. Each coordinate vertex can be configured with the main animation under the semantics of the object state. N state transition lines are included between the M coordinate vertices. The N state transition lines are used to indicate the state transition conditions for transitioning between different object states. Each state transition condition is used to characterize the state transition between different object states. The state transition condition may require the operation mapping data of the virtual object to meet a certain numerical range. Each state transition condition may include a certain speed threshold range and a certain angle threshold range. The horizontal coordinate of each coordinate vertex can be the maximum value of the speed threshold range when the virtual object's speed parameter reaches the object state and meets the state transition condition, that is, the maximum speed that the virtual object can achieve when it stabilizes in the object state. The vertical coordinate of each coordinate vertex can be the maximum value of the angle threshold range when the virtual object's angle parameter reaches the object state and meets the state transition condition, that is, the maximum angle that the virtual object can achieve when it stabilizes in the object state. Therefore, a computer device can determine the current state of a virtual object based on the coordinate value of the virtual object.
[0128] The computer device may obtain operation mapping data of the virtual object. The operation mapping data may include a speed parameter and an angle parameter. Each state transition condition may include a certain speed threshold range and a certain angle threshold range. When the operation mapping data satisfies a certain state transition condition, for example, when condition 4 (also referred to as a target state transition condition) is satisfied, the speed parameter of the virtual object is within the speed threshold range of condition 4, and the angle parameter of the virtual object is within the angle threshold range of condition 4, then it is determined that the operation mapping data of the virtual object satisfies condition 4. The current state in the state machine is switched from the first object state to the second object state.
[0129] Optionally, if the speed parameter of the virtual object is not within the speed threshold range, or the angle parameter of the virtual object is not within the angle threshold range, it is determined that the operation mapping data of the virtual object does not meet the target state transition condition; if the S state transition conditions associated with the operation mapping data and the first object state are all not met, it is determined that the object state of the virtual object has not changed, and the current state in the state machine is maintained as the first object state. When the main animation of the first object state ends, the main animation of the first object state continues to be played.
[0130] If the operation mapping data is the same as the historical operation data, the operation mapping data input by the user is unchanged from the historical operation data, and the user controls the virtual object to remain in the first object state. When the main animation of the first object state ends, the main animation of the first object state continues to play.
[0131] It can be understood that the embodiments of the present application can express the operation mapping data of the virtual object and the state machine of the virtual object as an animated asset configuration diagram, which clearly simplifies the state machine setting of the virtual object, makes the relationship between different object states of the virtual object more direct, and avoids the complex maintenance costs caused by setting the full link relationship between object states and their transition states.
[0132] Step S203: Acquire operation mapping data corresponding to the virtual object. When the operation mapping data of the virtual object satisfies a target state transition condition, transition the virtual object from a first object state to a second object state, and acquire a target animation frame of the virtual object in the first object state; the target animation frame is an animation frame within the main animation of the virtual object in the first object state when the virtual object transitions from the first object state to the second object state.
[0133] For details, please refer to the above Figure 4 The specific description of step S102 of the corresponding embodiment will not be repeated here in this embodiment of the present application.
[0134] Step S204, obtain T transition animation frames in the target transition animation, and the posture feature vectors corresponding to the T transition animation frames respectively, and obtain the target feature vector of the target animation frame; T is a positive integer; similarity calculation is performed on the target feature vector and the T posture feature vectors respectively, to obtain T posture similarities, and the transition animation frame with the highest posture similarity is determined as the target transition animation frame.
[0135] Specifically, the computer device can obtain T transition animation frames in the target transition animation, and please refer to Figure 3 , Figure 3 This is a data processing scenario provided by the embodiment of the present application. Figure 2 .like Figure 3As shown, the target transition animation may include transition animation frame 1, transition animation frame 2, transition animation frame 3, ..., transition animation frame T. The computer device can obtain the posture feature vectors corresponding to the T transition animation frames, and the target feature vector corresponding to the target animation frame. The posture feature vector and the target feature vector can be used to indicate the parameters such as the position, direction and speed of the hands, feet and pelvis of the virtual object. The computer device can calculate the vector distance between the T posture feature vectors and the target feature vector to perform similarity calculation to obtain T posture similarities. The posture similarity can be weightedly calculated for some parameters of the virtual object according to the requirements of animation quality, such as the parameters of the hands and feet. The embodiments of the present application are not limited here. The computer device can determine the transition animation frame with the highest posture similarity as the target transition animation frame.
[0136] It is understood that the embodiments of the present application can also use a posture matching model to identify the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation. The computer device can use the posture matching model to extract the posture position information and posture time information of the T transition animation frames in the target transition animation, and obtain matching feature vectors corresponding to the T transition animation frames. The posture position information may include the position, direction, and speed of the virtual object's hands, feet, and pelvis, etc. The posture time information may include the arrangement position of the current frame in the target transition animation.
[0137] The computer device can extract features of the target animation frame through the posture matching model to obtain a target matching vector, identify T matching feature vectors through the target matching vector, and obtain a matching feature vector with the highest posture similarity. The computer device can determine the transition animation frame corresponding to the matching feature vector with the highest posture similarity as the target transition animation frame.
[0138] Optionally, the computer device can match the posture tags in the transition animation frame with the target animation frame to obtain the target transition animation frame. The process can be: obtain T transition animation frames in the target transition animation, and the posture tags of the T transition animation frames, and obtain the target tag of the target animation frame; T is a positive integer; if there is a posture tag that is the same as the target tag in the T posture tags, then the transition animation frame with the posture tag that is the same as the target tag is determined as the target transition animation frame.
[0139] Specifically, the computer device can obtain the posture labels corresponding to the T transition animation frames in the target transition animation, as well as the target label of the target animation frame. The posture label and the target label can be used to indicate parameters such as the position, orientation and speed of the hands, feet and pelvis of the virtual object. For example, posture label A can be used to indicate that the feet of the virtual object are on the ground, and posture label B can be used to indicate that the left hand of the virtual object is holding a virtual object, etc. The posture labels can be obtained by manual annotation or by classifying the transition animation frames within a certain posture label range through an artificial intelligence model. The embodiment of the present application does not limit this. If there is a posture label that is the same as the target label among the T posture labels, the computer device can determine the transition animation frame with the same posture label as the target label as the target transition animation frame.
[0140] Optionally, if there is no posture tag identical to the target tag among the T posture tags, the computer device may obtain the target number of frames between the target animation frame and the end frame in the main animation of the first object state, such as Figure 3 As shown, the main animation of the first object state can be referred to as the first main animation. The main animation of the first object state can include P first animation frames. The target animation frame can be first animation frame 2. The first animation frames between the target animation frame and the end frame in the main animation of the first object state can include first animation frame 3, ..., first animation frame P. The computer device can obtain a target number of frames between the target animation frame and the end frame in the main animation of the first object state. When the target animation frame is first animation frame 2, the target number of frames can be P-2.
[0141] It can be understood that when designing and drawing the main animation and the target transition animation of the first object state, since the main animation of the first object state is a looping animation, the target transition animation is used to connect the main animation of the first object state to the main animation of the second object state. The end frame of the main animation of the first object state can be the same as or similar to the start frame of the target transition animation. The first animation frame T-1 adjacent to the end frame in the main animation of the first object state can also be the same as or similar to the transition animation frame 2 in the target transition animation, thereby achieving a smooth transition from the main animation of the first object state to the target transition animation. Therefore, the computer device can determine a similar target transition animation frame in the target transition animation through the target frame number, and the number of frames between the start frame and the target transition animation frame in the target transition animation is the target frame number. For example, if the target animation frame is the first animation frame T-2, then the transition animation frame 3 can be determined as the target transition animation frame.
[0142] Step S205: If the target transition animation corresponding to the target state transition condition is not obtained, the inertia trend vector of the target animation frame is obtained, and similar posture matching is performed on the target animation frame and the main animation of the second object state based on the inertia trend vector to obtain the mixed transition animation frame in the main animation of the second object state that has the highest posture similarity with the target animation frame, and the main animation of the second object state is played starting from the mixed transition animation frame.
[0143] Specifically, it can be understood that if the target transition animation is not configured in the target state transition condition for converting from the first object state to the second object state, then in the process of drawing and configuring the main animation of the first object state and the main animation of the second object state, the main animation of the first object state and the main animation of the second object state can be connected, that is, the end frame of the main animation of the first object state can be smoothly transitioned with the start frame of the main animation of the second object state.
[0144] If the target transition animation corresponding to the target state transition condition is not obtained, the computer device can obtain the inertia trend vector of the target animation frame. The inertia trend vector can be calculated by using the motion trend parameters of the animation frames adjacent to the target animation frame in the first object state, such as the swing amplitude of the hands and feet. The computer device can perform similar posture matching between the target animation frame and the main animation of the second object state based on the inertia trend vector, such as Figure 3 As shown, taking the target animation frame as first animation frame 2 as an example, the computer device can calculate the motion trend parameters of the first animation frame based on the associated animation frames, such as first animation frame 1, first animation frame 2, and first animation frame 3, to generate an inertia trend vector. The computer device can also obtain second eigenvectors corresponding to each of the Q second animation frames in the main animation of the second object state. The second eigenvectors can be used to indicate parameters such as the position, orientation, and velocity of the virtual object's hands, feet, and pelvis.
[0145] The computer device can calculate the vector distances between the Q second eigenvectors and the inertia trend vector respectively to perform similarity calculation to obtain Q posture similarities. The computer device can determine the second animation frame with the highest posture similarity as the target transition animation frame. Figure 3As shown, when the target animation frame is the first animation frame 2, the computer device can determine that the second animation frame 2 has the highest posture similarity with the inertial trend vector, and determine the second animation frame 2 as the mixed transition animation frame. The computer device can start playing the main animation of the second object state from the mixed transition animation frame. Or the second animation frame between the mixed transition animation frame and the second animation frame Q in the main animation of the second object state is determined as the target transition animation, and the mixed transition animation frame is determined as the target transition animation frame. The embodiment of the present application does not limit this. The computer device can start playing the target transition animation from the target transition animation frame, and when the target transition animation is finished playing, the main animation of the second object state is played.
[0146] Step S206: If the target transition animation corresponding to the target state transition condition is not obtained, then obtain P first animation frames in the main animation of the first object state and Q second animation frames in the main animation of the second object state; P and Q are both positive integers; perform similar posture matching on the P first animation frames and the Q second animation frames to obtain an animation frame group with the highest posture similarity, and generate the target transition animation based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity.
[0147] Specifically, if the target transition animation corresponding to the target state transition condition is not obtained, the computer device may use P first animation frames in the main animation of the first object state and Q second animation frames in the main animation of the second object state. Figure 3 As shown, the P first animation frames include the first animation frame 1, the first animation frame 2, the first animation frame 3, ..., and the first animation frame P. The Q second animation frames may include the second animation frame 1, the second animation frame 2, the second animation frame 3, ..., and the second animation frame Q.
[0148] The computer device can perform similar posture matching on P first animation frames and Q second animation frames. Taking the P first animation frames including the target first animation frame A as an example, the computer device can calculate the posture similarity between the first animation frame A and the Q second animation frames, and continue to perform similar posture matching on each first animation frame and the Q second animation frames, so as to obtain the posture similarity corresponding to each animation frame group, where each animation frame group includes the first animation frame and the second animation frame. A computer device can generate a target transition animation based on the main animation of the first object state, the main animation of the second object state, and the animation frame group with the highest posture similarity. The process can be: generating the target transition animation based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity. The process can be: generating a first transition animation based on the main animation of the first object state and the first animation frame in the animation frame group with the highest posture similarity; the starting frame of the first transition animation is the same as the starting frame of the main animation of the first object state, and the ending frame of the first transition animation is the first animation frame in the animation frame group with the highest posture similarity; generating a second transition animation based on the main animation of the second object state and the second animation frame in the animation frame group with the highest posture similarity; the ending frame of the second transition animation is the same as the ending frame of the main animation of the second object state, and the starting frame of the second transition animation is the second animation frame in the animation frame group with the highest posture similarity; splicing the first transition animation and the second transition animation into the target transition animation.
[0149] Specifically, such as Figure 3 As shown, the first animation frame in the animation frame group with the highest posture similarity can be the first animation frame 3, and the second animation frame in the animation frame group with the highest posture similarity can be the second animation frame 2. The computer device can determine the first animation frame from the first animation frame 1 to the first animation frame 3 in the main animation of the first object state as the first transition animation, and determine the second animation frame from the second animation frame 2 to the second animation frame Q in the main animation of the second object state as the second transition animation, that is, the starting frame of the first transition animation is the same as the starting frame of the main animation of the first object state, the ending frame of the first transition animation is the first animation frame in the animation frame group with the highest posture similarity, the ending frame of the second transition animation is the same as the ending frame of the main animation of the second object state, and the starting frame of the second transition animation is the second animation frame in the animation frame group with the highest posture similarity.
[0150] Because the first animation frame and the second animation frame in the animation frame group with the highest posture similarity have a high degree of similarity, the first transition animation and the second transition animation can be smoothly transitioned, and the first transition animation and the second transition animation can be spliced into the target transition animation. The computer device can start playing the target transition animation, and when the target transition animation ends, play the main animation of the second object state.
[0151] Step S207: If the target transition animation corresponding to the target state transition condition is not obtained, then determine the transition state between the first object state and the second object state among the M object states in the animation asset configuration diagram; the transition state refers to an object state in which state transition conditions exist with both the first object state and the second object state, and the state transition condition between the first object state and the transition state exists a first transition animation, and the state transition condition between the second object state and the transition state exists a second transition animation; the first transition animation, the main animation of the transition state, and the second transition animation are spliced into the target transition animation.
[0152] Specifically, if the target transition animation corresponding to the target state transition condition is not obtained, the computer device may determine the transition state between the first object state and the second object state in the M object states of the animation asset configuration diagram, wherein the transition state refers to an object state that has state transition conditions with both the first object state and the second object state, and the state transition condition between the first object state and the transition state has a first transition animation, and the state transition condition between the second object state and the transition state has a second transition animation. Figure 2 As shown, the first object state may be state RR, and the second object state may be state WL. Corresponding state transition conditions may be configured between state RR and state WL, but no object transition animation is configured. However, the state transition condition between state RR and state RF is configured with a corresponding transition animation A, and the state transition condition between state RF and state WL is configured with a corresponding transition animation B. Then the computer device may determine state RF as the transition state between the first object state and the second object state. The computer device may splice the first transition animation, the main animation of the transition state, and the second transition animation into a target transition animation. For example, the transition animation A, the main animation corresponding to state RF, and the transition animation B are sequentially spliced into the target transition animation. The computer device starts playing the target transition animation, and when the target transition animation finishes playing, it plays the main animation of the second object state.
[0153] Step S208: If the target transition animation corresponding to the target state transition condition is obtained, the target animation frame and the target transition animation are matched with similar postures to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played.
[0154] For details, please refer to the above Figure 4 The specific description of step S103 of the corresponding embodiment will not be repeated here in this embodiment of the present application.
[0155] It is understood that the animation asset configuration diagram may be provided with a maximum transition duration or a maximum number of transition frames for the transition animation. The target transition animation generated in steps S205 to S207 may be subjected to posture similarity matching to obtain the target transition animation frame. When the duration between the target transition animation frame and the end frame of the target transition animation determined in steps S205 to S207 is greater than the maximum transition duration in the animation asset configuration diagram, the computer device may perform frame extraction processing on the animation frames between the target transition animation frame and the end frame of the target transition animation, that is, perform similar posture matching on the animation frames between the target transition animation frame and the end frame of the target transition animation, and delete any frame in the group of adjacent animation frames with a high posture similarity, thereby satisfying the maximum transition duration requirement for the transition animation in the animation asset configuration diagram. For example, the animation frames between the target transition animation frame and the end frame of the target transition animation include the target transition animation frame, transition animation frame A, transition animation frame B, transition animation frame C, ..., transition animation frame N. The computer device can perform similar posture matching on the above animation frames. If the posture similarity between transition animation frame A and transition animation frame B is high (or greater than a preset threshold), transition animation frame A or transition animation frame B can be deleted.
[0156] If the duration between the target transition animation frame and the end frame of the target transition animation determined in steps S205 to S207 is less than the maximum transition duration in the animation asset configuration diagram, the computer device can perform frame interpolation processing on the animation frames between the target transition animation frame and the end frame of the target transition animation. The computer device can perform similar posture matching in the target transition animation and insert the transition animation frame with higher posture similarity between the target transition animation frame and the end frame of the target transition animation, thereby meeting the maximum transition duration requirement of the transition animation in the animation asset configuration diagram. For example, the animation frames between the target transition animation frame and the end frame of the target transition animation include the target transition animation frame, transition animation frame A, transition animation frame B, transition animation frame C, ..., transition animation frame N. In addition to the target transition animation frame, transition animation frame A, transition animation frame B, transition animation frame C, ..., transition animation frame N, the target transition animation also includes transition animation frame X, transition animation frame Y, ..., transition animation frame X. The computer device can perform similar posture matching on the above-mentioned animation frames. If the posture similarity between transition animation frame B and transition animation frame Y is high (or greater than a preset threshold), the computer device can insert transition animation frame Y between the target transition animation frame and the end frame of the target transition animation. The obtained animation frames include the target transition animation frame, transition animation frame A, transition animation frame B, transition animation frame Y, transition animation frame C,..., transition animation frame N.
[0157] The embodiment of the present application analyzes the M object states and N state transition conditions of the virtual object through an animation asset configuration diagram, configures a main animation in each object state, and uses each state transition condition to characterize the state transition between different object states, thereby simplifying the state machine setting of the virtual object, making the relationship between different object states of the virtual object more direct, and avoiding the complex maintenance costs caused by setting the full link relationship between the object states and their transition states. The M object states include a first object state and a second object state, and the N state transition conditions include a target state transition condition for converting from the first object state to the second object state. By obtaining the operation mapping data corresponding to the virtual object, when the operation mapping data of the virtual object meets the target state transition condition, the virtual object is converted from the first object state to the second object state, and the animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state is determined as the target animation frame. If the target transition animation corresponding to the target state conversion condition is obtained, similar posture matching is performed on the target animation frame and the target transition animation to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played. It can be seen that the present application can avoid drawing numerous transition animations for different animation frames of the first object state, reduce animation costs, and avoid setting numerous transition states. By performing similar posture matching with the target animation frame in the transition animation and playing the target transition animation from the target transition animation frame with the highest posture similarity, a smooth transition between the main animation of the first object state and the main animation of the second object state can be achieved, thereby improving the animation quality when the virtual object moves.
[0158] On the other hand, the embodiment of the present application can continue to use the existing pre-processing workflow, that is, it can use the existing main animation and transition animation to perform similar posture matching, achieving low cost and low threshold, and can be widely used in any project that needs to improve the quality of animation, and can be expanded in the transition animation corresponding to each state transition condition, so that it can be applied to more types of animations and higher animation quality requirements. When the target transition animation corresponding to the target state transition condition is not configured, the embodiment of the present application can also generate the target transition animation in a variety of ways to perform similar posture matching, and achieve a smooth transition between the main animation of the first object state and the main animation of the second object state, thereby improving the feasibility of this solution.
[0159] See Figure 6 , Figure 6 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 3 The data processing method can be executed by a computer device, which can be Figure 6 The business server 100 shown in FIG. 1 is shown. The following description will be made by taking the data processing method executed by a computer device as an example. The data processing method may include at least the following steps S301 to S315:
[0160] Step S301, initialization;
[0161] Step S302, analyzing the animation asset configuration diagram;
[0162] Step S303, constructing a state machine;
[0163] Specifically, the computer device can initialize the configuration application that loads the animation asset configuration diagram. The configuration application can be Unreal Engine, and the initialization can be to configure the main animation corresponding to the object state, the state transition conditions between different object states, and the transition animation corresponding to the state transition conditions in the animation asset configuration diagram. The computer device can analyze the animation asset configuration diagram, determine each coordinate point in the animation asset configuration diagram as the object state of the virtual object, fill in the main animation of the object for each object state, and determine the state transition markings between the coordinate vertices in the animation asset configuration diagram as the state transition conditions between different object states. The computer device saves the posture feature vector of each animation frame in the main animation corresponding to the object state and the transition animation corresponding to the state transition condition, thereby avoiding excessive loading time when matching similar postures.
[0164] The object state may be a motion state of the virtual object, such as standing, walking, running, etc. The posture feature vector may be used to indicate parameters such as the position, orientation, and speed of the hands, feet, and pelvis of the virtual object.
[0165] The computer device can construct a state machine for virtual objects, that is, determine the object state associated with each object state and the state transition condition associated with each object state. The animated asset configuration diagram can include a state machine for virtual objects. The state machine can maintain the current state of the virtual object. Therefore, after receiving the operation input data input by the virtual object, the computer device can use the state machine to search for the current state of the virtual object. The current state of the virtual object can be the first object state. When the object state of the virtual object switches, the state machine will also switch the current state synchronously. For example, after the virtual object switches from the first object state to the second object state, the current state in the state machine is the second object state, facilitating subsequent state queries. The state machine can also determine the object state associated with the current state and the state transition condition associated with the current state. The operation mapping data obtained for the virtual object is then judged. When the operation mapping data meets a state transition condition, the current state can be switched to the object state under the state transition condition.
[0166] The computer device may set the object state at the coordinate origin of the coordinate system corresponding to the animation asset configuration diagram to the default startup state. The object state at the coordinate origin may be an idle standing state. The computer device may refresh the data within each object state (including the associated target animation frame, preceding animation, etc.) to prevent errors caused by old logic.
[0167] Step S304, obtaining an operation input value;
[0168] Step S305, obtaining the operation mapping value;
[0169] Step S306, check whether the operation mapping value has changed;
[0170] Specifically, the computer device can obtain the operation input data entered by the user when controlling the virtual object. The operation input data can be generated by configuring the application simulation during the configuration process. The operation input data can be a joystick value, a keyboard key value, a sensor sensing value, etc. The computer device can map the operation input data to operation mapping data that conforms to the animation asset configuration diagram of the virtual object. It can be a certain conversion of the numerical value of the operation input data, for example, converting the operation input data into a coordinate value in the coordinate system corresponding to the animation asset configuration diagram, thereby ensuring the correctness of the business logic. It can be understood that when the mapped operation mapping data meets the state transition condition of the object state associated with the current state of the state machine, the state machine can convert the current state to a state that meets the state transition condition. The computer device can also obtain the historical operation data of the virtual object and perform conditional judgment on the operation mapping data based on the historical operation data.
[0171] Step S307, continue playing the animation in the current state;
[0172] Step S308, playing to the end of the animation;
[0173] Step S309, playing the loop animation;
[0174] Specifically, the state of the virtual object when the operation mapping data is input may be a first object state, which may be referred to as a current state. The operation mapping data may include a speed parameter and an angle parameter, and each state transition condition may include a certain speed threshold range and a certain angle threshold range. If the operation mapping data is the same as the historical operation data, the operation mapping data input by the user remains unchanged from the historical operation data, and the user controls the virtual object to remain in the first object state, then when the main animation of the first object state ends, the main animation of the first object state continues to play, i.e., the looping animation of the first object state.
[0175] Step S310, obtaining the associated state transition condition;
[0176] Specifically, the computer device may obtain a current state in the virtual object state machine, where the current state may be a first object state, and may obtain S state transition conditions associated with the first object state.
[0177] Step S311: Is there a state transition condition that is met?
[0178] Specifically, if the speed parameter of the virtual object is not within the speed threshold range, or the angle parameter of the virtual object is not within the angle threshold range, it is determined that the operation mapping data of the virtual object does not meet the target state transition condition; if the state transition conditions associated with the operation mapping data and the first object state are not met, it is determined that the object state of the virtual object has not changed, and when the main animation of the first object state ends, the main animation of the first object state continues to be played.
[0179] Step S312, switching state;
[0180] Step S313, adding the transition animation as the front animation of the new state;
[0181] Step S314, obtaining the target transition animation frame with the highest posture similarity;
[0182] Step S315: Start playing the animation from the target transition animation frame.
[0183] Specifically, when the operation mapping data of the virtual object meets the target state transition condition, the computer device can transition the virtual object from a first object state to a second object state, and obtain a target animation frame of the virtual object in the first object state. The target animation frame is the animation frame in the main animation of the virtual object in the first object state when the virtual object transitions from the first object state to the second object state, that is, the animation frame in the main animation of the virtual object in the first object state when the operation mapping data of the virtual object is obtained.
[0184] If the target transition animation corresponding to the target state transition condition is obtained, the computer device can attach the target transition animation as a pre-animation of the new state (second object state). The pre-animation is the animation played before the main animation of the second object state. The pre-animation can also be called a transition animation. The computer device can match the target animation frame with the target transition animation for similar postures. The target transition animation can include T transition animation frames. The computer device can determine the transition animation frame with the highest posture similarity with the target animation frame in the target transition animation as the target transition animation frame. The computer device can start playing the target transition animation from the target transition animation frame, and when the target transition animation finishes playing, play the main animation of the second object state.
[0185] The embodiment of the present application analyzes the M object states and N state transition conditions of the virtual object through an animation asset configuration diagram, configures a main animation in each object state, and uses each state transition condition to characterize the state transition between different object states, thereby simplifying the state machine setting of the virtual object, making the relationship between different object states of the virtual object more direct, and avoiding the complex maintenance costs caused by setting the full link relationship between the object states and their transition states. The M object states include a first object state and a second object state, and the N state transition conditions include a target state transition condition for converting from the first object state to the second object state. By obtaining the operation mapping data corresponding to the virtual object, when the operation mapping data of the virtual object meets the target state transition condition, the virtual object is converted from the first object state to the second object state, and the animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state is determined as the target animation frame. If the target transition animation corresponding to the target state conversion condition is obtained, similar posture matching is performed on the target animation frame and the target transition animation to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played. It can be seen that the present application can avoid drawing numerous transition animations for different animation frames of the first object state, reduce animation costs, and avoid setting numerous transition states. By performing similar posture matching with the target animation frame in the transition animation and playing the target transition animation from the target transition animation frame with the highest posture similarity, a smooth transition between the main animation of the first object state and the main animation of the second object state can be achieved, thereby improving the animation quality when the virtual object moves.
[0186] On the other hand, the embodiment of the present application can continue to use the workflow of the prior art, that is, it can use the main animation and transition animation already available in the prior art to match similar postures, achieving low cost and low threshold, and can be widely used in any project that needs to improve the quality of animation, and can be expanded in the transition animation corresponding to each state transition condition, so that it can be applied to more types of animations and higher animation quality requirements. When the target transition animation corresponding to the target state transition condition is not configured, the embodiment of the present application can also generate the target transition animation in a variety of ways to match similar postures, and achieve a smooth transition between the main animation of the first object state and the main animation of the second object state, thereby improving the feasibility of this solution.
[0187] See Figure 7 , Figure 7 This is a structural diagram of a data processing device provided in an embodiment of the present application. Figure 7As shown, the data processing device 1 includes an asset configuration module 710 , a state conversion module 720 and an animation transition module 730 .
[0188] The asset configuration module 710 is configured to obtain an animated asset configuration diagram for a virtual object; the animated asset configuration diagram is configured to indicate M object states and N state transition conditions for the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent a state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; and the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state.
[0189] The state transition module 720 is configured to obtain operation mapping data corresponding to the virtual object, and when the operation mapping data of the virtual object satisfies a target state transition condition, transition the virtual object from a first object state to a second object state, and obtain a target animation frame of the virtual object in the first object state; the target animation frame is the animation frame of the virtual object in the main animation of the first object state when the virtual object transitions from the first object state to the second object state;
[0190] The animation transition module 730 is used to perform similar posture matching between the target animation frame and the target transition animation if the target transition animation corresponding to the target state transition condition is obtained, and obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and play the target transition animation from the target transition animation frame. When the target transition animation is finished playing, the main animation of the second object state is played.
[0191] In a possible implementation, the operation mapping data includes a speed parameter and an angle parameter; the state conversion module 720 is further configured to perform the following operations:
[0192] Acquiring historical operation data of the virtual object, and determining that the virtual object is in a first object state based on the historical operation data;
[0193] Obtaining S state transition conditions associated with the first object state in the animation asset configuration diagram; the S state transition conditions include a target state transition condition, the target state transition condition corresponding to a speed threshold range and an angle threshold range; S is a positive integer;
[0194] If the speed parameter of the virtual object is within the speed threshold range, and the angle parameter of the virtual object is within the angle threshold range, it is determined that the operation mapping data of the virtual object meets the target state transition condition.
[0195] In a possible implementation, the state transition module 720 is further configured to perform the following operations:
[0196] If the speed parameter of the virtual object is not within the speed threshold range, or the angle parameter of the virtual object is not within the angle threshold range, then when the main animation of the first object state ends, the main animation of the first object state continues to be played.
[0197] In a possible implementation, the state transition module 720 is further configured to perform the following operations:
[0198] The historical operation data of the virtual object is obtained. If the operation mapping data is the same as the historical operation data, the main animation of the first object state continues to be played after the main animation of the first object state ends.
[0199] In one possible implementation, the animation transition module 730 is configured to perform similarity matching between the target animation frame and the target transition animation, and when a target transition animation frame having the highest posture similarity with the target animation frame is obtained, specifically to perform the following operations:
[0200] Obtain T transition animation frames in the target transition animation, and the posture feature vectors corresponding to the T transition animation frames, and obtain the target feature vector of the target animation frame; T is a positive integer;
[0201] The similarity between the target feature vector and the T posture feature vectors is calculated respectively to obtain T posture similarities, and the transition animation frame with the highest posture similarity is determined as the target transition animation frame.
[0202] In one possible implementation, the animation transition module 730 is configured to perform similarity matching between the target animation frame and the target transition animation, and when a target transition animation frame having the highest posture similarity with the target animation frame is obtained, specifically to perform the following operations:
[0203] Get T transition animation frames in the target transition animation, as well as the posture labels of T transition animation frames, and get the target label of the target animation frame; T is a positive integer;
[0204] If there is a posture tag identical to the target tag among the T posture tags, the transition animation frame having the posture tag identical to the target tag is determined as the target transition animation frame.
[0205] In a possible implementation, the animation transition module 730 is further configured to perform the following operations:
[0206] If there is no posture tag that is the same as the target tag among the T posture tags, then the target number of frames between the target animation frame and the end frame in the main animation of the first object state is obtained, and the target transition animation frame is determined in the target transition animation according to the target frame number; the number of frames between the start frame in the target transition animation and the target transition animation frame is the target frame number
[0207] In a possible implementation, the animation transition module 730 is further configured to perform the following operations:
[0208] If the target transition animation corresponding to the target state conversion condition is not obtained, the inertia trend vector of the target animation frame is obtained, and the target animation frame and the main animation of the second object state are matched with each other based on the inertia trend vector. The mixed transition animation frame with the highest posture similarity with the target animation frame in the main animation of the second object state is obtained, and the main animation of the second object state is played starting from the mixed transition animation frame.
[0209] In a possible implementation, the animation transition module 730 is further configured to perform the following operations:
[0210] If the target transition animation corresponding to the target state transition condition is not obtained, then obtain P first animation frames in the main animation of the first object state and Q second animation frames in the main animation of the second object state; P and Q are both positive integers;
[0211] Similar posture matching is performed on P first animation frames and Q second animation frames to obtain an animation frame group with the highest posture similarity, and a target transition animation is generated based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity.
[0212] In one possible implementation, the animation transition module 730 is configured to generate a target transition animation based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity, specifically performing the following operations:
[0213] generating a first transition animation based on the main animation of the first object state and the first animation frame in the animation frame group with the highest posture similarity; a start frame of the first transition animation is the same as the start frame of the main animation of the first object state, and an end frame of the first transition animation is the first animation frame in the animation frame group with the highest posture similarity;
[0214] generating a second transition animation based on the main animation of the second object state and the second animation frame in the animation frame group with the highest posture similarity; the end frame of the second transition animation is the same as the end frame of the main animation of the second object state, and the start frame of the second transition animation is the second animation frame in the animation frame group with the highest posture similarity;
[0215] Concatenate the first transition animation and the second transition animation into the target transition animation.
[0216] In a possible implementation, the animation transition module 730 is further configured to perform the following operations:
[0217] If the target transition animation corresponding to the target state transition condition is not obtained, then determine the transition state between the first object state and the second object state among the M object states in the animation asset configuration diagram; the transition state refers to an object state that has state transition conditions with both the first object state and the second object state, and the state transition condition between the first object state and the transition state has a first transition animation, and the state transition condition between the second object state and the transition state has a second transition animation;
[0218] The first transition animation, the main animation of the transition state, and the second transition animation are spliced into the target transition animation.
[0219] In one possible implementation, the animation asset configuration diagram includes M coordinate vertices, which are used to indicate different object states of the virtual object; N state transition markings are included between the M coordinate vertices, which are used to indicate state transition conditions for transitioning between different object states.
[0220] The embodiment of the present application analyzes the M object states and N state transition conditions of the virtual object through an animation asset configuration diagram, configures a main animation in each object state, and uses each state transition condition to characterize the state transition between different object states, thereby simplifying the state machine setting of the virtual object, making the relationship between different object states of the virtual object more direct, and avoiding the complex maintenance costs caused by setting the full link relationship between the object states and their transition states. The M object states include a first object state and a second object state, and the N state transition conditions include a target state transition condition for converting from the first object state to the second object state. By obtaining the operation mapping data corresponding to the virtual object, when the operation mapping data of the virtual object meets the target state transition condition, the virtual object is converted from the first object state to the second object state, and the animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state is determined as the target animation frame. If the target transition animation corresponding to the target state conversion condition is obtained, similar posture matching is performed on the target animation frame and the target transition animation to obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, and the target transition animation is played from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played. It can be seen that the present application can avoid drawing numerous transition animations for different animation frames of the first object state, reduce animation costs, and avoid setting numerous transition states. By performing similar posture matching with the target animation frame in the transition animation and playing the target transition animation from the target transition animation frame with the highest posture similarity, a smooth transition between the main animation of the first object state and the main animation of the second object state can be achieved, thereby improving the animation quality when the virtual object moves.
[0221] On the other hand, the embodiment of the present application can continue to use the workflow of the prior art, that is, it can use the main animation and transition animation already available in the prior art to match similar postures, achieving low cost and low threshold, and can be widely used in any project that needs to improve the quality of animation, and can be expanded in the transition animation corresponding to each state transition condition, so that it can be applied to more types of animations and higher animation quality requirements. When the target transition animation corresponding to the target state transition condition is not configured, the embodiment of the present application can also generate the target transition animation in a variety of ways to match similar postures, and achieve a smooth transition between the main animation of the first object state and the main animation of the second object state, thereby improving the feasibility of this solution.
[0222] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0223] See Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8 As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 8 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
[0224] In such Figure 8 In the computer device 1000 shown, the network interface 1004 can provide a network communication element; the user interface 1003 is mainly used to provide an interface for user input; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0225] Obtain an animation asset configuration diagram for a virtual object; the animation asset configuration diagram is used to indicate M object states and N state transition conditions of the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent a state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state;
[0226] obtaining operation mapping data corresponding to the virtual object, and when the operation mapping data of the virtual object satisfies a target state transition condition, transitioning the virtual object from a first object state to a second object state, and obtaining a target animation frame of the virtual object in the first object state; the target animation frame being an animation frame within a main animation of the virtual object in the first object state when the virtual object transitions from the first object state to the second object state;
[0227] If the target transition animation corresponding to the target state transition condition is obtained, the target animation frame and the target transition animation are matched for similar postures, and the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation is obtained. The target transition animation is played starting from the target transition animation frame. When the target transition animation ends, the main animation of the second object state is played.
[0228] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 4 、 Figure 5 and Figure 6 The description of the data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here either.
[0229] In addition, it should be noted that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and when the processor executes the computer program, it can execute the above Figure 4 、 Figure 5 and Figure 6 The description of the above-mentioned data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0230] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been displayed or is about to be displayed.
[0231] In addition, it should be noted that the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device performs the above-mentioned Figure 4 、 Figure 5 and Figure 6 The method provided by any corresponding embodiment.
[0232] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0233] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example in terms of network elements. Whether these network elements are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described network elements for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0234] The methods and related devices provided in the embodiments of the present application are described with reference to the method flow charts and / or structural diagrams provided in the embodiments of the present application. Specifically, each process and / or block in the method flow charts and / or structural diagrams, as well as the combination of processes and / or blocks in the flow charts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the steps in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including the instruction device, which implements the function specified in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 The flow or flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0235] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0236] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0237] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, characterized in that: include: Obtaining an animation asset configuration diagram for a virtual object; the animation asset configuration diagram is used to indicate M object states and N state transition conditions of the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent the state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state; obtaining operation mapping data corresponding to the virtual object, and when the operation mapping data of the virtual object satisfies the target state transition condition, transitioning the virtual object from the first object state to the second object state, and obtaining a target animation frame of the virtual object in the first object state; The target animation frame is an animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state; If the target transition animation corresponding to the target state transition condition is obtained, the target animation frame is matched with the target transition animation for similar posture, and the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation is obtained. The target transition animation is played starting from the target transition animation frame. When the target transition animation is finished, the main animation of the second object state is played.
2. The method according to claim 1, characterized in that The operation mapping data includes a speed parameter and an angle parameter; the method further includes: Acquiring historical operation data of the virtual object, and determining that the virtual object is in a first object state based on the historical operation data; Acquire S state transition conditions associated with the first object state in the animation asset configuration diagram; the S state transition conditions include a target state transition condition, the target state transition condition corresponds to a speed threshold range and an angle threshold range; S is a positive integer; If the speed parameter of the virtual object is within the speed threshold range, and the angle parameter of the virtual object is within the angle threshold range, it is determined that the operation mapping data of the virtual object meets the target state transition condition.
3. The method according to claim 2, characterized in that Also includes: If the speed parameter of the virtual object is not within the speed threshold range, or the angle parameter of the virtual object is not within the angle threshold range, the main animation of the first object state continues to be played after the main animation of the first object state ends.
4. The method according to claim 1, wherein Also includes: The historical operation data of the virtual object is obtained. If the operation mapping data is the same as the historical operation data, the main animation of the first object state is continued to be played after the main animation of the first object state is finished.
5. The method according to claim 1, wherein The performing similar posture matching on the target animation frame and the target transition animation to obtain a target transition animation frame having the highest posture similarity with the target animation frame includes: Obtain T transition animation frames in the target transition animation, and posture feature vectors corresponding to the T transition animation frames, and obtain a target feature vector of the target animation frame; T is a positive integer; Similarities are calculated for the target feature vector and T posture feature vectors respectively to obtain T posture similarities, and the transition animation frame with the highest posture similarity is determined as the target transition animation frame.
6. The method according to claim 1, characterized in that The performing similar posture matching on the target animation frame and the target transition animation to obtain a target transition animation frame having the highest posture similarity with the target animation frame includes: Obtain T transition animation frames in the target transition animation, and the posture labels of the T transition animation frames, and obtain the target label of the target animation frame; T is a positive integer; If there is a posture tag identical to the target tag among the T posture tags, the transition animation frame having the posture tag identical to the target tag is determined as the target transition animation frame.
7. The method according to claim 6, characterized in that Also includes: If there is no posture tag identical to the target tag among the T posture tags, then obtain the target number of frames between the target animation frame and the end frame in the main animation of the first object state, and determine the target transition animation frame in the target transition animation based on the target number of frames; the number of frames between the start frame in the target transition animation and the target transition animation frame is the target number of frames.
8. The method according to claim 1, characterized in that Also includes: If the target transition animation corresponding to the target state conversion condition is not obtained, the inertia trend vector of the target animation frame is obtained, and based on the inertia trend vector, similar posture matching is performed on the target animation frame and the main animation of the second object state to obtain the mixed transition animation frame with the highest posture similarity to the target animation frame in the main animation of the second object state, and the main animation of the second object state is played starting from the mixed transition animation frame.
9. The method according to claim 1, characterized in that Also includes: If the target transition animation corresponding to the target state transition condition is not obtained, then obtain P first animation frames in the main animation of the first object state and Q second animation frames in the main animation of the second object state; P and Q are both positive integers; Similar posture matching is performed on the P first animation frames and the Q second animation frames to obtain an animation frame group with the highest posture similarity, and the target transition animation is generated based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity.
10. The method according to claim 9, characterized in that Generating the target transition animation based on the main animation of the first object state, the main animation of the second object state, and the first animation frame and the second animation frame in the animation frame group with the highest posture similarity includes: generating a first transition animation based on the main animation of the first object state and the first animation frame in the animation frame group with the highest posture similarity; a start frame of the first transition animation is the same as the start frame of the main animation of the first object state, and an end frame of the first transition animation is the first animation frame in the animation frame group with the highest posture similarity; generating a second transition animation based on the main animation of the second object state and the second animation frame in the animation frame group with the highest posture similarity; the end frame of the second transition animation is the same as the end frame of the main animation of the second object state, and the start frame of the second transition animation is the second animation frame in the animation frame group with the highest posture similarity; The first transition animation and the second transition animation are spliced into the target transition animation.
11. The method according to claim 1, wherein Also includes: If the target transition animation corresponding to the target state transition condition is not obtained, then determining a transition state between the first object state and the second object state among the M object states in the animation asset configuration diagram; the transition state refers to an object state that has state transition conditions with both the first object state and the second object state, and the state transition condition between the first object state and the transition state has a first transition animation, and the state transition condition between the second object state and the transition state has a second transition animation; The first transition animation, the main animation of the transition state, and the second transition animation are spliced into a target transition animation.
12. The method according to claim 1, characterized in that The animation asset configuration diagram includes M coordinate vertices, and the M coordinate vertices are respectively used to indicate different object states of the virtual object; N state transition marking lines are included between the M coordinate vertices, and the N state transition marking lines are respectively used to indicate state transition conditions for transitioning between different object states.
13. A data processing device, characterized in that: include: An asset configuration module is configured to obtain an animated asset configuration diagram for a virtual object; the animated asset configuration diagram is configured to indicate M object states and N state transition conditions for the virtual object; M and N are both positive integers; each object state is configured with a main animation; each state transition condition is used to represent a state transition between different object states; the M object states include a first object state and a second object state, and the first object state is different from the second object state; and the N state transition conditions include a target state transition condition for transitioning from the first object state to the second object state; a state transition module, configured to obtain operation mapping data corresponding to the virtual object, and when the operation mapping data of the virtual object satisfies the target state transition condition, transition the virtual object from the first object state to the second object state, and obtain a target animation frame of the virtual object in the first object state; The target animation frame is an animation frame of the virtual object in the main animation of the first object state when the virtual object is converted from the first object state to the second object state; An animation transition module is used to perform similar posture matching between the target animation frame and the target transition animation if the target transition animation corresponding to the target state transition condition is obtained, obtain the target transition animation frame with the highest posture similarity with the target animation frame in the target transition animation, play the target transition animation from the target transition animation frame, and when the target transition animation is finished playing, play the main animation of the second object state.
14. A computer device, characterized in that: include: processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 12.
16. A computer program product, characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium and is suitable for being read and executed by a processor, so as to enable a computer device having the processor to perform the method according to any one of claims 1 to 12.