Animation trajectory scaling method and device
By calculating the scaling vector and progress parameters, the animation trajectory is adjusted, and the speed, position and rotation inconsistency caused by the change of distorted points in the existing technology is solved, and the animation trajectory scaling without pre-calculation and pre-store is realized to ensure the consistency of animation and A sense of rhythm.
Patent Information
- Application Number
- CN202011631536.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2040-12-31
AI Technical Summary
In the twisting path of motion, the change of the twist point causes the need to recalculate the animation trajectory, resulting in inconsistent speed, position, and rotation, and pre-calculate the animation trajectory. The resource management is complex and it is impossible to directly animation at runtime. The root motion curve was extracted from the fragment.
By calculating the scaling vector, adjust the animation trajectory based on the scaling vector and the progress parameters of the current frame, obtain the motion parameter information of the target character in the world trajectory, and apply it to the target character to realize the scaling of the animation trajectory, ensuring the consistency of speed, position and rotation. No pre-computing and pre-store animation tracks are required.
It is realized that without precalculating or prestoring the animation trajectory, the speed, position and rotational consistency of the target character's movement is ensured, the player's sense of rhythm requirements for the target character's movement is met, and the original animation trajectory is better maintained.
Smart Images

Figure CN112686974B_ABST
Abstract
Description
Technical Field
[0001] The present specification relates to the field of computer technology, and in particular to an animation trajectory scaling method and apparatus. The present specification also relates to a computing device and a computer-readable storage medium. Background Art
[0002] In its implementation, Motion Path Warping mainly maps the points in the action clip to the points in the game world, such as Figure 1 As shown, when the animated character supports an obstacle with his hands to climb over it, the animation curves before and after the character climbs over it are stretched to adapt to both sides of the obstacle, and the position of the hand slides over the obstacle. The core idea of the method of modifying the motion path in this technology is to edit the motion path.
[0003] There is a problem with pre-calculating the motion path. If the warp point changes during the matching process, the warp path needs to be recalculated. There are two ways to implement this. The simplest way is to calculate the offset obtained by subtracting the actual motion vector from the original motion vector in the animation in the interval between two warp points, and then apply a little offset to each frame, for example, evenly spread it out over time. This implementation is relatively simple, but it cannot guarantee the speed consistency before and after the warp point.
[0004] Figure 2 To add a simple offset effect, the left picture shows the original animation trajectory with 4 distortion points. The right picture shows the trajectory calculated by expanding these 4 distortion points and simply superimposing the difference vectors. The originally coherent trajectory of the two middle distortion points has corners.
[0005] Another method is to generalize the motion curve into a B-spline curve with several control handles. If the root motion point moves up and down when a person walks, it is necessary to abstract the B-spline curve that is intuitively continuous (this is a low-pass filtering process), re-edit this B-spline curve, and then apply the offset of the details back. This method ensures that the originally continuous trajectory remains continuous after distortion. However, if the filtering method is used, the motion trajectory of the animation clip must still be pre-calculated and applied back.
[0006] Figure 3 The following is a diagram showing the relationship between the path and the details in the solution. Figure 3As shown, in this technical solution, the motion path of the entire animation clip needs to be extracted in advance. However, for specific project requirements, it is best not to distinguish between "path" and "details", which saves the steps of pre-calculating paths and details. Because the engine cannot directly extract the root motion curve from an animation clip at runtime, the pre-calculated path also needs to extract the root motion curve in advance. The root motion curve is a resource that exists outside the animation clip. Separating the root motion curve from the animation clip causes certain troubles in resource management. If the animation clip is updated and the root motion curve is not retrieved again, the final effect will be inaccurate.
[0007] Furthermore, it is necessary to solve the problem in the prior art that the animation trajectory needs to be pre-calculated and pre-stored, and the speed, position, and rotation inconsistency of the distortion point movement needs to be solved. Summary of the invention
[0008] In view of this, the embodiment of this specification provides an animation trajectory scaling method. This specification also relates to an animation trajectory scaling device, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.
[0009] According to a first aspect of an embodiment of this specification, there is provided an animation trajectory scaling method, comprising:
[0010] Calculate a scaling vector for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character;
[0011] Adjust the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtain motion parameter information of the target character in the world trajectory target segment;
[0012] The motion parameter information corresponding to the current frame is applied to the target character.
[0013] Optionally, for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character, calculating the scaling vector includes:
[0014] The size of a first bounding box of the animation trajectory target segment and the size of a second bounding box of the world trajectory target segment are determined, and a scaling vector is calculated according to the size of the first bounding box and the size of the second bounding box.
[0015] Optionally, determining the size of the first bounding box of the animation trajectory target segment and the size of the second bounding box of the world trajectory target segment comprises:
[0016] Determining the size of the first bounding box according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory;
[0017] The size of the second bounding box is determined according to the spatial positions of the start matching point and the end matching point of the world trajectory target segment.
[0018] Optionally, determining the size of the first bounding box according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory includes:
[0019] Establishing a first bounding box so that the first bounding box encloses the starting distortion point and the ending distortion point, subtracting the coordinate positions of the starting distortion point and the ending distortion point in each axis direction from each other and taking the absolute value as the size of the first bounding box, and determining the size of the second bounding box according to the spatial positions of the starting matching point and the ending matching point of the world trajectory target segment includes:
[0020] A second bounding box is established so that the second bounding box encloses the starting matching point and the ending matching point, and the coordinate positions of the starting matching point and the ending matching point in each axial direction are subtracted and the absolute value is taken as the size of the second bounding box.
[0021] Optionally, determining the size of the first bounding box of the animation trajectory target segment and the size of the second bounding box of the world trajectory target segment comprises:
[0022] Determine the size of the first bounding box according to the spatial position of the starting distortion point and the ending distortion point of the target segment of the animation trajectory and one or more position points between the starting distortion point and the ending distortion point;
[0023] The size of the second bounding box is determined according to the starting matching point and the ending matching point of the world trajectory target segment and the spatial positions of one or more matching points between the starting matching point and the ending matching point.
[0024] Optionally, determining the size of the first bounding box according to the spatial position of the starting distortion point and the ending distortion point of the target segment of the animation trajectory and one or more position points between the starting distortion point and the ending distortion point includes:
[0025] A first bounding box is established so that the first bounding box encloses the starting distortion point, the ending distortion point and the position point, and the coordinate positions of two vertices of the body diagonal of the bounding box in each axis direction are subtracted and the absolute value is taken as the size of the first bounding box.
[0026] Optionally, determining the size of the second bounding box according to the starting matching point and the ending matching point of the world trajectory target segment and the spatial position of one or more matching points between the starting matching point and the ending matching point includes:
[0027] A second bounding box is established so that the second bounding box encloses the starting matching point, the ending matching point and the one or more matching points, and the coordinate positions of the two vertices of the body diagonal of the second bounding box in each axial direction are subtracted and the absolute value is taken as the size of the bounding box of the world trajectory target segment.
[0028] Optionally, adjusting the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame to obtain the motion parameter information of the target character in the world trajectory target segment includes:
[0029] Obtaining a first position vector and a first world rotation matrix of a starting matching point and a second position vector and a second world rotation matrix of an ending matching point of the world trajectory target segment;
[0030] Obtain a first world transformation matrix of the starting matching point according to the first position vector, the first world rotation matrix and the scaling vector, and obtain a second world transformation matrix of the ending matching point according to the second position vector, the second world rotation matrix and the scaling vector;
[0031] The position vector and rotation parameter value of the current frame are determined according to the first world transformation matrix, the second world transformation matrix, the first animation transformation matrix obtained at the starting distortion point of the target segment of the animation trajectory, the second animation transformation matrix obtained at the ending distortion point of the target segment of the animation trajectory, the current animation transformation matrix at the time point corresponding to the current frame, and the progress parameter corresponding to the current frame, wherein the starting matching point corresponds to the starting distortion point, and the ending matching point corresponds to the ending distortion point.
[0032] Optionally, determining the position vector and rotation parameter value of the current frame according to the first world transformation matrix, the second world transformation matrix, the first animation transformation matrix obtained at the starting distortion point of the target segment of the animation trajectory, the second animation transformation matrix obtained at the ending distortion point of the target segment of the animation trajectory, the current animation transformation matrix at the time point corresponding to the current frame, and the progress parameter corresponding to the current frame includes:
[0033] Obtaining a first target position vector and a first target rotation parameter value according to a current animation transformation matrix at a time point corresponding to a current frame, a first animation transformation matrix obtained at the starting distortion point, and the first world transformation matrix;
[0034] Obtain a second target position vector and a second target rotation parameter value according to the current animation transformation matrix, the second animation transformation matrix obtained from the end distortion point, and the second world transformation matrix;
[0035] The position vector of the current frame is obtained according to the first target position vector, the second target position vector and the progress parameter, and the rotation parameter value of the current frame is obtained according to the first target rotation parameter value, the second target rotation parameter value and the progress parameter.
[0036] Optionally, obtaining the first target position vector and the first target rotation parameter value according to the current animation transformation matrix at the time point corresponding to the current frame, the first animation transformation matrix obtained at the starting distortion point, and the first world transformation matrix comprises:
[0037] Obtaining a first posture matrix according to the current animation transformation matrix, the first animation transformation matrix and the first world transformation matrix;
[0038] According to the first posture matrix, obtaining a first target position vector and a first target rotation parameter value;
[0039] And obtaining a second target position vector and a second target rotation parameter value according to the current animation transformation matrix, the second animation transformation matrix obtained from the end distortion point, and the second world transformation matrix comprises:
[0040] Obtaining a second posture matrix according to the current animation transformation matrix, the second animation transformation matrix and the second world transformation matrix;
[0041] According to the second posture matrix, a second target position vector and a second target rotation parameter value are obtained.
[0042] Optionally, obtaining the position vector of the current frame according to the first target position vector, the second target position vector and the progress parameter includes:
[0043] Interpolation is performed between the first target position vector and the second target position vector according to the progress parameter to obtain a position vector of the current frame.
[0044] Optionally, obtaining the rotation parameter value of the current frame according to the first target rotation parameter value, the second target rotation parameter value and the progress parameter includes:
[0045] Spherical interpolation is performed between the first target rotation parameter value and the second target rotation parameter value according to the progress parameter to obtain a rotation parameter value of the current frame.
[0046] Optionally, after determining the size of the first bounding box of the target segment of the animation trajectory, the method further includes:
[0047] Determine whether the first bounding box just encloses the starting matching point, the ending matching point and the one or more matching points; if not, establish a second bounding box so that the second bounding box encloses the starting matching point, the ending matching point and the one or more matching points.
[0048] Optionally, before determining the position vector and rotation parameter value of the current frame, the method further includes:
[0049] A ratio parameter of a first time interval to a time interval between the starting distortion point and the ending distortion point is calculated as a progress parameter corresponding to the current frame, wherein the first time interval is an interval between a time point corresponding to the current frame and a time point corresponding to the starting distortion point.
[0050] Optionally, before determining the position vector and rotation parameter value of the current frame, the method further includes:
[0051] A ratio parameter of a first distance interval to a distance interval between the starting distortion point and the ending distortion point is calculated as a progress parameter corresponding to the current frame, wherein the first distance interval is an interval between a position point corresponding to the current frame and the starting distortion point.
[0052] According to a second aspect of an embodiment of this specification, there is provided an animation trajectory scaling device, comprising:
[0053] A calculation module is configured to calculate a scaling vector for a target segment of the animation trajectory to be distorted and a target segment of the world trajectory to be distorted of the target character;
[0054] An adjustment module is configured to adjust the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtain motion parameter information of the target character in the world trajectory target segment;
[0055] The application module is configured to apply the motion parameter information corresponding to the current frame to the target character.
[0056] According to a third aspect of an embodiment of this specification, a computing device is provided, including:
[0057] Memory and processor;
[0058] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the following method:
[0059] Calculate a scaling vector for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character;
[0060] Adjust the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtain motion parameter information of the target character in the world trajectory target segment;
[0061] The motion parameter information corresponding to the current frame is applied to the target character.
[0062] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the animation trajectory scaling method are implemented.
[0063] The animation trajectory scaling method provided in this specification calculates a scaling vector, that is, the scaling ratio of the world trajectory to the animation trajectory, for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character, and then adjusts the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame to obtain the motion parameter information of the target character in the world trajectory target segment; and applies the motion parameter information corresponding to the current frame to the target character. The animation trajectory scaling method according to this specification applies the motion parameter information obtained after adjustment based on the scaling vector and the progress parameter to the target character in the current frame, thereby ensuring the speed, position, and rotation consistency of the target character's movement without pre-calculating and pre-storing the animation trajectory. At the same time, due to the use of the scaling vector of the world trajectory segment and the animation trajectory segment, the animation trajectory segment is adjusted in each frame to better maintain the original animation trajectory state and meet the player's requirements for the rhythm of the target character's movement. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 A schematic diagram showing motion distortion in a game world in the prior art is shown;
[0065] Figure 2 A schematic diagram showing a method of adding a simple offset between two twisting points in the prior art is shown;
[0066] Figure 3 A schematic diagram showing the relationship between the path and details of an animation clip in the prior art;
[0067] Figure 4 A flowchart of an animation trajectory scaling method provided by an embodiment of this specification is shown;
[0068] Figure 5 A specific flow chart of a method for scaling an animation track of a cat climbing over an obstacle provided by an embodiment of this specification is shown;
[0069] Figure 6 A schematic diagram of trajectory scaling of an animation trajectory scaling method provided in an embodiment of this specification is shown;
[0070] Figure 7 A schematic diagram of obtaining a bounding box according to a starting distortion point and an ending distortion point of an animation trajectory segment provided by an embodiment of the present specification is shown;
[0071] Figure 8 A schematic diagram showing a comparison of application trajectories before and after scaling provided by an embodiment of this specification is shown;
[0072] Fig. 9 A schematic diagram of the structure of an animation trajectory zooming device provided in an embodiment of the present specification is shown;
[0073] Fig.10 A structural block diagram of a computing device provided in an embodiment of the present specification is shown. DETAILED DESCRIPTION
[0074] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0075] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0076] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0077] In this specification, an animation trajectory scaling method is provided. This specification also relates to an animation trajectory scaling device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0078] Figure 4A flowchart of an animation trajectory scaling method provided according to an embodiment of the present specification is shown, which specifically includes steps 402 to 406.
[0079] Step 402: Calculate a scaling vector for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character.
[0080] The dynamic images seen during the game are formed by the continuous playback of each still frame. The server quickly generates images to obtain a continuous dynamic effect on the screen, and the continuously played animation frames form an animation. An animation trajectory is pre-set for the target character, and the animation trajectory is divided into different animation trajectory segments according to the distortion point. When the animation is played, the animation trajectory target segment is distorted to the world trajectory target segment in the game world, and the corresponding world trajectory is divided into different world trajectory segments according to the matching point. According to the current time t, it is determined that the target character is between the i-th matching point and the i+1-th matching point, and the corresponding animation trajectory segment between the i-th distortion point and the i+1-th distortion point is determined as the animation trajectory target segment, and the corresponding world trajectory segment between the i-th matching point and the i+1-th matching point to be distorted is the world trajectory target segment. In one embodiment, the target character is a quadruped, the animation trajectory segment is a parabolic trajectory formed by the quadruped performing a jumping action, the world trajectory segment is a trajectory formed by the quadruped climbing over multiple obstacles in sequence, and accordingly, the world trajectory target segment is a trajectory formed by the quadruped climbing over an obstacle between the i-th matching point and the i+1-th matching point. The obstacles can have different attributes such as shape, length, height, width, surface slope, etc.
[0081] When the system starts playing the animation track target segment corresponding to the world track target segment, the target character's motion trajectory in the game world will be corrected to align the distortion points from the animation track target segment with the matching points generated by the world track target segment in the game world. The alignment of the two types of points is essentially a mapping of the source animation to the running animation.
[0082] For example, if the target character in the game world jumps or climbs over obstacles multiple times in succession, the trajectory of each jump or climb over the obstacle can be defined as a world trajectory segment, and the trajectory of climbing over the preset obstacle between the i-th matching point and the i+1-th matching point at the current time t is defined as the world trajectory target segment.
[0083] In an optional implementation of this embodiment, for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character, the calculation of the scaling vector is implemented as follows:
[0084] The size of a first bounding box of the target segment of the animation trajectory and the size of a second bounding box of the target segment of the world trajectory are determined, and a scaling vector is calculated according to the size of the first bounding box and the size of the second bounding box.
[0085] In practical applications, the size of the first bounding box can be determined according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory; the size of the second bounding box can be determined according to the spatial positions of the starting matching point and the ending matching point of the target segment of the world trajectory.
[0086] The target segment of the animation trajectory is the segment of the animation trajectory between the ith distortion point and the i+1th distortion point, the starting distortion point is the ith distortion point, and the ending distortion point is the i+1th distortion point. When the target segment of the animation trajectory is the target character jumping, the starting distortion point is the point where the target character squats down to prepare for the jump or squats down and completes the predetermined action, and the ending distortion point is the point where the target character lands after the jump or lands and completes the predetermined action. The starting matching point is the ith matching point mentioned above, and the ending matching point is the i+1th matching point mentioned above. When the target segment of the world trajectory is the target character in the game scene climbing over an obstacle, the starting matching point is the point in the game scene where the target character squats and prepares to jump or squats and completes the predetermined action, and the ending matching point is the point in the game scene where the target character lands after climbing over the obstacle or lands and completes the predetermined action. For example, when the target character is a quadruped, the starting matching point can be set as the point where the quadruped completes the action of crawling downwards, and the point where the quadruped lands after climbing over the obstacle and completes shaking off the body can be set as the ending matching point.
[0087] According to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory, determining the size of the first bounding box can be achieved as follows: establishing a first bounding box so that the first bounding box encloses the starting distortion point and the ending distortion point, subtracting the coordinate positions of the starting distortion point and the ending distortion point in each axis direction from each other and taking the absolute value as the size of the first bounding box, and according to the spatial positions of the starting matching point and the ending matching point of the target segment of the world trajectory, determining the size of the second bounding box can be achieved as follows: establishing a second bounding box so that the second bounding box encloses the starting matching point and the ending matching point, subtracting the coordinate positions of the starting matching point and the ending matching point in each axis direction from each other and taking the absolute value as the size of the second bounding box.
[0088] The current time is t, and the target character in the game world is between the i-th matching point and the i+1-th matching point. The target segment of the animation track is the i-th segment where the target character is located at the current time, the starting distortion point is the i-th distortion point on the entire animation track, and the ending distortion point is the i+1-th distortion point on the entire animation track. The target segment of the world track is the corresponding i-th segment to be matched in the world track, the starting matching point is the i-th matching point on the entire world track, and the ending matching point is the i+1-th matching point on the entire animation track.
[0089] For each segment of the trajectory, the approximate bounding box size of the segment is calculated. The size of the animation trajectory target segment and the world trajectory target segment can be characterized by the size of their respective bounding boxes. In the above embodiment, because it is impossible to traverse and obtain the position of each point on the trajectory within one frame, and the animation engine will not only sample integer frames when sampling, only the distortion point is sampled for each segment of the animation trajectory target segment that needs motion distortion processing, and only the positions of the matching points at the front and back ends are sampled for each segment of the world trajectory target segment for bounding box calculation. Since the positions of the original distortion points of the animation trajectory are the positions of the distortion points after the animation trajectory is played without deformation, the size of the bounding box is fixed for the animation trajectory target segment. The matching points of the world trajectory are set according to the parameters of the obstacle, so the size of the bounding box is not fixed for the world trajectory target segment.
[0090] Specifically, the size of the bounding box is calculated using the absolute value of the maximum span of the point distribution on each axis in the bounding box, that is, the maximum span of the points in the space on the axis, the maximum span of the eight vertices of the bounding box, that is, the absolute value is taken after the coordinates are directly subtracted. For example, if the coordinates of the distortion points at both ends of the i-th animation trajectory in the space of the i-th distortion point are (0,1,-1) and (-1,0,1), respectively, then the bounding box size of the target segment of the animation trajectory returned at the end is (1,1,2). Similarly, if the coordinates of the matching points at both ends of the i-th world trajectory in the space of the i-th matching point are (-1,-1,-1) and (1,1,2), respectively, the bounding box size of the target segment of the world trajectory is calculated based on the coordinates of the matching points at both ends of the i-th world trajectory in the space of the i-th matching point as (2,2,3).
[0091] Since the scaling vector is calculated using the bounding box size, the bounding box size should not be too small, otherwise it will result in failure to calculate the scaling vector based on the bounding box size of the target segment of the animation track and the target segment of the world track. In one embodiment, when the bounding box size is too small, for example, the length or width of a bounding box is 0, it can be simply processed by assigning it a minimum value (such as 0.1), that is, the size of each axis must not be less than a minimum value to avoid returning a non-number (NaN) after the division operation.
[0092] In some cases, the trajectory bounding box obtained by this method has a large error. For example, for the action of "jumping" over an obstacle, the two warp points before and after, i.e., the start warp point and the end warp point, are on the xz plane, and the y-direction scaling cannot be obtained based on the two warp points. The same problem exists in the world trajectory target segment.
[0093] Therefore, in one embodiment, a "soft point" is introduced to increase the sampling points used to calculate the trajectory bounding box, so as to obtain a bounding box that is close to the correct one and calculate the scaling more accurately. For the target segment of the animation trajectory, several time points between the time of the two previous and next distortion points can be used for sampling, and the sampled position coordinates are used for bounding box calculation.
[0094] In the case of introducing a "soft point", determining the size of the first bounding box of the animation track target segment and the size of the second bounding box of the world track target segment includes:
[0095] Determine the size of the first bounding box according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory and one or more positions between the starting distortion point and the ending distortion point;
[0096] The size of the second bounding box is determined according to the spatial positions of the starting matching point and the ending matching point of the target segment of the world trajectory and one or more matching points between the starting matching point and the ending matching point.
[0097] For the position, rotation and scaling to be matched in the game world space, a point in the world track target segment can be passed in to participate in the bounding box size calculation of the world track target segment. For example, for the action of "jumping" over an obstacle, a parabola of a certain height is expected, and this height should ensure that the character can jump over the obstacle of a certain height. At this time, the expected highest point of the parabola can be used as a "soft point" to participate in the bounding box calculation of the world track to ensure that the bounding box has at least the expected track height. The above one or more matching points can be the highest point of the parabola.
[0098] Optionally, according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory and one or more position points between the starting distortion point and the ending distortion point, determining the size of the first bounding box can be achieved as follows: establishing a first bounding box so that the first bounding box encloses the starting distortion point, the ending distortion point and the position point, subtracting the coordinate positions of the two vertices of the body diagonal of the bounding box in each axial direction, and taking the absolute value as the size of the first bounding box.
[0099] According to the spatial positions of the starting matching point and the ending matching point of the world trajectory target segment and one or more matching points between the starting matching point and the ending matching point, determining the size of the second bounding box can be achieved as follows: establishing a second bounding box so that the second bounding box encloses the starting matching point and the ending matching point and one or more matching points, subtracting the coordinate positions of the two vertices of the body diagonal of the second bounding box in each axial direction, and taking the absolute value as the size of the bounding box of the world trajectory target segment.
[0100] In one implementation of this embodiment, after determining the size of the first bounding box of the target segment of the animation trajectory, the method further includes:
[0101] It is determined whether the first bounding box just encloses the starting matching point, the ending matching point and one or more matching points. If not, a second bounding box is established so that the second bounding box encloses the starting matching point, the ending matching point and one or more matching points.
[0102] If the bounding box calculated by the points involved in the calculation, i.e., the starting distortion point and the ending distortion point, just covers the starting matching point, the ending matching point, and one or more matching points on the target segment of the world trajectory, the first bounding box can be used as the second bounding box, and the ratio of the size of the second bounding box to the first bounding box is (1,1,1), that is, no scaling is required. If it does not just cover, the second bounding box is established as described above.
[0103] Step 404: adjusting the target segment of the animation trajectory based on the scaling vector and the progress parameter corresponding to the current frame, and obtaining motion parameter information of the target character in the target segment of the world trajectory.
[0104] The progress parameter corresponding to the current frame can be calculated by one of the following methods: calculating the ratio parameter of the first time interval to the time interval between the starting distortion point and the ending distortion point as the progress parameter corresponding to the current frame, wherein the first time interval is the interval between the time point corresponding to the current frame and the time point corresponding to the starting distortion point; or calculating the ratio parameter of the first distance interval to the distance interval between the starting distortion point and the ending distortion point as the progress parameter corresponding to the current frame, wherein the first distance interval is the interval between the position point corresponding to the current frame and the starting distortion point. The progress parameter is a value between 0 and 1, and the progress parameter 0 represents the progress parameter corresponding to the starting distortion point of the animation, and the progress parameter 1 represents the progress parameter corresponding to the ending distortion point of the animation. In the above embodiment, the progress parameter is calculated according to time or distance. Those skilled in the art can conceive of other implementation methods, as long as the weight is a parameter representing the progress of the animation frame between 0 and 1. The motion parameter information may include parameter information such as position vector, rotation parameter value, etc. that represents the motion of the target character in the target section of the world trajectory.
[0105] In an optional implementation of the embodiment, adjusting the target segment of the animation trajectory based on the scaling vector and the progress parameter corresponding to the current frame, and obtaining the motion parameter information of the target character in the target segment of the world trajectory is implemented as follows:
[0106] Obtaining a first position vector and a first world rotation matrix of a starting matching point and a second position vector and a second world rotation matrix of an ending matching point of the world trajectory target segment;
[0107] Obtain a first world transformation matrix of the starting matching point according to the first position vector, the first world rotation matrix and the scaling vector, and obtain a second world transformation matrix of the ending matching point according to the second position vector, the second world rotation matrix and the scaling vector;
[0108] The position vector and rotation parameter value of the current frame are determined according to the first world transformation matrix, the second world transformation matrix, the first animation transformation matrix obtained at the starting distortion point of the target segment of the animation trajectory, the second animation transformation matrix obtained at the ending distortion point of the target segment of the animation trajectory, the current animation transformation matrix at the time point corresponding to the current frame, and the progress parameter corresponding to the current frame, wherein the starting matching point corresponds to the starting distortion point, and the ending matching point corresponds to the ending distortion point.
[0109] The first position vector is the position vector that needs to be matched by the i-th matching point in the game world. The first world rotation matrix is the rotation parameter value that needs to be matched by the i-th matching point. i (Quaternion) converted to rotation matrix R i The position vector and rotation parameter value of the i-th matching point are passed in from the outside, that is, the position and rotation that the target point wants to reach. Similarly, the second position vector is the position vector that the i+1-th matching point needs to match in the game world. The second world rotation matrix is the rotation parameter value that needs to be matched for the i+1th matching point. i+1 (Quaternion) converted to rotation matrix R i+1 The position vector and rotation parameter value of the i+1th matching point are input from the outside, that is, the position that the target point wants to reach and the rotation to be achieved.
[0110] Use scaling vector To scale the position vector and rotation matrix of the i-th point and the i+1-th point, we get two world transformation matrices, namely the first world transformation matrix W i and the second world transformation matrix W i+1 :
[0111]
[0112] In one implementation, the above calculation is implemented in Unity, and the world transformation matrix can be calculated according to position, rotation, and scaling by calling the TRS method in Unity.
[0113] The first animation transformation matrix is the transformation matrix M obtained after time sampling of the i-th point, i.e., the starting distortion point i The second animation transformation matrix is the transformation matrix M obtained after time sampling of the i+1th point, i.e., the end distortion point i+1 , the current animation transformation matrix at the time point corresponding to the current frame is M t In Unity, the above M t 、M i and M i+1 is a 4×4 dimensional matrix, which is the rotation matrix of the local coordinates of the i-th point. In one embodiment, M i and M i+1 The two transformation matrices can be pre-sampled and stored before the motion warping is performed, and can be directly extracted and used when the motion warping is performed.
[0114] The size of the animation track is in M i The world trajectory (i.e. the distorted trajectory) is calculated in the local space represented by W. i The scale vector is calculated in the local space represented by the vector and can be temporarily stored in the scale attribute of the i-th Transform in the "Information Provider" at the beginning of each motion distortion.
[0115] In one implementation of this embodiment, according to the first world transformation matrix, the second world transformation matrix, the first animation transformation matrix obtained at the starting distortion point of the target segment of the animation trajectory, the second animation transformation matrix obtained at the ending distortion point of the target segment of the animation trajectory, the current animation transformation matrix at the time point corresponding to the current frame, and the progress parameter corresponding to the current frame, determining the position vector and the rotation parameter value of the current frame is implemented as follows:
[0116] Obtain a first target position vector and a first target rotation parameter value according to the current animation transformation matrix at the time point corresponding to the current frame, the first animation transformation matrix obtained at the starting distortion point, and the first world transformation matrix;
[0117] Obtain a second target position vector and a second target rotation parameter value according to the current animation transformation matrix, the second animation transformation matrix obtained at the end distortion point, and the second world transformation matrix;
[0118] The position vector of the current frame is obtained according to the first target position vector, the second target position vector and the progress parameter, and the rotation parameter value of the current frame is obtained according to the first target rotation parameter value, the second target rotation parameter value and the progress parameter.
[0119] According to the current animation transformation matrix at the time point corresponding to the current frame, the first animation transformation matrix obtained at the starting distortion point, and the first world transformation matrix, obtaining the first target position vector and the first target rotation parameter value can be achieved as follows: according to the current animation transformation matrix, the first animation transformation matrix, and the first world transformation matrix, obtaining the first posture matrix; according to the first posture matrix, obtaining the first target position vector and the first target rotation parameter value; and according to the current animation transformation matrix, the second animation transformation matrix obtained at the ending distortion point, and the second world transformation matrix, obtaining the second target position vector and the second target rotation parameter value can be achieved as follows: according to the current animation transformation matrix, the second animation transformation matrix, and the second world transformation matrix, obtaining the second posture matrix; according to the second posture matrix, obtaining the second target position vector and the second target rotation parameter value.
[0120] In one embodiment, firstly, the position relationship of the current time point in the target segment of the animation trajectory relative to the starting distortion point, i.e., the i-th point, and the ending matching point, i.e., the M t In M i and M i+1 The local transformation matrix M in two spaces i -1 M t 、M i+1 -1 M t .
[0121] Then, use W i and W i+1 Transform the two local transformation matrices obtained in the previous step to the world space respectively. The geometric meanings of the two matrices in the world space are: the posture that the animation should reach if it does not match the target point at all, and the posture that should be reached if the animation reaches the target point at the end of playback.
[0122]
[0123]
[0124] The first attitude matrix is The second posture matrix is After obtaining the two posture matrices, take out the first target position vector and the second target position vector from the two posture matrices respectively. And the first target rotation parameter value, the second target rotation parameter value (quaternion), extracting the target position vector and the target rotation parameter value from the attitude matrix can be implemented by using any formula or method known to those skilled in the art.
[0125] According to the first target position vector, the second target position vector and the progress parameter, obtaining the position vector of the current frame can be achieved by performing interpolation between the first target position vector and the second target position vector according to the progress parameter to obtain the position vector of the current frame. According to the first target rotation parameter value, the second target rotation parameter value and the progress parameter, obtaining the rotation parameter value of the current frame can be achieved by performing spherical interpolation between the first target rotation parameter value and the second target rotation parameter value according to the progress parameter to obtain the rotation parameter value of the current frame.
[0126] The position of the current frame application and rotation Q are obtained by interpolating the first target position vector and the second target position vector and the first target rotation parameter value and the second target rotation parameter value according to the progress parameter (weight). In one embodiment, SLERP spherical interpolation is performed on the target rotation parameter value. In another embodiment, LERP ordinary interpolation is performed on the target rotation parameter value, which will not affect the perception.
[0127]
[0128]
[0129] Step 406: Apply the motion parameter information corresponding to the current frame to the target character.
[0130] When the current frame is played, the position vector and rotation parameter values of the current frame are applied to the target character. The target character moves in each frame according to the position vector and rotation parameter values obtained after the progress parameter interpolation of each frame, forming a distorted world track target segment.
[0131] The animation trajectory scaling method according to the present embodiment applies the motion parameter information obtained after adjusting the scaling vector and progress parameters to the target character in the current frame, thereby ensuring the speed, position, and rotation continuity of the motion without pre-calculating and pre-storing the animation trajectory, while better maintaining the original animation trajectory state, satisfying the player's requirements for the rhythm of the target character's movement.
[0132] It should be noted that when the trajectory scaling results of the current world trajectory target segment and the next world trajectory target segment are very different, it may cause a "speed change" in the perception. At this time, you can make a trade-off between maintaining the trajectory shape and the smoothness of the animation. If smooth playback is more important, you can give up trajectory scaling, or post-process the scaling value, such as changing the scaling value slowly as the animation plays, to reduce its impact.
[0133] The following combination Figure 5Taking the application of the animation trajectory scaling method provided in this specification to a cat climbing over an obstacle as an example, the animation trajectory scaling method is further described. Figure 5 A processing flow chart of a method for scaling an animation trajectory of a cat climbing over an obstacle provided in an embodiment of the present specification is shown, which specifically includes steps 502 to 518.
[0134] Step 502: Obtain the animation trajectory segment of the cat jumping and the starting matching point and the ending matching point of the trajectory to be distorted in the game world.
[0135] The animation trajectory segment is a pre-set parabola of the cat's jumping action, such as Figure 6 As shown, the animation track segment from A1 to A2 is obtained, A1 is the starting distortion point of the animation track segment, and A2 is the ending distortion point of the animation track segment. For the animation track segment of the cat jumping, the starting distortion point A1 is the point where the cat squats and crawls down to prepare for jumping, and the ending distortion point A2 is the point where the cat lands after jumping.
[0136] The starting matching point and the ending matching point to be warped in the game world are set according to the parameters of the obstacles that the cat has to climb over in the game world, such as Figure 6 As shown, B1 is the starting matching point corresponding to the starting distortion point A1, and B2 is the ending matching point corresponding to the ending distortion point A2. That is, when the animation track segment is played, A1 needs to be adjusted to B1, and A2 needs to be adjusted to B2. B3 is the highest point of the track set according to the height of the obstacle.
[0137] Step 504: Create a first bounding box to enclose the starting distortion point A1 and the ending distortion point A2 of the animation trajectory segment and one or more position points between A1 and A2, subtract the coordinate positions of the two vertices of the body diagonal of the bounding box in the axial direction and take the absolute value to obtain the size of the first bounding box.
[0138] Figure 7 A schematic diagram of obtaining a bounding box based on the starting distortion point and the ending distortion point before and after the animation trajectory is shown. Figure 7 The starting distortion point and the ending distortion point are used as the vertices of the diagonal of the bounding box. For example, if the coordinates of the two vertices of the first bounding box are (0,1,-1) and (-1,0,1), the size of the first bounding box is (1,1,2).
[0139] Step 506: Create a second bounding box so that the second bounding box encloses the starting matching point B1, the ending matching point B2 and the highest point B3 of the trajectory, subtract the coordinate positions of the two vertices of the body diagonal of the second bounding box in each axis direction and take the absolute value to obtain the size of the second bounding box.
[0140] For example, if the coordinates of the two vertices of the body diagonal of the second bounding box are (-1,-1,-1) and (1,1,2), then the size of the second bounding box is (2,2,3).
[0141] Step 508: Calculate the ratio of the size of the second bounding box to the size of the first bounding box as the scaling vector.
[0142] The calculated scaling vector The scaling factor of the target track in the game world that you want to distort into compared to the original animation track. For example, if the first bounding box size of the animation track segment is (1,1,2) and the second bounding box size of the world track segment is (2,2,3), the scaling vector is (2,2,3 / 2).
[0143] Step 510: According to the position vector of the starting matching point B1 Rotation matrix R B1 and the scaling vector Calculate the first transformation matrix W of the starting matching point B1 B1 , and the position vector of the end matching point B2 Rotation matrix R B2 and the scaling vector Calculate the second transformation matrix W of the end matching point B2 B2 .
[0144]
[0145] The position vector and rotation parameter values are externally passed in, representing the desired position and rotation of points B1 and B2, respectively. The rotation matrix is obtained based on the rotation parameter values. To scale the position vector and rotation matrix of points B1 and B2, we can get two world transformation matrices.
[0146] Step 512: Obtain the animation transformation matrix M of the starting distortion point A1 in the animation trajectory segment A1 And the animation transformation matrix M of the end distortion point A2 A2 And the animation transformation matrix M at the time point corresponding to the current frame t , calculate M t In M A1 and M A2 The local transformation matrix M under A1 -1 M t 、M A2 -1 M t .
[0147] M t 、M A1 and M A2In Unity, it is a 4×4 dimensional matrix, which is the rotation matrix of the local coordinates. In one embodiment, M A1 and M A2 The two transformation matrices can be pre-sampled and stored before the motion warping is performed, and can be directly extracted and used when the motion warping is performed.
[0148] Step 514: Based on the local transformation matrix and the first transformation matrix W B1 And the second transformation matrix W B2 Get the first posture matrix and the second posture matrix
[0149]
[0150]
[0151] Step 516: Extract the first target position vector and the first target rotation parameter value from the first posture matrix, extract the second target position vector and the second target rotation parameter value from the second posture matrix, interpolate according to the progress parameter weight of the current frame, and obtain the position vector and rotation parameter value of the current frame.
[0152] from and Take out the first target position vector and the second target position vector And the first target rotation parameter value, the second target rotation parameter value (quaternion), extracting the target position vector and the target rotation parameter value from the attitude matrix can be implemented by using any formula or method known to those skilled in the art.
[0153]
[0154]
[0155] Then, LERP linear interpolation is performed on the target position vector, and SLERP spherical interpolation is performed on the target rotation parameter value to obtain the current frame position vector and the rotation parameter value Q.
[0156] Step 518: Apply the position vector and rotation parameter value corresponding to the current frame to the cat.
[0157] like Figure 8 As shown in the figure on the right, after the above-mentioned trajectory scaling is introduced, the target character, i.e. the cat, rotates completely correctly on the plane of the animation trajectory where the matching ends, and the two trajectories in the animation and the game world completely overlap. However, in the figure on the left, where trajectory scaling is not introduced, the rotation is discontinuous and the trajectories do not overlap.
[0158] The animation trajectory scaling method according to the present embodiment applies the position vector and rotation parameter value obtained after adjustment based on the scaling vector and progress parameter to the cat in the current frame, thereby ensuring the speed, position, and rotation continuity of the cat's movement without the need for pre-calculation and pre-storage of the animation trajectory, while better maintaining the original animation trajectory state, satisfying the player's requirements for the rhythm of the cat's movement.
[0159] In one embodiment, when there is no need to match the rotation, the purpose of moving the target character to the target position in the game world can be achieved by only using trajectory scaling. In addition, in one embodiment, before step 512, it also includes a process of reading and sorting the distortion points: first, based on the space point selection, such as the case of a cat climbing over an obstacle, the corresponding point is selected in the space according to the shape ratio of the animation, and the point selection is based on ensuring that the cat can climb over the obstacle; the points on the key trajectory are taken, and the key information is read out, sorted by time, and the normalized time is stored, and sorted in ascending order; each time it is played, it will automatically match which stage the target character is in the trajectory, and in each stage, it will return which point it needs to match in the next step.
[0160] Corresponding to the above method embodiment, this specification also provides an animation trajectory scaling device embodiment, Fig. 9 FIG. 1 shows a schematic diagram of the structure of an animation trajectory zooming device provided in an embodiment of the present specification. Fig. 9 As shown, the device comprises:
[0161] A calculation module 902 is configured to calculate a scaling vector for a target segment of the animation trajectory to be distorted and a target segment of the world trajectory to be distorted of the target character;
[0162] An adjustment module 904 is configured to adjust the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtain motion parameter information of the target character in the world trajectory target segment;
[0163] The application module 906 is configured to apply the motion parameter information corresponding to the current frame to the target character.
[0164] Optionally, the calculation module is further configured to:
[0165] The size of a first bounding box of the animation trajectory target segment and the size of a second bounding box of the world trajectory target segment are determined, and a scaling vector is calculated according to the size of the first bounding box and the size of the second bounding box.
[0166] Optionally, the calculation module includes:
[0167] A first determination submodule is configured to determine the size of the first bounding box according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory;
[0168] The second determination submodule is configured to determine the size of the second bounding box according to the spatial positions of the start matching point and the end matching point of the world trajectory target segment.
[0169] Optionally, the first determining submodule is further configured to:
[0170] A first bounding box is established so that the first bounding box encloses the starting distortion point and the ending distortion point, and the coordinate positions of the starting distortion point and the ending distortion point in each axis are subtracted and the absolute value is taken as the size of the first bounding box, and the second determining submodule is further configured as:
[0171] A second bounding box is established so that the second bounding box encloses the starting matching point and the ending matching point, and the coordinate positions of the starting matching point and the ending matching point in each axial direction are subtracted and the absolute value is taken as the size of the second bounding box.
[0172] Optionally, the calculation module includes:
[0173] A third determination submodule is configured to determine a size of the first bounding box according to a starting distortion point and an ending distortion point of the target segment of the animation trajectory and a spatial position of one or more positions between the starting distortion point and the ending distortion point;
[0174] The fourth determination submodule is configured to determine the size of the second bounding box according to the starting matching point and the ending matching point of the world trajectory target segment and the spatial positions of one or more matching points between the starting matching point and the ending matching point.
[0175] Optionally, the third determining submodule is further configured to:
[0176] A first bounding box is established so that the first bounding box encloses the starting distortion point, the ending distortion point and the position point, and the coordinate positions of two vertices of the body diagonal of the bounding box in each axis direction are subtracted and the absolute value is taken as the size of the first bounding box.
[0177] Optionally, the fourth determining submodule is further configured to:
[0178] A second bounding box is established so that the second bounding box encloses the starting matching point, the ending matching point and the one or more matching points, and the coordinate positions of the two vertices of the body diagonal of the second bounding box in each axial direction are subtracted and the absolute value is taken as the size of the bounding box of the world trajectory target segment.
[0179] Optionally, the adjustment module includes:
[0180] An acquisition submodule is configured to acquire a first position vector and a first world rotation matrix of a starting matching point and a second position vector and a second world rotation matrix of an ending matching point of the world trajectory target segment;
[0181] an obtaining submodule, configured to obtain a first world transformation matrix of the starting matching point according to the first position vector, the first world rotation matrix and the scaling vector, and to obtain a second world transformation matrix of the ending matching point according to the second position vector, the second world rotation matrix and the scaling vector;
[0182] The fifth determination submodule is configured to determine the position vector and rotation parameter value of the current frame based on the first world transformation matrix, the second world transformation matrix, the first animation transformation matrix obtained at the starting distortion point of the target segment of the animation trajectory, the second animation transformation matrix obtained at the ending distortion point of the target segment of the animation trajectory, the current animation transformation matrix at the time point corresponding to the current frame, and the progress parameter corresponding to the current frame, wherein the starting matching point corresponds to the starting distortion point, and the ending matching point corresponds to the ending distortion point.
[0183] Optionally, the fifth determining submodule includes:
[0184] A first obtaining unit is configured to obtain a first target position vector and a first target rotation parameter value according to a current animation transformation matrix at a time point corresponding to a current frame, a first animation transformation matrix obtained at the starting distortion point, and the first world transformation matrix;
[0185] A second obtaining unit is configured to obtain a second target position vector and a second target rotation parameter value according to the current animation transformation matrix, the second animation transformation matrix obtained from the end distortion point, and the second world transformation matrix;
[0186] The third obtaining unit is configured to obtain the position vector of the current frame according to the first target position vector, the second target position vector and the progress parameter, and to obtain the rotation parameter value of the current frame according to the first target rotation parameter value, the second target rotation parameter value and the progress parameter.
[0187] Optionally, the first obtaining unit is further configured to:
[0188] Obtaining a first posture matrix according to the current animation transformation matrix, the first animation transformation matrix and the first world transformation matrix;
[0189] According to the first posture matrix, obtaining a first target position vector and a first target rotation parameter value;
[0190] And the second obtaining unit is further configured to:
[0191] Obtaining a second posture matrix according to the current animation transformation matrix, the second animation transformation matrix and the second world transformation matrix;
[0192] According to the second posture matrix, a second target position vector and a second target rotation parameter value are obtained.
[0193] Optionally, the third obtaining unit is further configured to:
[0194] Interpolation is performed between the first target position vector and the second target position vector according to the progress parameter to obtain a position vector of the current frame.
[0195] Optionally, the third obtaining unit is further configured to:
[0196] Spherical interpolation is performed between the first target rotation parameter value and the second target rotation parameter value according to the progress parameter to obtain a rotation parameter value of the current frame.
[0197] Optionally, the animation trajectory scaling device further includes:
[0198] The judgment module is configured to judge whether the first bounding box just encloses the starting matching point, the ending matching point and the one or more matching points. If not, a second bounding box is established so that the second bounding box encloses the starting matching point, the ending matching point and the one or more matching points.
[0199] Optionally, the animation trajectory scaling device further includes:
[0200] The first progress parameter calculation module is configured to calculate a ratio parameter of a first time interval to a time interval between the starting distortion point and the ending distortion point as a progress parameter corresponding to the current frame, wherein the first time interval is an interval between a time point corresponding to the current frame and a time point corresponding to the starting distortion point.
[0201] Optionally, the animation trajectory scaling device further includes:
[0202] The second progress parameter calculation module is configured to calculate a ratio parameter of a first distance interval to a distance interval between the starting distortion point and the ending distortion point as a progress parameter corresponding to the current frame, wherein the first distance interval is an interval between a position point corresponding to the current frame and the starting distortion point.
[0203] The animation trajectory scaling device according to the present embodiment applies the motion parameter information obtained after adjustment based on the scaling vector and the progress parameter to the target character in the current frame, thereby ensuring the speed, position, and rotation continuity of the motion without the need for pre-calculation and pre-storage of the animation trajectory, while better maintaining the original animation trajectory state, thereby satisfying the player's requirements for the rhythm of the target character's movement.
[0204] The above is a schematic scheme of an animation trajectory zooming device of this embodiment. It should be noted that the technical scheme of the animation trajectory zooming device and the technical scheme of the animation trajectory zooming method described above belong to the same concept, and the details not described in detail in the technical scheme of the animation trajectory zooming device can be referred to the description of the technical scheme of the animation trajectory zooming method described above.
[0205] Fig.10 The structure block diagram of a computing device 1000 provided according to an embodiment of the present specification is shown. The components of the computing device 1000 include but are not limited to a memory 1010 and a processor 1020. The processor 1020 is connected to the memory 1010 via a bus 1030, and the database 1050 is used to store data.
[0206] The computing device 1000 also includes an access device 1040 that enables the computing device 1000 to communicate via one or more networks 1060. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1040 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0207] In one embodiment of the present specification, the above components of the computing device 1000 and Fig.10 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.10 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0208] The computing device 1000 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 1000 may also be a mobile or stationary server.
[0209] The processor 1020 is used to execute the following computer executable instructions:
[0210] Calculate a scaling vector for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character;
[0211] Adjust the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtain motion parameter information of the target character in the world trajectory target segment;
[0212] The motion parameter information corresponding to the current frame is applied to the target character.
[0213] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above animation trajectory scaling method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above animation trajectory scaling method.
[0214] An embodiment of the present specification further provides a computer-readable storage medium storing computer instructions, which are used when executed by a processor to:
[0215] Calculate a scaling vector for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character;
[0216] Adjust the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtain motion parameter information of the target character in the world trajectory target segment;
[0217] The motion parameter information corresponding to the current frame is applied to the target character.
[0218] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above animation trajectory scaling method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above animation trajectory scaling method.
[0219] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0220] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0221] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that this specification is not limited by the order of the actions described, because according to this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this specification.
[0222] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0223] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. An animation trajectory scaling method, characterized in that: include: Calculating a scaling vector for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character, including: determining the size of a first bounding box of the target segment of the animation trajectory and the size of a second bounding box of the target segment of the world trajectory, and calculating the scaling vector according to the size of the first bounding box and the size of the second bounding box; Adjusting the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, obtaining motion parameter information of the target character in the world trajectory target segment, wherein the motion parameter information represents parameter information of the motion posture of the target character in the world trajectory target segment; The motion parameter information corresponding to the current frame is applied to the target character.
2. The animation trajectory scaling method according to claim 1, characterized in that: Determining the size of the first bounding box of the animation trajectory target segment and the size of the second bounding box of the world trajectory target segment comprises: Determining the size of the first bounding box according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory; The size of the second bounding box is determined according to the spatial positions of the start matching point and the end matching point of the world trajectory target segment.
3. The animation trajectory scaling method according to claim 2, characterized in that: Determining the size of the first bounding box according to the spatial positions of the starting distortion point and the ending distortion point of the target segment of the animation trajectory includes: Establishing a first bounding box so that the first bounding box encloses the starting distortion point and the ending distortion point, subtracting the coordinate positions of the starting distortion point and the ending distortion point in each axis direction from each other and taking the absolute value as the size of the first bounding box, and determining the size of the second bounding box according to the spatial positions of the starting matching point and the ending matching point of the world trajectory target segment includes: A second bounding box is established so that the second bounding box encloses the starting matching point and the ending matching point, and the coordinate positions of the starting matching point and the ending matching point in each axial direction are subtracted and the absolute value is taken as the size of the second bounding box.
4. The animation trajectory scaling method according to claim 1, characterized in that: Determining the size of the first bounding box of the animation trajectory target segment and the size of the second bounding box of the world trajectory target segment comprises: Determine the size of the first bounding box according to the spatial position of the starting distortion point and the ending distortion point of the target segment of the animation trajectory and one or more position points between the starting distortion point and the ending distortion point; The size of the second bounding box is determined according to the starting matching point and the ending matching point of the world trajectory target segment and the spatial positions of one or more matching points between the starting matching point and the ending matching point.
5. The animation trajectory scaling method according to claim 4, characterized in that: Determining the size of the first bounding box according to the spatial position of the starting distortion point and the ending distortion point of the target segment of the animation trajectory and one or more position points between the starting distortion point and the ending distortion point includes: A first bounding box is established so that the first bounding box encloses the starting distortion point, the ending distortion point and the position point, and the coordinate positions of two vertices of the body diagonal of the bounding box in each axis direction are subtracted and the absolute value is taken as the size of the first bounding box.
6. The animation trajectory scaling method according to claim 4, characterized in that: Determining the size of the second bounding box according to the starting matching point and the ending matching point of the world trajectory target segment and the spatial position of one or more matching points between the starting matching point and the ending matching point includes: A second bounding box is established so that the second bounding box encloses the starting matching point, the ending matching point and the one or more matching points, and the coordinate positions of the two vertices of the body diagonal of the second bounding box in each axial direction are subtracted and the absolute value is taken as the size of the bounding box of the world trajectory target segment.
7. The animation trajectory scaling method according to claim 1, characterized in that: Adjusting the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtaining the motion parameter information of the target character in the world trajectory target segment includes: Obtaining a first position vector and a first world rotation matrix of a starting matching point and a second position vector and a second world rotation matrix of an ending matching point of the world trajectory target segment; Obtain a first world transformation matrix of the starting matching point according to the first position vector, the first world rotation matrix and the scaling vector, and obtain a second world transformation matrix of the ending matching point according to the second position vector, the second world rotation matrix and the scaling vector; The position vector and rotation parameter value of the current frame are determined according to the first world transformation matrix, the second world transformation matrix, the first animation transformation matrix obtained at the starting distortion point of the target segment of the animation trajectory, the second animation transformation matrix obtained at the ending distortion point of the target segment of the animation trajectory, the current animation transformation matrix at the time point corresponding to the current frame, and the progress parameter corresponding to the current frame, wherein the starting matching point corresponds to the starting distortion point, and the ending matching point corresponds to the ending distortion point.
8. The animation trajectory scaling method according to claim 7, characterized in that: Determining the position vector and rotation parameter value of the current frame according to the first world transformation matrix, the second world transformation matrix, the first animation transformation matrix obtained at the starting distortion point of the target segment of the animation trajectory, the second animation transformation matrix obtained at the ending distortion point of the target segment of the animation trajectory, the current animation transformation matrix at the time point corresponding to the current frame, and the progress parameter corresponding to the current frame includes: Obtaining a first target position vector and a first target rotation parameter value according to a current animation transformation matrix at a time point corresponding to a current frame, a first animation transformation matrix obtained at the starting distortion point, and the first world transformation matrix; Obtain a second target position vector and a second target rotation parameter value according to the current animation transformation matrix, the second animation transformation matrix obtained from the end distortion point, and the second world transformation matrix; The position vector of the current frame is obtained according to the first target position vector, the second target position vector and the progress parameter, and the rotation parameter value of the current frame is obtained according to the first target rotation parameter value, the second target rotation parameter value and the progress parameter.
9. The animation trajectory scaling method according to claim 8, characterized in that: Obtaining a first target position vector and a first target rotation parameter value according to a current animation transformation matrix at a time point corresponding to a current frame, a first animation transformation matrix obtained from the starting distortion point, and the first world transformation matrix comprises: Obtaining a first posture matrix according to the current animation transformation matrix, the first animation transformation matrix and the first world transformation matrix; According to the first posture matrix, obtaining a first target position vector and a first target rotation parameter value; And obtaining a second target position vector and a second target rotation parameter value according to the current animation transformation matrix, the second animation transformation matrix obtained from the end distortion point, and the second world transformation matrix comprises: Obtaining a second posture matrix according to the current animation transformation matrix, the second animation transformation matrix and the second world transformation matrix; According to the second posture matrix, a second target position vector and a second target rotation parameter value are obtained.
10. The animation trajectory scaling method according to claim 8, characterized in that: Obtaining the position vector of the current frame according to the first target position vector, the second target position vector and the progress parameter includes: Interpolation is performed between the first target position vector and the second target position vector according to the progress parameter to obtain a position vector of the current frame.
11. The animation trajectory scaling method according to claim 8, characterized in that: Obtaining the rotation parameter value of the current frame according to the first target rotation parameter value, the second target rotation parameter value, and the progress parameter includes: Spherical interpolation is performed between the first target rotation parameter value and the second target rotation parameter value according to the progress parameter to obtain a rotation parameter value of the current frame.
12. The animation trajectory scaling method according to claim 4, characterized in that: After determining the size of the first bounding box of the target segment of the animation trajectory, the method further includes: Determine whether the first bounding box just encloses the starting matching point, the ending matching point and the one or more matching points; if not, establish a second bounding box so that the second bounding box encloses the starting matching point, the ending matching point and the one or more matching points.
13. The animation trajectory scaling method according to claim 7, characterized in that: Before determining the position vector and rotation parameter values of the current frame, it also includes: A ratio parameter of a first time interval to a time interval between the starting distortion point and the ending distortion point is calculated as a progress parameter corresponding to the current frame, wherein the first time interval is an interval between a time point corresponding to the current frame and a time point corresponding to the starting distortion point.
14. The animation trajectory scaling method according to claim 7, characterized in that: Before determining the position vector and rotation parameter values of the current frame, it also includes: A ratio parameter of a first distance interval to a distance interval between the starting distortion point and the ending distortion point is calculated as a progress parameter corresponding to the current frame, wherein the first distance interval is an interval between a position point corresponding to the current frame and the starting distortion point.
15. An animation trajectory zooming device, comprising: The calculation module is configured to calculate a scaling vector for a target segment of an animation trajectory to be distorted and a target segment of a world trajectory to be distorted of a target character, including: determining a size of a first bounding box of the target segment of the animation trajectory and a size of a second bounding box of the target segment of the world trajectory, and calculating the scaling vector according to the size of the first bounding box and the size of the second bounding box; An adjustment module is configured to adjust the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, and obtain motion parameter information of the target character in the world trajectory target segment, wherein the motion parameter information represents parameter information of the motion posture of the target character in the world trajectory target segment; The application module is configured to apply the motion parameter information corresponding to the current frame to the target character.
16. A computing device comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the following method: Calculating a scaling vector for the target segment of the animation trajectory to be distorted and the target segment of the world trajectory to be distorted of the target character, including: determining the size of a first bounding box of the target segment of the animation trajectory and the size of a second bounding box of the target segment of the world trajectory, and calculating the scaling vector according to the size of the first bounding box and the size of the second bounding box; Adjusting the animation trajectory target segment based on the scaling vector and the progress parameter corresponding to the current frame, obtaining motion parameter information of the target character in the world trajectory target segment, wherein the motion parameter information represents parameter information of the motion posture of the target character in the world trajectory target segment; The motion parameter information corresponding to the current frame is applied to the target character.
17. A computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the animation trajectory scaling method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Implementation method and system for applying animation to Android platform
CN103942050A
Full-automatic multi-source heterogeneous motion redirecting method of quasi-man character
CN104183000A
Method for achieving role treading track animation by using Bezier curve
CN104318600A
Object modeling motion method, device and equipment
CN110634177A
Collision rendering method and device
CN111080751A
