Animation simulation method and system for sampling different motion attributes of object
By sampling the object's motion properties, generating a keyframe queue and optimizing collision detection, the problems of complex animation simulation and single function in the existing technology are solved, and efficient animation simulation and stable operation in complex scenes are achieved.
Patent Information
- Application Number
- CN202510848698.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-09-09
AI Technical Summary
Existing real-time animation simulation is relatively complex to implement, with single functions, and is unable to cope with complex engineering needs.
By establishing a scene manager, animation manager, instruction parsing module, keyframe container, sampler and collision detection module, animation scenes are generated and managed, linear and parabolic interpolation algorithms are used to calculate motion attribute values, and collision detection is optimized by combining bounding boxes and BVH trees.
It improves the efficiency and stability of animation simulation, can cope with complex engineering requirements, and optimizes resource utilization and collision detection efficiency.
Smart Images

Figure CN120611526A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional simulation technology, and in particular to an animation simulation method and system for sampling different motion properties of an object. Background Art
[0002] In existing technologies, real-time animation simulation is complex to implement, and most applications are limited to a specific area, making it difficult to meet increasingly complex engineering requirements. For example, Chinese invention patent publication number CN118114436A discloses a dark factory simulation system and method based on Unreal Engine. This system renders a 3D factory simulation model to give users an impression of the factory design, but its functionality is relatively limited. Chinese invention patent publication number CN104504170A discloses a vehicle animation simulation method and system. The method includes acquiring traffic data and, based on this traffic data, simulating traffic flow behavior, wherein the vehicle flow behavior is determined based on the impact of the vehicle ahead in the current lane and the vehicles ahead in the left and right neighboring lanes on the vehicle at the current position; constructing a lane change model, and using this lane change model to determine whether a feasible lane change trajectory exists for the vehicle at the current position; and combining this lane change trajectory with the traffic flow behavior simulation to complete the vehicle animation simulation. While this solution can simulate traffic flow behavior and lane change trajectories, improving simulation fidelity and accuracy, it also suffers from the problem of a single application scenario.
[0003] Therefore, a new technical solution is urgently needed to solve the above technical problems. Summary of the Invention
[0004] The purpose of the present invention is to overcome the above-mentioned problems of the prior art and provide an animation simulation method and system for sampling different motion properties of an object, so as to solve the technical problems that the existing real-time animation simulation is relatively complex to implement, most of the functions are relatively single, can only be applied in a certain direction, and is difficult to cope with increasingly complex engineering needs.
[0005] The above objectives are achieved through the following technical solutions: An animation simulation method for sampling different motion properties of an object, comprising: Step (1) Building the scene: Create a scene manager object to manage the simulation animation scene, including setting scene lighting, loading models, distinguishing between static and moving models, setting model color and material properties, and performing operations such as removing, showing, or hiding models; Step (2) recording the bounding box data of the model: reading the bounding box data from the user configuration file or calculating the bounding box data through the model geometric features, and associating it with the animation model; Step (3) Animation manager initialization: record the model's initial state information and set the animation time to 0; Step (4) parsing the animation instruction information of the model: calling the instruction parsing module to convert the user-generated instructions into a standard format and then generate keyframe information; Step (5) Generate key frame data of the animation model: save all key frame queues in the model animation process in the key frame container, sorted by time, and different attributes correspond to different key frame queues; Step (6) Calculate the total animation time: determine the duration of the complete animation execution cycle based on the key frame data; Step (7) Start the timer to update the animation time: the animation manager updates the model attributes in the animation scene according to the time change; Step (8) Motion attribute sampling: the sampler inputs time t and calculates the corresponding motion attribute value through linear or parabolic interpolation algorithm; Step (9) Collision detection: The collision detection module uses the model bounding box data and the displacement information obtained by sampling to calculate the model bounding box data corresponding to the specified time t; Step (10) Update animation: Call the scene manager to update the scene view according to the sampling results, set the custom animation refresh frequency, and highlight the objects that are detected to be in collision.
[0006] As an optimization of this method, the key frame data of the animation model is generated in step (5), the displacement data is in matrix form, the color is expressed in RGB, and the object shape is described by parametric equations.
[0007] As an optimization of this method, the corresponding motion attribute value is calculated by the linear interpolation algorithm described in step (8), and the formula is as follows: q t =q 0 +k(q 1 -q 0 ) Where, q t is the value at the current moment; q 0 is the value of the previous frame; q 1 is the value of the next frame; k is a coefficient, calculated through time, as follows: k=t-t0 / t1-t0 Where t is the current time, t0 is the time corresponding to the previous frame, and t1 is the time corresponding to the next frame.
[0008] As an optimization of this method, the corresponding motion attribute value is calculated by the parabolic interpolation algorithm in step (8), and the formula is as follows: ; Where, q t is the current value, q 0 is the value of the previous frame, q 1 is the value at the middle moment, q2 is the value of the next frame, t is the current time, t0 is the time corresponding to the previous frame, t1 is the time corresponding to the middle moment, and t2 is the time corresponding to the next frame.
[0009] As an optimization of this method, the collision detection in step (9) includes: Before the animation starts, obtain the model geometry information or measure it through external software to obtain the AABB and OBB bounding box data of the initial position; During the simulation, the key frames are sampled through the sampling module, the displacement transformation matrix at the current moment is calculated, and homogeneous coordinates are used to represent translation and rotation motion; Apply the displacement transformation matrix to the model bounding box to calculate the actual bounding box data at the current moment; The separating axis algorithm is used to calculate whether the bounding box of the current object interferes with other objects, and is implemented using the opencascade or fcl collision detection library.
[0010] As an optimization of this method, the separating axis algorithm is specifically as follows: if two polygons do not intersect on any projection axis, they do not collide; if they intersect on all projection axes, they collide.
[0011] As an optimization of this method, in simulation scenarios with a large number of models, a BVH tree of bounding boxes is constructed to reduce the complexity of collision detection to logarithmic level; for objects with changed shape, the mesh is discretized into triangular facets and then the bounding boxes are calculated.
[0012] An animation simulation system for sampling different motion properties of an object, comprising: Scene Manager: used to create scene manager objects and manage simulation animation scenes, including setting scene lighting, loading models, distinguishing between static and moving models, setting model color and material properties, and performing operations such as removing, showing, or hiding models; Animation Manager: used to record the initial state information of the model during initialization, set the animation time to 0, and update the model properties in the animation scene according to the time change of the timer update; Instruction parsing module: used to convert user-generated instructions into a standard format and then generate keyframe information; Keyframe container: used to save all keyframe queues in the model animation process, sorted by time, with different attributes corresponding to different keyframe queues; Sampler: used to sample the model's motion attributes, input a specified time t, and output the corresponding motion attribute value; Collision detection module: used to calculate the model bounding box data corresponding to the specified time t using the model bounding box data and the displacement information obtained by sampling, and detect collisions using the separating axis algorithm; Timer: used to update animation time.
[0013] As an optimization of this system, the collision detection module includes a bounding box generation unit and a collision detection algorithm unit. The bounding box generation unit is used to obtain model geometric information or obtain bounding box data through external software measurement. The collision detection algorithm unit is used to detect collisions using a separating axis algorithm and construct a BVH tree to optimize detection efficiency in scenes with a large number of models.
[0014] As an optimization of this system, a view display module is also included, which is used to update the scene view according to the sampling results and highlight the objects that are detected to have collided.
[0015] The present invention provides an animation simulation method and system for sampling different motion attributes of an object. The key frames are expanded. In addition to displacement information, color, visibility, and morphological key frames are added, which are stored in different key frame containers and sampled separately using independent sampler modules. At the same time, the model is distinguished into a scene model (static model) and an animation model, and a conversion mechanism is provided to reduce unnecessary resource consumption and distinguish between scenes. Bounding box information is introduced into the model, a collision detection module is added, and an algorithm node for BVH tree generation is provided, which can greatly improve the efficiency of collision detection when dealing with complex collision detection scenarios. This solution makes the structure of the entire system clearer and more reasonable, facilitates use and maintenance by developers, and also optimizes the efficiency and stability of the simulation animation. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flow chart of an animation simulation method for sampling different motion attributes of an object according to the present invention; Figure 2 This is a framework diagram of an animation simulation system for sampling different motion properties of an object as described in the present invention. DETAILED DESCRIPTION
[0017] The present invention will be further described in detail below with reference to the accompanying drawings and examples. The described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort shall fall within the scope of protection of the present invention.
[0018] like Figure 1As shown in the figure, this solution provides an animation simulation method for sampling different motion properties of an object. The core concept is to generate a keyframe queue based on the displacement, color, shape, visibility and other properties of the model. The sampling module is used to sample the keyframes so that the simulation image can be obtained at any time. It includes: Step (1) Setting up the scene: Establishing a scene manager object to manage the simulation animation scene, including setting scene lighting, loading models, distinguishing between static and moving models, setting model colors and material properties, and performing operations such as removing, showing, or hiding models. In this embodiment, a scene manager object is established to comprehensively manage the entire simulation animation scene. Specifically, the scene lighting is set to create a suitable visual environment; the models required for the simulation process are loaded from the file, and the static models and moving models are clearly distinguished; the corresponding colors and material properties are set for different models to make the model visual effects more realistic; and operations such as removing specified models, showing and hiding models in the scene are flexibly performed according to actual needs to achieve dynamic management of the scene.
[0019] Step (2) Recording the bounding box data of the model: The bounding box data is read from the user configuration file or calculated using the model's geometric features, and then associated with the animation model. In this embodiment, there are two ways to obtain the bounding box data: either directly reading from the user-configured file or calculating it using the model's geometric features. After obtaining the bounding box data, it is associated with the corresponding animation model to provide basic data for subsequent collision detection.
[0020] Step (3) Animation manager initialization: record the model's initial state information and set the animation time to 0. During the initialization process, this embodiment records the model's initial state information in detail, including the model's position, posture, color and other attributes, and initially sets the animation time to 0 to prepare for the start of the animation.
[0021] Step (4) Parsing the model's animation instruction information: The instruction parsing module is called to convert the user-generated instructions into a standard format and then generate keyframe information. In this embodiment, the instruction parsing module is called to convert the instructions generated by the user in various forms according to different business scenarios into a unified standard format. After the format conversion is completed, the keyframe information is generated based on the standard format to provide key data support for the generation of the animation.
[0022] Step (5) Generate keyframe data for the animation model: All keyframe queues during the model animation process are stored in a keyframe container, sorted by time, with different attributes corresponding to different keyframe queues. In this embodiment, the keyframe container carefully stores all keyframe queues during the model animation process, and these keyframe queues are strictly sorted in chronological order. Different attributes, such as displacement, color, and shape, correspond to different keyframe queues, such as displacement keyframe queue, color keyframe queue, and shape keyframe queue, to ensure that the animation data of each attribute is stored in an orderly manner.
[0023] Step (6) Calculate the total animation time: Determine the duration of a complete animation execution cycle based on the key frame data. In this embodiment, the total duration of the animation is determined by analyzing and calculating the time information of all key frame data, providing a basis for the time control of the animation.
[0024] Step (7) Start the timer to update the animation time: The animation manager updates the model attributes in the animation scene according to the time change. In this embodiment, the timer is started to update the animation time according to the set rules. The animation manager updates the model attributes in the animation scene in real time according to the time change, ensuring that the animation is played correctly in the chronological order.
[0025] Step (8) Motion attribute sampling: The sampler inputs the time t and calculates the corresponding motion attribute value through a linear or parabolic interpolation algorithm. In this embodiment, the sampler is responsible for sampling the model's motion attributes, and corresponding samplers are established for different motion attributes. The sampler inputs the specified time t and, through a specific algorithm and data processing, outputs the precise motion attribute value corresponding to time t, achieving real-time acquisition of the model's motion state.
[0026] Step (9) Collision Detection: The collision detection module uses the model bounding box data and the displacement information obtained by sampling to calculate the model bounding box data corresponding to the specified time t. In this embodiment, the collision detection module accurately calculates the model bounding box data corresponding to the specified time t based on the previously generated model bounding box data and the model displacement information obtained by sampling. Professional algorithms such as the separating axis algorithm are used to determine whether the current model bounding box interferes with other objects. If a collision is detected, a signal is provided for subsequent processing.
[0027] Step (10) Update animation: Call the scene manager to update the scene view based on the sampling results, set the custom animation refresh frequency, and highlight the objects that are detected to be in collision. Specifically, call the scene manager to update the current scene view based on the sampling results. Because different moments correspond to different simulation images, in order to ensure the continuity and smoothness of the images, it is necessary to set a reasonable animation refresh frequency value (FPS), generally in the range of 20 to 50. For objects that are detected to be in collision, call the highlight function module in the scene manager to highlight them so that users can intuitively identify the collision situation.
[0028] In step (5) of this method, the key frame data of the animation model is generated, the displacement data is in matrix form, the color is expressed in RGB, and the object shape is described by parametric equations.
[0029] The core of object-based motion attribute sampling is to generate a keyframe queue based on the object's motion attributes and sample from different attributes according to the time input by the user.
[0030] Therefore, to obtain the raw sampled data, we first need to generate a keyframe queue. Since the motion attribute data for each object may be different, each model requires a series of keyframe queues, each corresponding to a specific motion attribute of the object. This also facilitates the expansion of motion attributes. If there are other requirements in the future, we only need to add more keyframe queues, greatly improving the scalability of the system.
[0031] Specifically, the data of the key frame is generated by motion instructions, such as displacement instructions, color instructions, shape instructions, etc. These data are stored in the memory in a simple and intuitive way to facilitate subsequent sampling. The displacement data is in the form of a matrix, which makes it convenient to unify the translation and selection movements. The color can be expressed in the general RGB method. The expression of the object shape is more complex and can be described by parametric equations and other methods according to actual needs.
[0032] During the sampling process, the object's motion properties need to be interpolated. The current time t is input, the data stored in the two adjacent keyframes before and after are found, and the interpolation function is called to calculate the data at the current moment. Common interpolation algorithms include linear interpolation and parabolic interpolation.
[0033] 1. The characteristic of linear interpolation is that it maintains a uniform speed of change. When applied to position, it is a uniform movement or rotation. When applied to color, it is a uniform color gradient. Its calculation formula is as follows: q t =q 0 +k(q 1 -q 0) Where, q t is the value at the current moment; q 0 is the value of the previous frame; q 1 is the value of the next frame; k is a coefficient, calculated through time, as follows: k=t-t0 / t1-t0 Where t is the current time, t0 is the time corresponding to the previous frame, and t1 is the time corresponding to the next frame.
[0034] 2. Parabolic interpolation is a second-order polynomial interpolation method. The variations between points are non-uniform, which can produce a variable speed effect. Its characteristic is constant acceleration / deceleration. To avoid the resource consumption caused by solving equations, the parabolic interpolation formula can be formed by a linear combination of three quadratic interpolation basis functions, as follows: ; Where, q t is the current value, q 0 is the value of the previous frame, q 1 is the value of the intermediate moment, q2 is the value of the next frame, t is the current time, t0 is the time corresponding to the previous frame, t1 is the time corresponding to the intermediate moment, and t2 is the time corresponding to the next frame. By specifying the intermediate moment t1 and the corresponding value q 1 You can get the value corresponding to the current time.
[0035] In actual animation simulation, physical simulation is also a very important part. Through collision detection, we can dynamically detect other components that collide and interfere with it, so that we can make a more accurate evaluation of the design plan and make modifications and optimizations in time to achieve the purpose of early prediction and risk avoidance. Therefore, this system also integrates a collision detection module: 1. Before the animation starts, the model bounding box data of the initial position is measured through the model's geometric information or external software, mainly including AABB and OBB bounding boxes; 2. During the simulation process, the key frames are sampled through the sampling module to calculate the displacement transformation matrix at the current moment. In order to unify the representation and calculation of motion, the homogeneous coordinate method can be used. The calculation process is as follows: The representation of translational motion in three-dimensional homogeneous coordinates is as follows: , The representation of rotational motion in three-dimensional homogeneous coordinates is as follows, where a, b, and c are the rotation angles around the X, Y, and Z axes: , According to the actual motion data, the position transformation matrix M of the object can be obtained: M = Mt1*Mt2*…Mr1*Mr2*…; The new position p1 of the object can be obtained by multiplying the initial position p with the displacement matrix: p1= M*p; 3. Apply the calculated displacement transformation matrix to the bounding box of the model to calculate the actual bounding box data at the current moment. Assume that the center of the initial bounding box is b, then the new bounding box center b1 is: b1 = M*b; 4. Use the separating axis algorithm to calculate whether the bounding box of the current object interferes with other objects. This function can be implemented using collision detection libraries such as opencascade or fcl.
[0036] The core idea is: if two polygons do not intersect on any projection axis, then they do not collide. If they intersect on all projection axes, then they collide. For the bounding boxes of two objects (usually OBB bounding boxes), I can use their edges as projection axes, then project the vertices of the two OBBs onto these axes, and check one by one whether the projections intersect. The specific steps are as follows: 1). Calculate the sides of the two rectangles (that is, the normal vector of each side) as the projection axis.
[0037] 2). Project the vertices of the rectangle onto these axes.
[0038] 3). Check whether the projections intersect. If the projections do not intersect on any axis, there is no collision.
[0039] In simulation scenarios with a large number of models, a bounding box BVH tree can be constructed first to reduce the complexity of collision detection to a logarithmic level, thereby optimizing collision detection efficiency. For objects with changing shapes, meshing can be used to discretize them into a certain number of triangles, and then the bounding box of the object can be calculated.
[0040] like Figure 2 As shown, this solution also provides an animation simulation system for sampling different motion properties of an object, including: Scene Manager: used to create scene manager objects and manage simulation animation scenes, including setting scene lighting, loading models, distinguishing between static and moving models, setting model color and material properties, and performing operations such as removing, showing, or hiding models; Animation Manager: used to record the initial state information of the model during initialization, set the animation time to 0, and update the model properties in the animation scene according to the time change of the timer update; Instruction parsing module: used to convert user-generated instructions into a standard format and then generate keyframe information; Keyframe container: used to save all keyframe queues in the model animation process, sorted by time, with different attributes corresponding to different keyframe queues; Sampler: used to sample the model's motion attributes, input a specified time t, and output the corresponding motion attribute value; Collision detection module: used to calculate the model bounding box data corresponding to the specified time t using the model bounding box data and the displacement information obtained by sampling, and detect collisions using the separating axis algorithm; Timer: used to update animation time.
[0041] The collision detection module of this system includes a bounding box generation unit and a collision detection algorithm unit. The bounding box generation unit is used to obtain model geometric information or obtain bounding box data through external software measurement. The collision detection algorithm unit is used to detect collisions using a separating axis algorithm and construct a BVH tree to optimize detection efficiency in scenes with a large number of models.
[0042] The system also includes a view display module for updating the scene view according to the sampling results and highlighting the objects detected to be in collision.
[0043] The above description is only for explaining the embodiments of the present invention and is not intended to limit the present invention. For those skilled in the art, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. An animation simulation method and system for sampling different motion properties of an object, characterized in that: include: Step (1) Building the scene: Create a scene manager object to manage the simulation animation scene, including setting scene lighting, loading models, distinguishing between static and moving models, setting model color and material properties, and performing operations such as removing, showing, or hiding models; Step (2) recording the bounding box data of the model: reading the bounding box data from the user configuration file or calculating the bounding box data through the model geometric features, and associating it with the animation model; Step (3) Animation manager initialization: record the model's initial state information and set the animation time to 0; Step (4) parsing the animation instruction information of the model: calling the instruction parsing module to convert the user-generated instructions into a standard format and then generate keyframe information; Step (5) Generate key frame data of the animation model: save all key frame queues in the model animation process in the key frame container, sorted by time, and different attributes correspond to different key frame queues; Step (6) Calculate the total animation time: determine the duration of the complete animation execution cycle based on the key frame data; Step (7) Start the timer to update the animation time: the animation manager updates the model attributes in the animation scene according to the time change; Step (8) Motion attribute sampling: the sampler inputs time t and calculates the corresponding motion attribute value through linear or parabolic interpolation algorithm; Step (9) Collision detection: The collision detection module uses the model bounding box data and the displacement information obtained by sampling to calculate the model bounding box data corresponding to the specified time t; Step (10) Update animation: Call the scene manager to update the scene view according to the sampling results, set the custom animation refresh frequency, and highlight the objects that are detected to be in collision.
2. The animation simulation method for sampling different motion attributes of an object according to claim 1, characterized in that: In step (5), the key frame data of the animation model is generated. The displacement data is in matrix form, the color is expressed in RGB, and the object shape is described by parametric equations.
3. The animation simulation method for sampling different motion attributes of an object according to claim 1, characterized in that: The corresponding motion attribute value is calculated by the linear interpolation algorithm described in step (8), and the formula is as follows: q t =q 0 +k(q 1 -q 0 ) Where, q t is the value at the current moment; q 0 is the value of the previous frame; q 1 is the value of the next frame; k is a coefficient, calculated by time, as follows: k= Where t is the current time, t0 is the time corresponding to the previous frame, and t1 is the time corresponding to the next frame.
4. The animation simulation method for sampling different motion attributes of an object according to claim 1, characterized in that: The corresponding motion attribute value is calculated by parabolic interpolation algorithm as described in step (8), and the formula is as follows: Where, q t is the current value, q 0 is the value of the previous frame, q 1 is the value at the middle moment, q2 is the value of the next frame, t is the current time, t0 is the time corresponding to the previous frame, t1 is the time corresponding to the middle moment, and t2 is the time corresponding to the next frame.
5. The animation simulation method for sampling different motion attributes of an object according to claim 1, characterized in that: The collision detection in step (9) includes: Before the animation starts, obtain the model geometry information or measure it through external software to obtain the AABB and OBB bounding box data of the initial position; During the simulation, the key frames are sampled through the sampling module, the displacement transformation matrix at the current moment is calculated, and homogeneous coordinates are used to represent translation and rotation motion; Apply the displacement transformation matrix to the model bounding box to calculate the actual bounding box data at the current moment; The separating axis algorithm is used to calculate whether the bounding box of the current object interferes with other objects, and is implemented using the opencascade or fcl collision detection library.
6. The animation simulation method for sampling different motion attributes of an object according to claim 5, characterized in that: The separating axis algorithm is specifically as follows: if two polygons do not intersect on any projection axis, they do not collide; if they intersect on all projection axes, they collide.
7. The animation simulation method for sampling different motion attributes of an object according to claim 5, characterized in that: In simulation scenarios with a large number of models, a BVH tree of bounding boxes is constructed to reduce the complexity of collision detection to logarithmic level; for objects with changed shape, the mesh is discretized into triangular facets and then the bounding boxes are calculated.
8. An animation simulation system for sampling different motion properties of an object, characterized in that: include: Scene Manager: used to create scene manager objects and manage simulation animation scenes, including setting scene lighting, loading models, distinguishing between static and moving models, setting model color and material properties, and performing operations such as removing, showing, or hiding models; Animation Manager: used to record the initial state information of the model during initialization, set the animation time to 0, and update the model properties in the animation scene according to the time change of the timer update; Instruction parsing module: used to convert user-generated instructions into a standard format and then generate keyframe information; Keyframe container: used to save all keyframe queues in the model animation process, sorted by time, with different attributes corresponding to different keyframe queues; Sampler: used to sample the model's motion attributes, input a specified time t, and output the corresponding motion attribute value; Collision detection module: used to calculate the model bounding box data corresponding to the specified time t using the model bounding box data and the displacement information obtained by sampling, and detect collisions using the separating axis algorithm; Timer: used to update animation time.
9. The animation simulation system for sampling different motion attributes of an object according to claim 8, characterized in that: The collision detection module includes a bounding box generation unit and a collision detection algorithm unit. The bounding box generation unit is used to obtain model geometric information or obtain bounding box data through external software measurement. The collision detection algorithm unit is used to detect collisions using a separating axis algorithm and construct a BVH tree to optimize detection efficiency in scenes with a large number of models.
10. The animation simulation system for sampling different motion attributes of an object according to claim 8, characterized in that: It also includes a view display module, which is used to update the scene view according to the sampling results and highlight the objects that are detected to have a collision.
Citation Information
Patent Citations
Animated simulation method and system of vehicle
CN104504170A
Black lamp factory simulation system and method based on unreal engine
CN118114436A