Animation path finding method and system based on attitude distance matching

Through an animation pathfinding method based on pose distance matching, the problem of single sliding phenomenon and pathfinding process in the game is solved, and higher quality and rich animation performance is achieved, enhancing the game experience.

CN119075315APending Publication Date: 2024-12-06ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411144242.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The slippage phenomenon in existing games leads to distortion of animation, the pathfinding process is single and lacks fun, and traditional methods of treating symptoms but not root causes.

Method used

Using an animation pathfinding method based on pose distance matching, the slipping problem is handled through voxelized maps, improved A* algorithm and Jacobian matrix, the cost function of the pathfinding algorithm is designed and the selection of neighbor nodes is optimized, the path randomness is increased, and the path is randomized through The slide processing module generates a distance curve to avoid slippage.

Benefits of technology

It improves the quality and richness of character pathfinding animations, ensures the smoothness and realistic animations during movement, and enhances the game experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119075315A_ABST
    Figure CN119075315A_ABST
Patent Text Reader

Abstract

The invention discloses an animation path-finding method and system based on attitude distance matching. The method comprises the following steps: constructing a voxelization map containing speed gradient parameters in a virtual environment, searching a global path planned on the map by adopting an improved A * algorithm, and processing a sliding step problem by adopting a distance attitude matching algorithm. Therefore, by improving the A * algorithm, the randomness of the role path-finding path is increased, the path contains more terrains, the path is richer, more role animations can be played, in addition, the attitude distance matching algorithm is invented to solve the sliding step problem, the quality of the role path-finding animation is improved, and the effect of playing the role path-finding animation is achieved. And the path-finding animation of the role in the virtual scene is richer and smoother.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of game pathfinding and game animation, and in particular to an animation pathfinding method and system based on posture distance matching. Background Art

[0002] In recent years, with the rapid development of the game industry, the market size of the game industry has continued to expand, and the number of game users has also increased exponentially, becoming a pastime for many people after work and study, which has not only created many jobs, but also brought a lot of huge economic value. With the improvement of game development technology and the development of game hardware equipment, gamers have higher and higher requirements for the quality of games. Among them, the quality of game animation is a very important part. For example, "Red Dead Redemption 2" produced by Rockstar San Diego Studio, "Sekiro: Shadows Die Twice" and "Elden Ring" produced by Japanese game developer From Software are famous for their smooth and efficient animation performance and outstanding gameplay, attracting a large number of game players. How to make the animation have a smoother and higher-quality performance has become an important part of game development. Large game companies have dedicated animation teams to design and produce game actions. On this basis, many animation production technologies have been derived to solve problems in animation production. One of the biggest problems is the sliding problem. Sliding often occurs in real human animations, especially in walking animations. People are particularly sensitive to the sliding phenomenon. As long as there is a little sliding phenomenon, the entire animation will completely lose its original realism. Therefore, in order to have an efficient animation performance, the sliding phenomenon must be avoided. In addition, many games involve the process of automatic pathfinding, and given a starting point and an end point, the character moves automatically, avoiding obstacles to reach the specified position. During this process, the character will automatically play the character animation. This process is generally just a simple loop of a running animation. Pathfinding is a frequent operation. The loop playback of a single animation makes the pathfinding process seem boring and lacks interest. The general way to deal with it is to reduce the player's pathfinding distance by adjusting the gameplay, or directly set a teleportation point. These methods only treat the symptoms and not the root cause, and the pathfinding process will still exist. Summary of the invention

[0003] In view of the shortcomings of the prior art, the present invention proposes an animation pathfinding method and system based on posture distance matching, which includes the steps of: constructing a voxelized map of a virtual environment containing speed and slope parameters, using an improved A* algorithm to search for a global path on the map, and using a distance posture matching algorithm to handle the sliding problem. The present invention is implemented through the following technical solutions:

[0004] The first aspect of the present invention is an animation pathfinding method based on posture distance matching, the method comprising the following steps:

[0005] S1: Voxelize the map based on the mesh generation algorithm in the Recast algorithm library;

[0006] S2: Detect each voxel. For voxels with a slope greater than a certain value, i.e., unreachable voxels, skip them directly; record the coordinates of the remaining reachable voxels; calculate speed information according to the different slopes of the voxel blocks, and after processing, add them to the finally processed map for subsequent queries;

[0007] S3: Optimize the problem of single search result of the A* pathfinding algorithm, so that different paths will be generated each time for the same starting point and ending point;

[0008] S4: Since the front and back postures of the character when stopping are not matched, the Jacobi method needs to be used to approximate the first frame posture when the stop animation starts playing. For non-linear transformations, the Jacobi matrix solves the position where a point moves to. Assuming that the joint rotates by a small angle t, the expression of the position change X is as follows:

[0009] X = J * t;

[0010] where J is the Jacobi matrix; invert J to get t = J -1 * X; Therefore, when 0 < X < 0.1, the rotation angle of the corresponding joint is obtained; then multiply each bone by this angle to get the position of each bone;

[0011] S5: By preprocessing the stop animation, handle the sliding step, and then generate a distance curve. The data meaning contained in this curve refers to the distance passed from each frame of the animation to the last frame. After the character stops moving input, the program calculates the end point where the character moves to according to the current speed, acceleration, friction, and other motion parameters. After obtaining the distance to the end point, query from which frame of the stop animation to play in the curve, so as to ensure that the animation just ends when moving to the end point.

[0012] Further, the step S3 specifically includes the following sub-steps:

[0013] (3.1) Design a pathfinding algorithm cost function, that is, in the heuristic algorithm, increase the reward for inflection points. Take the speed change as an inflection point. The more inflection points, the more rewards, and the higher the priority of searching for this point. And the number of terrain changes is increased in the target path to make the terrain more complex to match the need to play different animations;

[0014] (3.2) Optimize the selection of neighbor nodes, increase the randomness of selecting neighbor nodes with the same priority, increase the search range of neighbor nodes, not limited to the neighbors above, below, left, and right, add the retrieval of neighbor points in the upper left, lower left, upper right, and lower right, and also increase the randomness of the path;

[0015] (3.3) Finally, the processing of jump points is introduced to further increase randomness, speed up calculations, and optimize performance.

[0016] Furthermore, the calculation formula of the path finding algorithm cost function is as follows:

[0017] F(x)=G(x)+H(x);

[0018] Where x represents the navigation grid or pathfinding link currently being searched, F(x) is the weight calculated by the cost function, G(x) represents the distance from the pathfinding starting point to the searched path of x, and H(x) is the heuristic function of x.

[0019] Furthermore, the calculation formula of the heuristic function H(x) in step S3 is:

[0020]

[0021] Among them, V k Represents the speed of the character at that point, N k Represents the neighboring nodes of this point, MaxN(N k ) function is to return a queue, which contains some nodes with the largest slope changes among all neighboring nodes. The Rnd(x) function means to randomly pick a node from this queue.

[0022] Furthermore, the calculation formula of the Jacobi method in S4 is as follows:

[0023] t=J -1 *X;

[0024] Among them, J -1 Represents the inverse matrix of the Jacobian matrix, X is the offset of the movement to the target position, and t is the final angle that the bone needs to rotate.

[0025] The second aspect of the present invention provides an animation pathfinding system based on posture distance matching, which includes the following modules:

[0026] Voxelization map module: Based on the grid generation algorithm in the Recast algorithm library, the map is de-voxelized; each voxel is tested, and voxels with a slope greater than a certain value, i.e., unreachable voxels, are directly skipped; the coordinates of the remaining reachable voxels are recorded; the speed information is calculated according to the different slopes of the voxel blocks, and after processing, it is added to the final processed map for subsequent queries;

[0027] Pathfinding module: Optimize the problem of single search results of the A* pathfinding algorithm, so that different paths will be generated each time for the same starting point and ending point; Animation module: Move according to the path obtained by the pathfinding module. During the movement, according to the data information generated by the voxelized map module, play different pathfinding animations at different speeds.

[0028] Pose matching module: Since the front and back poses of the character do not match when stopping, the Jacobi method needs to be used to approximate the first frame pose when the stop animation starts playing. For non-linear transformations, the Jacobi matrix solves the position where a point is located after moving. Assuming that the joint rotates by a small angle t, the expression of the position change amount X is as follows:

[0029] X = J * t;

[0030] where J is the Jacobi matrix; Invert J to get t = J -1 * X; Therefore, when 0 < X < 0.1, the angle of rotation of the corresponding joint is obtained; Then multiply each bone by this angle to get the position of each bone.

[0031] Sliding step processing module: Process the sliding step by preprocessing the stop animation, and then generate a distance curve. The data meaning contained in this curve refers to the distance passed from each frame of the animation to the last frame of the animation. After the input of the character's stop movement, the program calculates the end point where the character moves according to the current speed, acceleration, friction and other movement parameters. After obtaining the distance from the current position to the end point, query from which frame of the stop animation to play in the curve, so as to ensure that the animation just ends when moving to the end point.

[0032] The third aspect of the present invention: An electronic device, including:

[0033] One or more processors;

[0034] A memory for storing one or more programs;

[0035] When the one or more programs are executed by the one or more processors, the one or more processors implement the described animation pathfinding method based on pose distance matching.

[0036] The fourth aspect of the present invention: A computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the described animation pathfinding method based on pose distance matching are implemented.

[0037] The beneficial effects of the present invention are as follows:

[0038] The present invention improves the A* algorithm to increase the randomness of the character's pathfinding path, so that the path contains more terrains, thereby making the path richer and able to play more character animations. In addition, a posture distance matching algorithm is invented to deal with the sliding problem, thereby improving the quality of the character's pathfinding animation and making the character's pathfinding animation in the virtual scene richer and more streamlined. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flow chart of the efficient path-finding animation system based on the posture distance matching algorithm of the present invention;

[0040] Figure 2 A voxelized map modeling diagram of the present invention;

[0041] Figure 3 A target path map obtained by an intelligent agent in a virtual game scene using the method of the present invention;

[0042] Figure 4 Animation matching diagram before and after the intelligent agent uses the method of the present invention to handle the sliding problem;

[0043] Figure 5 It is a schematic diagram of the system flow of the present invention. DETAILED DESCRIPTION

[0044] The present invention will be described in detail below according to the accompanying drawings and preferred embodiments, and the purpose and effect of the present invention will become more clear. The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0045] The present invention is based on an improved A* algorithm, and finds a path-finding route with randomness and rich terrain in a virtual game scene, thereby enriching the animation in the path-finding process; based on a posture distance matching algorithm, it specifies the frame from which the stop animation is executed, and provides a transition between the pre-stop animation and the stop animation, thereby solving the animation sliding problem.

[0046] like Figure 1 As shown, the specific implementation steps of an animation pathfinding method based on posture distance matching include:

[0047] Step 1: Devoxelize the map based on the mesh generation algorithm in the Recast algorithm library;

[0048] Step 2: Detect each voxel. For voxels with a slope greater than a certain value, i.e., unreachable voxels, they are skipped directly. For the remaining reachable voxels, their coordinates are recorded. According to the different slopes of the voxel blocks, the speed information is calculated. After processing, it is added to the final processed map for subsequent queries.

[0049] Step 3: Optimize the problem of single search results of the A* pathfinding algorithm, so that different paths are generated each time for the same starting point and ending point, increasing the diversity of paths and thus increasing the randomness of the game. To achieve this goal, design a cost function for the pathfinding algorithm, that is, in the heuristic algorithm, increase the reward for inflection points. Here, the speed change is regarded as an inflection point. The more inflection points, the more rewards, and the higher the priority of searching for this point. In this way, the number of terrain changes in the target path is increased, making the terrain more complex and matching the need to play different animations; The calculation formula of the pathfinding algorithm cost function is as follows:

[0050] F(x) = G(x) + H(x);

[0051] Among them, x represents the currently searched navigation grid or pathfinding link, F(x) is the weight calculated by the cost function, G(x) represents the distance of the searched path from the pathfinding starting point to x, and H(x) is the heuristic function of x.

[0052] The calculation formula of the heuristic function H(x) is:

[0053]

[0054] Among them, V k represents the speed of the character at this point, N k represents the neighbor nodes of this point. The function of MaxN(N k ) is to return a queue that contains some nodes with the largest slope change among all neighbor nodes. The Rnd(x) function represents randomly selecting a node from this queue.

[0055] Secondly, optimize the selection of neighbor nodes, increase the randomness of selecting neighbor nodes with the same priority, increase the search range of neighbor nodes, not limited to the neighbors above, below, left, and right, increase the retrieval of neighbor points in the upper left, lower left, upper right, and lower right, which also increases the randomness of the path to a certain extent. On this basis, introduce the processing of jump points to further increase randomness and speed up the calculation and optimize the performance;

[0056] Step 4: Due to the phenomenon that the front and back postures do not match when the character stops, use the Jacobi method to approximate the first frame posture when the stop animation starts to play. For non-linear transformations, the Jacobi matrix can solve the position obtained after a point moves a small distance. Then assume that when the joint rotates a small angle t, then the position change amount X can be obtained by X = J * t, where J is the Jacobi matrix. Then after taking the inverse of J, there is t = J -1 *X. After obtaining this equation, it can be obtained that when X is very small (when 0 < X < 0.1), we can obtain the rotation angle of the corresponding joint. Then multiply each bone by this angle to obtain the position where each bone is located;

[0057] Step 5: To deal with the sliding problem, pre-process the stop animation and generate a distance curve. The data contained in the curve means the distance traveled from each frame of animation to the last frame of animation. After the character stops moving, the program calculates the end point of the character based on the speed, acceleration, friction and other motion parameters at this time. After obtaining the current distance to the end point, the program queries the curve to find out which frame of the stop animation to play, so as to ensure that the animation ends when it reaches the end point.

[0058] like Figure 2 As shown, a voxelized grid map is generated based on the grid generation algorithm in the Recast algorithm library.

[0059] like Figure 3 As shown in the figure, the improved A* pathfinding algorithm finds a pathfinding route with randomness and rich terrain in the path:

[0060] like Figure 2 As shown, the three-dimensional coordinates are the starting point of the path, the capsule at ① is the end point of the path, the light gray grid in the map is flat land, the dark gray grid is an obstacle, and the grid at ② is a steep slope. Figure 3 The middle line is the final path finding path. It can be seen that this path contains all steep slope grids and is the shortest path with the richest terrain.

[0061] like Figure 4 The figure shows the posture change of the robot model before and after the posture distance matching algorithm is used.

[0062] like Figure 5 As shown, the second aspect of the present invention provides an animation pathfinding system based on posture distance matching, the system comprising the following modules:

[0063] Voxelization map module: Based on the grid generation algorithm in the Recast algorithm library, the map is de-voxelized; each voxel is tested, and voxels with a slope greater than a certain value, i.e., unreachable voxels, are directly skipped; the coordinates of the remaining reachable voxels are recorded; the speed information is calculated according to the different slopes of the voxel blocks, and after processing, it is added to the final processed map for subsequent queries;

[0064] Pathfinding module: optimizes the problem of single search result of A* pathfinding algorithm, so that different paths will be generated each time for the same starting point and end point; animation module: moves according to the path obtained by the pathfinding module, and during the movement, plays different pathfinding animations according to different speeds based on the data information generated by the voxel map module.

[0065] Pose matching module: Since the front and rear poses do not match when the character stops, the Jacobi method is needed to approximate the first frame pose when the stop animation starts to play. Specifically, the calculation formula of the Jacobi method is as follows:

[0066] t = J -1 *X;

[0067] where J -1 represents the inverse matrix of the Jacobi matrix, X is the offset moving towards the target position, and t is the final angle that the bone needs to rotate.

[0068] For non-linear transformation, the Jacobi matrix solves the position where a point is located after moving. Assuming the joint rotates by a small angle t, the expression of the position change X is as follows:

[0069] X = J * t;

[0070] where J is the Jacobi matrix; taking the inverse of J, we get t = J -1 *X; Therefore, when 0 < X < 0.1, the angle of rotation of the corresponding joint is obtained; then each bone is multiplied by this angle to get the position of each bone.

[0071] Sliding step processing module: By preprocessing the stop animation, the sliding step is processed, and then a distance curve is generated. The data meaning contained in this curve refers to the distance passed from each frame of the animation to the last frame of the animation. After the input of the character's stop motion, the program calculates the end point where the character moves according to the current speed, acceleration, friction, and other motion parameters. After obtaining the distance from the current position to the end point, it queries from which frame of the stop animation to play in the curve, so as to ensure that the animation ends exactly when the end point is reached.

[0072] The third aspect of the present invention: There is also provided an electronic device, including:

[0073] One or more processors;

[0074] A memory for storing one or more programs;

[0075] When the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned animation pathfinding method based on pose distance matching.

[0076] The fourth aspect of the present invention: A computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the above-mentioned animation pathfinding method based on pose distance matching are implemented.

[0077] Those skilled in the art can understand that the above are only preferred examples of the invention and are not intended to limit the invention. Although the invention is described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions recorded in the above examples or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, etc. made within the spirit and principle of the invention shall be included in the protection scope of the invention.

Claims

1. An animation pathfinding method based on posture distance matching, It is characterized in that The method comprises the following steps: S1: Devoxelize the map based on the mesh generation algorithm in the Recast algorithm library; S2: Detect each voxel, skip voxels with a slope greater than a certain value, i.e., unreachable voxels; record the coordinates of the remaining reachable voxels; calculate the speed information according to the different slopes of the voxel blocks, and add it to the final processed map after processing for subsequent queries; S3: Optimize the problem of single search result of A* pathfinding algorithm so that different paths will be generated each time with the same starting point and end point; S4: Since the character's front and back postures do not match when it stops, the Jacobi method is used to approximate the first frame posture when the stop animation starts playing. For nonlinear transformations, the Jacobi matrix solves the position of a point after it moves. Assuming that the joint rotates a small angle t, the expression of the position change X is as follows: X = J*t; where J is the Jacobian matrix; the inverse of J is calculated to obtain t = J -1 *X; thus, when 0 < X < 0.1, the corresponding joint rotation angle is obtained; then each bone is multiplied by this angle to obtain the position where each bone is located; S5: Pre-process the stop animation and process the sliding step to generate a distance curve. The data contained in the curve means the distance traveled from each frame of animation to the last frame of animation. After the character stops moving, the program calculates the end point of the character according to the speed, acceleration, friction and other motion parameters at that time. After obtaining the current distance to the end point, it queries the curve to find which frame of the stop animation to play, so as to ensure that the animation ends when it moves to the end point.

2. The animation pathfinding method based on posture distance matching according to claim 1, It is characterized in that The step S3 specifically includes the following sub-steps: (3.1) Design the cost function of the pathfinding algorithm. That is, in the heuristic algorithm, increase the reward of the turning point and take the speed change as the turning point. The more turning points there are, the more rewards there are, and the higher the priority of searching for the point is. In addition, the number of terrain changes is increased in the target path, making the terrain more complex to match the need to play different animations. (3.2) Optimize the selection of neighbor nodes, increase the randomness of the selection of neighbor nodes with the same priority, expand the search range of neighbor nodes, not limited to the upper, lower, left, and right neighbors, and increase the search of the upper left, lower left, upper right, and lower right neighbor points, which also increases the randomness of the path; (3.3) Finally, the processing of jump points is introduced to further increase randomness, speed up calculations, and optimize performance.

3. The animation pathfinding method based on posture distance matching according to claim 2, It is characterized in that The calculation formula of the path finding algorithm cost function is as follows: F(x)=G(x)+H(x); Where x represents the navigation grid or pathfinding link currently being searched, F(x) is the weight calculated by the cost function, G(x) represents the distance from the pathfinding starting point to the searched path of x, and H(x) is the heuristic function of x.

4. The animation pathfinding method based on posture distance matching according to claim 3, It is characterized in that The calculation formula of the heuristic function H(x) in step S3 is: Among them, V k Represents the speed of the character at that point, N k Represents the neighboring nodes of this point, MaxN(N k ) function is to return a queue, which contains some nodes with the largest slope changes among all neighboring nodes. The Rnd(x) function means to randomly pick a node from this queue.

5. The animation pathfinding method based on posture distance matching according to claim 4, It is characterized in that The Jacobi method calculation formula in step S4 is as follows: t=J -1 *X; Among them, J -1 Represents the inverse matrix of the Jacobian matrix, X is the offset of the movement to the target position, and t is the final angle that the bone needs to rotate.

6. An animation pathfinding system based on posture distance matching, It is characterized in that The system includes the following modules: Voxelization map module: Based on the grid generation algorithm in the Recast algorithm library, the map is de-voxelized; each voxel is tested, and voxels with a slope greater than a certain value, i.e., unreachable voxels, are directly skipped; the coordinates of the remaining reachable voxels are recorded; the speed information is calculated according to the different slopes of the voxel blocks, and after processing, it is added to the final processed map for subsequent queries; Pathfinding module: optimizes the single search result problem of A* pathfinding algorithm, so that the same starting point and end point will generate different paths each time; animation module: moves according to the path obtained by the pathfinding module. During the movement, different pathfinding animations are played according to different speeds based on the data information generated by the voxel map module; Posture matching module: Since the previous and next postures of the character do not match when it stops, the Jacobi method is used to approximate the first frame posture when the stop animation starts playing. For nonlinear transformation, the Jacobi matrix solves the position of a point after it moves. Assuming that the joint rotates a small angle t, the expression of the position change X is as follows: X = J*t; where J is the Jacobian matrix; the inverse of J is calculated to obtain t = J -1 *X; thus, when 0 < X < 0.1, the corresponding joint rotation angle is obtained; then each bone is multiplied by this angle to obtain the position where each bone is located; Slide processing module: By pre-processing the stop animation, the slide is processed to generate a distance curve. The data contained in the curve means the distance traveled from each frame of animation to the last frame of animation. After the character stops moving, the program calculates the end point of the character based on the speed, acceleration, friction and other motion parameters at that time. After obtaining the current distance to the end point, it queries the curve to which frame of the stop animation to play, so as to ensure that the animation ends when it reaches the end point.

7. An electronic device, It is characterized in that include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement an animation pathfinding method based on posture distance matching as described in any one of claims 1-5.

8. A computer-readable storage medium having computer instructions stored thereon, It is characterized in that When the instruction is executed by the processor, the steps of an animation pathfinding method based on posture distance matching as described in any one of claims 1-5 are implemented.