Disclosure of Invention
The invention provides a method for generating a world-place action based on an in-place action, which is used for solving the defects in the prior art.
The invention is realized by the following technical scheme:
a method for generating a world-place action based on an in-place action, comprising the steps of:
step one: preprocessing frame data: first, joint global motion data is calculated from joint local motion data.
The method of calculating global data from local data is as follows:
P global =R father P local +P father
R global =R father *R local
wherein P is global Is to calculate global displacement of the joint, R global To calculate the global attitude rotation value of the joint, R father Is global attitude rotation value, P of father joint father For global displacement of the parent joint, P local To calculate the local displacement data of the joint under the father joint, R local To calculate the local pose rotation value of the joint under the parent joint. Global data of all joints are recursively calculated.
Step two, a step two is carried out; based on the first ground assumption that each frame of motion accords with ground constraint, generating displacement data of all frames, and discretizing to calculate the acceleration and acceleration derivative of the generated pelvis joint, wherein the calculation formula is as follows:
where P represents pelvis displacement, v represents velocity, a represents acceleration,representing the derivative of acceleration, frameRate representing the animation data frame rate;
step three: judging whether the current frame is a jump starting frame, if not, outputting a result, if so, starting to change a state from the frame, traversing a cache to identify a jump landing frame, and calculating pelvis joint displacement of a jump frame sequence according to the duration of the start and stop frame and the acceleration and speed of the start frame;
calculating the ground free constraint according to the start and stop frame acceleration and speed:
wherein P is n For displacement of the pelvis joint of the nth frame during no ground constraint,and->The resolved displacements of the pelvis joint in the vertical and horizontal planes, respectively. />And->Respectively representing the horizontal displacement and the velocity of the pelvis joint of the start frame of the non-ground-constrained process, t representing the offset time from the start frame of the non-ground-constrained process to the nth frame,and->Respectively representing the displacement and the velocity of the initial frame pelvis joint in the vertical direction of the ground free constraint process, and g represents the standard gravitational acceleration.
In the method for generating the world-plan action based on the in-plan action, the caching principle in the first step is that 18 frames are needed for 30 frames/second of animation caching, and 36 frames are needed for 60 frames/second of animation data caching.
The method for generating the world-place action based on the in-place action as described above, wherein the pelvis displacement of each frame in the second step may be expressed as:
in the third step, the jump start and stop frame is judged by using the acceleration value and the acceleration derivative of the pelvis joint, and the judgment formula is as follows:
wherein a is n For the acceleration of the nth frame pelvis joint generated in step one,is the derivative of acceleration for the nth frame. a, a 0 And d 0 Respectively counting the obtained acceleration detection threshold value and the acceleration derivative detection threshold value, and counting the obtained acceleration detection threshold value and the obtained acceleration derivative detection threshold value when a is 0 =32.5、d 0 When=15, the best detection effect is achieved.
If f (a) n )>0, then indicates that the frame is ground constrained, if f (a n )>0 indicates that the frame is in an unconstrained state.
The invention has the advantages that: the invention provides a method for generating a world-position from an in-position. The method solves the bottleneck problem that the accurate motion displacement according with physics requires manual production: and generating the world-position data with the physical rule from the in-position action in real time.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1, a method for generating a world-place action based on an in-place action includes the following steps:
step one: preprocessing frame data: first, joint global motion data is calculated from joint local motion data.
The method of calculating global data from local data is as follows:
P global =R father P local +P father
R global =R father *R local
wherein R is global Is to calculate global displacement of the joint, R global To calculate the global attitude rotation value of the joint, R father Is global attitude rotation value, P of father joint father For global displacement of the parent joint, P local To calculate the local displacement data of the joint under the father joint, R local To calculate the local pose rotation value of the joint under the parent joint. Global data of all joints are recursively calculated.
Step two, a step two is carried out; based on the first ground assumption that each frame of motion accords with ground constraint, generating displacement data of all frames, and discretizing to calculate the acceleration and acceleration derivative of the generated pelvis joint, wherein the calculation formula is as follows:
where P represents pelvis displacement, v represents velocity, a represents acceleration,representing the derivative of acceleration, frameRate representing the animation data frame rate;
step three: judging whether the current frame is a jump starting frame, if not, outputting a result, if so, starting to change a state from the frame, traversing a cache to identify a jump landing frame, and calculating pelvis joint displacement of a jump frame sequence according to the duration of the start and stop frame and the acceleration and speed of the start frame;
calculating the ground free constraint according to the start and stop frame acceleration and speed:
wherein P is n For displacement of the pelvis joint of the nth frame during no ground constraint,and->The resolved displacements of the pelvis joint in the vertical and horizontal planes, respectively. />And->Respectively representing the horizontal displacement and the velocity of the pelvis joint of the start frame of the non-ground-constrained process, t representing the offset time from the start frame of the non-ground-constrained process to the nth frame,and->Respectively representing the displacement and the velocity of the initial frame pelvis joint in the vertical direction of the ground free constraint process, and g represents the standard gravitational acceleration.
Specifically, in the first step described in this embodiment, the buffering principle is that 18 frames are required for buffering 30 frames/second of animation, and 36 frames are required for buffering 60 frames/second of animation data. The motion of the human body is limited by natural attributes, the motion is limited, the dead time of most human body motion is less than 0.6s through data analysis, the data is used as standard to design the frame buffer length, the buffer of the animation of 30 frames/second needs 18 frames, the buffer of the animation of 60 frames/second needs 36 frames, and the like if the number of frames per second increases.
Specifically, the pelvis displacement of each frame in the second step described in this embodiment may be expressed as:
preferably, the above formula for determining pelvis displacement is derived as follows:
the invention proposes the assumption based on the observation of data and the analysis of realistic physical actions: all movements supported by the lower limbs are produced by the foot as a point of force. According to this assumption, there are three situations in which the ground is in contact, namely, no ground constraint, one-foot ground constraint, and two-foot ground constraint. Several studies have also proposed similar assumptions and used machine learning methods to classify frames of in-place motion to identify several constraints. However, this classification is limited by statistical methods, which make it difficult to achieve near 100% accuracy, and thus the final effect is limited to specific actions such as walking. Through analysis, the invention can obtain a new conclusion, greatly reduce the workload of the problem, and remarkably improve the calculation speed to realize real-time operation.
The problem of "wane" switching of the sole is ignored first, and the animation segments all start in a standing position, so that frame 1 is a double-foot ground constraint. Let the coordinates of the joints of the left and right feet be respectively the sumThen in frame 2, three cases constraint scenarios are possible. Assuming frame 2 is still a bipedal constraint, then +.> Remain unchanged; if the 2 nd frame is a single foot constraint, there are two possibilities that the left foot remains constrained, then the left foot position remains +.>The right foot position is obtained according to the left foot constraint and by using other calculation methods, if the right foot keeps the constraint position +.>The left foot position can be calculated using the same method; if the 2 nd frame is free of ground constraint, calculating the position according to the frame before taking off, and supposing that the pelvis joint movement is calculated according to the calculated frame sequenceSpeed is +.>The position of the pelvis joint of the second frame is +.>The synthesis can be expressed as:
wherein the method comprises the steps ofAnd->The vectors of the root joint to the pelvis joint are represented respectively, and α and β represent weighting coefficients, the sum of which is 1. Because in-place motion is a trusted correct action, therefore +.>And->Is equal, in which case the bipedal constraint may be expressed in the form of a monopedal constraint. Thus equation (1) can be expressed as:
each frame depends on the position of the previous frame, the position of the N frame depends on the N-1 frame, and the frame always falls over
Push to frame 0. Derived from this precondition to all frames:
in addition, regarding the "rocker" problem of the sole, the "rocker" is a metaphor description of the sole of a human body, and as shown in fig. 2, the human foot is often abstract in a virtual space to be a connection relationship as illustrated.
The foot joint is not in direct contact with the ground, and the displacement is indirectly obtained through the constraint of the heel or toe joint and the ground. There are also three possibilities for ground constraint, just toe joint ground constraint, just heel joint ground constraint or toe and heel simultaneous ground constraint, respectively. Can be expressed as:
wherein the method comprises the steps ofAnd->Is consistent and can therefore be expressed as:
in the process of contacting the sole of the foot with the ground, most of the foot and heel are simultaneously contacted with the ground constraint, and the toe joint single joint constraint can be used for replacing calculation. Through statistics, the situation of individual ground constraint of the heel joint is often in the conversion process of two types of constraint, and the constraint is unstable, so that the joint can be quickly transited to the toe and heel joint common ground constraint or the toe individual ground constraint. The ground constraint of the heel joint can be ignored and treated as either unconstrained or the toe joint alone ground constraint. The formula is:
。
the treatment effect is good through experiments, the generated displacement is not adversely affected, and
the calculation process and the judgment of state switching are greatly simplified.
The preprocessing of in-place motion data in the second step of the invention is based on an assumption that: assume that each frame action belongs to a ground constraint. From the above deduction that each frame belongs to the order of the monopod
A bundle. Thus, the displacement of each frame can be expressed as:
further, in the third step described in this embodiment, the jump start and stop frame is determined by using the acceleration value and the derivative of the acceleration of the pelvis joint, and the determination formula is as follows:
if f (a) 0 )>0, then indicates that the frame is ground constrained, if f (a 0 ) And less than or equal to 0 indicates that the frame is in an unconstrained state.
Preferably, the human body movement needs to conform to the physical laws, and the movement of the pelvis joint is derived from interaction of the foot and the ground. Jumping of the human body requires a force accumulation and landing also requires a buffer to unload the force, so the motion acceleration of pelvis should be smooth according to newton's law. In the step one preprocessing, it is assumed that all motions belong to the ground constraint, and if the frame motion data does not conform to the ground constraint, the pelvis joint acceleration is necessarily not smooth. The skipped frame sequence can thus be determined by analyzing the acceleration of the pelvis joint of the data that completes the step one preprocessing. From a large number of statistical data and mathematical calculations we have found a method for determining the jump start and stop frames by determining the acceleration value and the acceleration derivative of the pelvis joint, expressed by the formula:
wherein a is n For the acceleration of the nth frame pelvis joint generated in step one,is the derivative of acceleration for the nth frame. a, a 0 And d 0 Respectively counting the obtained acceleration detection threshold value and the acceleration derivative detection threshold value, and counting the obtained acceleration detection threshold value and the obtained acceleration derivative detection threshold value when a is 0 =32.5、d 0 When=15, the best detection effect is achieved.
If f (a) n )>0, then indicates that the frame is ground constrained, if f (a n )>0 indicates that the frame is in an unconstrained state.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solution of the present invention, and not limiting thereof; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.