Physics simulation method and apparatus, and electronic device and readable storage medium
By using a prediction and correction model based on vertex animation data, the problems of high computational cost and poor simulation effect in flexible body simulation are solved, achieving efficient and realistic flexible body simulation results.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2026-03-26
AI Technical Summary
Existing methods for simulating flexible bodies require a large amount of computation in large-scale scenarios, making it difficult to achieve efficient deformation of soft tissues and complex physical representations. Linear skinning technology is limited by the skeletal structure, resulting in poor simulation effects.
By using vertex animation data of simulated entities based on the first and second frames, the vertex animation inertia data of the third frame is determined and input into a pre-trained correction model. The model is then corrected by combining vertex animation influencing factor data to generate the vertex animation data of the third frame.
It achieves efficient and realistic flexible body simulation in games, reduces computational load, and improves the accuracy and smoothness of simulation.
Smart Images

Figure CN2025115817_26032026_PF_FP_ABST
Abstract
Description
Method, device, electronic device and readable storage medium for physical simulation
[0001] Cross-reference to Related Applications
[0002] This application claims priority to the Chinese patent application No. 202411303526.7, filed on September 18, 2024, and entitled “Method, device, electronic device and readable storage medium for physical simulation”, the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0003] The present disclosure relates to the field of computer technology, and in particular, to a method, device, electronic device and computer readable storage medium for physical simulation. BACKGROUND
[0004] Real-time physics simulation refers to a technology that simulates the movement and behavior of objects in a computer game or simulation software in a way close to the physical laws of the real world. Among them, as a subset of real-time physics simulation, flexible body simulation focuses on the simulation of non-rigid objects that can deform, such as clothes, hair, muscle tissue, etc. In games, flexible body simulation can significantly improve the performance of non-rigid objects, making their movements more consistent with reality.
[0005] Flexible body simulation is a physical simulation technique performed in a real-time computing environment. Existing implementations include particle-spring modeling and real-time finite element method solving. Particle-spring modeling discretizes a flexible object into a set of particles (nodes) and springs connecting these particles. For example, clothing, hair, and the like are regarded as being composed of a large number of particles and springs connecting the particles. By calculating and simulating the force conditions of each particle and spring, the real dynamic effect of the cloth under different environments can be achieved. Real-time finite element method solving establishes a muscle tissue model, which is discretized into a finite element mesh. The finite element mesh is usually composed of voxel elements and nodes. The voxel elements calculate the deformation in the continuous space where they are located. The muscle tissue model is numerically calculated using the finite element method, and the deformation and stress distribution of the muscle tissue are simulated by solving the elastic equation. The stress of the finite element mesh is applied to each simulation node, and the new position of the node is updated, thereby rendering the latest dynamic effect.
[0006] Although the above-mentioned real-time physical simulation implementation has application scenarios, the amount of calculation is very large, and it is difficult to use in large-scale scenarios. In order to reduce the amount of calculation in flexible body simulation, developers use soft bone solution. In the soft bone solution, the bones in the game are modeled, and elastic constraints are added between the bones to perform real-time elastic simulation between the bones. After the simulation is completed, the final rendering mesh is generated by using linear skinning technology. However, due to the limitation of the bone structure, the linear skinning technology is difficult to handle large-scale simulation of soft tissue deformation or complex physical performance, or distortion or plastic deformation of the model surface, resulting in poor simulation effect. SUMMARY
[0007] The present disclosure provides a method and device for physical simulation, an electronic device, and a computer readable storage medium, which solve the problem of poor physical simulation effect of simulated entities.
[0008] In a first aspect, the embodiments of the present disclosure provide a method for physical simulation, the method comprising: determining vertex animation inertia data of a third frame of a simulation entity based on vertex animation data of a first frame of the simulation entity and vertex animation data of a second frame of the simulation entity, wherein the vertex animation of the first frame of the simulation entity is a vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the second frame of the simulation entity, and the vertex animation of the second frame of the simulation entity is a vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the third frame of the simulation entity; inputting the vertex animation inertia data of the third frame of the simulation entity, the vertex animation data of the second frame of the simulation entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame of the simulation entity into a pre-trained correction model, wherein the pre-trained correction model outputs vertex animation correction data of the third frame of the simulation entity; and generating the vertex animation data of the third frame of the simulation entity based on the vertex animation inertia data of the third frame of the simulation entity and the vertex animation correction data of the third frame of the simulation entity.
[0009] In a second aspect, the embodiments of the present disclosure also provide a device for physical simulation, the device comprising: a first determining module configured to determine vertex animation inertia data of a third frame of a simulation entity based on vertex animation data of a first frame of the simulation entity and vertex animation data of a second frame of the simulation entity, wherein the vertex animation of the first frame of the simulation entity is a vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the second frame of the simulation entity, and the vertex animation of the second frame of the simulation entity is a vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the third frame of the simulation entity; a second determining module configured to input the vertex animation inertia data of the third frame of the simulation entity, the vertex animation data of the second frame of the simulation entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame of the simulation entity into a pre-trained correction model, wherein the pre-trained correction model outputs vertex animation correction data of the third frame of the simulation entity; and a generating module configured to generate the vertex animation data of the third frame of the simulation entity based on the vertex animation inertia data of the third frame of the simulation entity and the vertex animation correction data of the third frame of the simulation entity.
[0010] In a third aspect, the embodiments of the present disclosure further provide an electronic device, comprising: a processor; and a memory for storing a data processing program, after the electronic device is powered on and the program is run by the processor, the following steps are performed: determining vertex animation inertia data of a third frame of a simulation entity based on vertex animation data of a first frame of the simulation entity and vertex animation data of a second frame of the simulation entity; wherein the vertex animation of the first frame of the simulation entity is vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the second frame of the simulation entity, and the vertex animation of the second frame of the simulation entity is vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the third frame of the simulation entity; inputting the vertex animation inertia data of the third frame of the simulation entity, the vertex animation data of the second frame of the simulation entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame of the simulation entity into a pre-trained correction model, the pre-trained correction model outputs vertex animation correction data of the third frame of the simulation entity; wherein the vertex animation influencing factor data is used to represent factors influencing dynamic behavior of the simulation entity; and generating the vertex animation data of the third frame of the simulation entity based on the vertex animation inertia data of the third frame of the simulation entity and the vertex animation correction data of the third frame of the simulation entity.
[0011] In a fourth aspect, the embodiments of the present disclosure further provide a computer readable storage medium, storing a data processing program, after the program is run by a processor, the following steps are performed: determining vertex animation inertia data of a third frame of a simulation entity based on vertex animation data of a first frame of the simulation entity and vertex animation data of a second frame of the simulation entity; wherein the vertex animation of the first frame of the simulation entity is vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the second frame of the simulation entity, and the vertex animation of the second frame of the simulation entity is vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the third frame of the simulation entity; inputting the vertex animation inertia data of the third frame of the simulation entity, the vertex animation data of the second frame of the simulation entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame of the simulation entity into a pre-trained correction model, the pre-trained correction model outputs vertex animation correction data of the third frame of the simulation entity; wherein the vertex animation influencing factor data is used to represent factors influencing dynamic behavior of the simulation entity; and generating the vertex animation data of the third frame of the simulation entity based on the vertex animation inertia data of the third frame of the simulation entity and the vertex animation correction data of the third frame of the simulation entity.
[0012] Compared with the related art, the present disclosure has the following advantages:
[0013] The method for physical simulation provided in the embodiments of the present disclosure determines vertex animation inertia data of a third frame simulation entity based on vertex animation data of a first frame simulation entity and vertex animation data of a second frame simulation entity. The vertex animation of the first frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the second frame simulation entity, and the vertex animation of the second frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity. That is, in the present disclosure, the animation data of the current frame simulation entity when not subjected to any force is first predicted using the previous frame adjacent to the current frame and the previous frame adjacent to the previous frame. Then the vertex animation inertia data of the third frame simulation entity, the vertex animation data of the second frame simulation entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame simulation entity are input into a pre-trained correction model, and the pre-trained correction model outputs vertex animation correction data of the third frame simulation entity. The vertex animation influencing factor data is used to represent factors influencing the dynamic behavior of the simulation entity. That is, the pre-trained correction model predicts the vertex animation correction data of the current frame using the animation data of the current frame simulation entity when not subjected to any force, the animation data of the previous frame adjacent to the current frame, and the vertex animation influencing factor data corresponding to the vertex animation of the current frame simulation entity. Finally, the vertex animation data of the third frame simulation entity is generated based on the vertex animation inertia data of the third frame simulation entity and the vertex animation correction data of the third frame simulation entity. That is, the animation data of the current frame simulation entity when not subjected to any force is corrected using the predicted vertex animation correction data of the current frame, and the vertex animation data of the current frame simulation entity is obtained. This method can simulate the simulation effect of the simulation entity in real time when the game is running, and the simulation effect is better. BRIEF DESCRIPTION OF DRAWINGS
[0014] FIG. 1 is a flowchart of one of the methods for physical simulation provided in the embodiments of the present disclosure;
[0015] FIG. 2 is a flowchart of one of the methods for physical simulation provided in the embodiments of the present disclosure;
[0016] FIG. 3 is a structural block diagram of one of the devices for physical simulation provided in the embodiments of the present disclosure;
[0017] FIG. 4 is a structural block diagram of one of the electronic devices provided in the embodiments of the present disclosure. DETAILED DESCRIPTION
[0018] In order to better understand the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative work should fall within the scope of the present disclosure.
[0019] It should be noted that the terms "first", "second", "third", etc. in the claims, the specification and the drawings of the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. The data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include", "have" and their variants are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0020] Real-time physics simulation refers to a technology that simulates the motion and behavior of objects in a computer game or simulation software in a way close to the laws of the real world. Among them, flexible body simulation, as a subset of real-time physics simulation, focuses on the simulation of non-rigid objects that can deform, such as clothes, hair, muscle tissue, etc. In games, flexible body simulation can significantly improve the performance of non-rigid objects, making their movements more realistic. For example, clothes will flutter in the wind or naturally swing with the character's movements; the character's hair will have a realistic dynamic performance when running or being blown by the wind; in some realistic games, the character's body parts (such as the chest and hips) can have more realistic physical feedback, especially with the support of motion capture technology and animation fusion technology. Through flexible body simulation, the virtual environment is closer to the real world, thereby attracting players and improving the entertainment value of the game.
[0021] Flexible body simulation is a physical simulation technique performed in real-time computing environment. Particle-spring model is the most common method, which is used to discretize flexible objects into a set of particles (nodes) and springs connecting these particles, such as clothes, hair, etc. are regarded as composed of a large number of particles and springs connecting these particles. Taking the simulation of clothes as an example, the particle-spring model can simulate the softness, elasticity and dynamic behavior of the cloth. Each particle represents a vertex of the cloth mesh, and the spring simulates the constraint between adjacent particles. In the simulation process, the spring will be affected by forces such as stretching, compression and bending, thereby affecting the position and motion state of adjacent particles. In this way, by simulating the physical interaction between each particle and spring, the simulation of cloth can be achieved. At the same time, the spring particle model can simulate the dynamic deformation, vibration and gravity effect of the cloth under the action of external force. Through the calculation and simulation of the force condition of each particle and spring, the real dynamic effect of the cloth under different environments can be realized, such as wind blowing, object collision, etc.
[0022] Real-time finite element method solving is usually used for muscle tissue. First, a muscle tissue model is established, and material properties are defined for the muscle tissue model, including Young's modulus, Poisson's ratio and density of the muscle. Then, the muscle tissue model is discretized into finite element mesh, which is usually composed of voxel elements and nodes, wherein the voxel elements are usually tetrahedral or hexahedral voxels. Voxel elements are used to calculate the deformation in the continuous space, and numerical calculation of the muscle tissue model is performed using the finite element method, and the deformation and stress distribution of the muscle tissue are simulated by solving the elastic equation. The stress of the finite element mesh is applied to each simulation node, and the new position of the node is updated, thereby rendering the latest dynamic effect.
[0023] Although the implementation mode of the real-time physical simulation has application scenarios, the calculation amount is very large, and it is difficult to use in large-scale scenarios. In order to reduce the calculation amount in the simulation of flexible bodies, the developer adopts the soft bone solution. Among them, the soft bone solution models the bones in the game, adds elastic constraints between the bones and the bones, and performs real-time elastic simulation between the bones. After the simulation is completed, the final rendering grid is generated through the linear skinning technology. The soft bone solution usually only needs to simulate the elastic effect of a few bones, and then calculates the final rendering grid through the linear skinning technology. However, the linear skinning technology often cannot accurately simulate the deformation of soft tissues such as muscles, fats and skins, which will cause the character animation to appear stiff and unrealistic deformation. If the simulation of the deformation of the soft tissue is on some local parts between the bone chains and the bone chains, the generation of the final rendering grid through the linear skinning technology will appear unreasonable deformation and stretching. Due to the limitation of the bone structure, the linear skinning technology is difficult to handle large-scale simulation of soft tissue deformation or complex physical performance, or distortion or plastic deformation of the model surface, resulting in poor simulation effect.
[0024] To solve the above problems in the related art, the embodiments of the present disclosure provide a physical simulation method, device, electronic equipment and computer readable storage medium. The physical simulation method of one embodiment of the present disclosure can be executed by a computer device, which can be a terminal or a server. The terminal can be a smart phone, a tablet computer, a notebook computer, a touch screen, a game console, etc. The server can be a physical server, a server cluster composed of multiple physical servers or a distributed system, and can also be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and basic cloud computing services such as big data and artificial intelligence platforms.
[0025] The physical simulation method provided by the present disclosure can be used to obtain vertex animation data of the simulation entity in real time, and then realize the simulation effect of the simulation entity in real time.
[0026] As shown in FIG. 1, a flowchart of a physical simulation method provided by an embodiment of the present disclosure is shown. The method comprises the following steps:
[0027] Step S101: Based on the vertex animation data of the first frame simulated entity and the vertex animation data of the second frame simulated entity, determine the vertex animation inertial data of the third frame simulated entity; wherein, the vertex animation of the first frame simulated entity is the vertex animation of the previous frame simulated entity adjacent to the vertex animation of the second frame simulated entity, and the vertex animation of the second frame simulated entity is the vertex animation of the previous frame simulated entity adjacent to the vertex animation of the third frame simulated entity.
[0028] In this embodiment of the disclosure, a simulated entity refers to an object whose dynamic behavior is simulated through physical simulation in a virtual environment. Flexible body simulation typically involves objects with soft, deformable properties, such as fabric, rope, liquid, and balloons. Such simulations usually need to consider the object's physical properties, such as elasticity, density, and friction, and calculate the object's deformation and motion in real time during the simulation. During the simulation of a simulated entity, its dynamic behavior is simulated based on its physical properties, including deformation, motion, and interaction with other objects.
[0029] Vertex animation data for a simulated entity refers to the position information of each vertex of the simulated entity in each frame of the animation. It can be denoted as X = [x0, x1, ..., x...]. n ], where x i Let n represent the simulated entity vertex animation data of the i-th frame, where n is a positive integer.
[0030] It should be noted that a 3D model is a mesh composed of multiple polygons (usually triangles), and each polygon is defined by several vertices. Each vertex has specific spatial coordinates (x, y, z).
[0031] Application scenarios of simulated entities in flexible body simulation include: (1) Fabric simulation: simulating the natural swaying and folding of fabrics such as clothing, flags, and curtains. (2) Liquid simulation: simulating the flow and ripple effects of liquids such as water and oil. (3) Rope simulation: simulating the bending and stretching of slender objects such as ropes and chains. (4) Balloon simulation: simulating the dynamic effects of balloon inflation and deflation. (5) Collision detection: performing collision detection during the simulation process to ensure that the interaction between objects conforms to the laws of physics.
[0032] The vertex animation data of the simulated entity can be obtained by creating or importing a 3D model in a 3D modeling software. A physical engine (such as Soft Body Dynamics of Blender, Nucleus of Maya, etc.) is enabled. The conditions of the physical simulation are set, such as gravity, collision detection, etc. The physical simulation is run, and the physical behavior of the 3D model in the animation is observed. The new position information of all vertices is recorded in each frame. The vertex animation data of the simulated entity is obtained. The vertex animation data of the simulated entity can also be obtained by creating a particle system in the 3D modeling software and setting the attributes of the particles, such as emission speed, lifetime, etc. The particle simulation is run, and the behavior of the particles is observed. The position information of all particles in each frame can be regarded as the vertex animation data. The vertex animation data of the simulated entity can also be obtained by creating or importing a 3D model in the 3D modeling software, manually adjusting the position of each vertex in each frame to achieve the desired animation effect. The position information of all vertices in each frame is recorded to form the vertex animation data.
[0033] It should be noted that the vertex animation of the first frame of the simulated entity, the vertex animation of the second frame of the simulated entity, and the vertex animation of the third frame of the simulated entity are three adjacent images, such as the vertex animation of the first frame of the simulated entity is the vertex animation of the i-2 frame of the simulated entity, the vertex animation of the second frame of the simulated entity is the vertex animation of the i-1 frame of the simulated entity, and the vertex animation of the third frame of the simulated entity is the vertex animation of the i frame of the simulated entity.
[0034] In the present disclosure, the physical simulation of the clothes of the game character is taken as an example for illustration. The physical simulation of the clothes in the game character refers to the realistic dynamic performance of the virtual clothes in the game through the physical engine. It aims to make the clothes of the character in the game move and deform naturally according to the actions of the character and the changes of the environment, thereby enhancing the immersion and realism of the game.
[0035] The vertex animation data of the simulated clothes includes: obtaining the skeleton animation data of the character model. The corresponding skin data is configured for the character model. The skeleton animation data is driven by the skin data to obtain the character animation data of the character model. Then the simulated clothes are applied to the character model to obtain the vertex animation data of the simulated clothes.
[0036] The skeletal animation data can be obtained by manually creating animations using professional 3D modeling software such as Blender, Maya, 3ds Max, etc. The Rigging function in the 3D modeling software is used to add bones to the 3D model, and the position and rotation of the bones are set frame by frame through the keyframe animation technology. The skeletal animation data can also be obtained by purchasing or downloading ready-made animation files from various online resource stores such as Unity Asset Store, Unreal Marketplace, etc. The skeletal animation data can also be obtained by accessing the source files of a certain game or project and extracting the existing animation data in the game.
[0037] Exemplarily, the skeletal animation data can be obtained by recording the skeletal animation of the character in the game. That is, the animation segments of the character that need to be recorded are determined, such as basic actions such as walking, running, attacking, etc., and special actions in specific game situations. The motion capture system (including cameras, sensors, computing devices, etc.) records the action data of the character in real time to obtain the skeletal animation data.
[0038] It should be noted that after obtaining the skeletal animation data set, the obtained skeletal animation data can be processed, including (1) data cleaning, cleaning the collected skeletal animation data, removing noise, and correcting incorrect data. (2) Animation editing: using professional animation editing software such as Autodesk MotionBuilder, Blender, etc. to edit, adjust and optimize the recorded skeletal animation data to make it more suitable for use in the game. (3) Animation fusion: multiple action segments can be spliced together to form a more smooth animation sequence.
[0039] Skeletal animation is a method of driving the movement of a character model by controlling the bones of the character. Skeletal animation is a series of consecutive bone pictures, and each frame of bone picture represents a moment in time.
[0040] Each bone of the character represents a joint or body part, and can change in position and rotation. The position refers to the coordinates of each bone in three-dimensional space (usually the values on the x, y, and z axes). The position determines the spatial position of the bone in the current frame. The rotation refers to the direction or posture of each bone, which is usually represented by Euler angles, quaternions, or rotation matrices, etc., and describes the rotation angle of the bone relative to its parent bone or world coordinates.
[0041] The skeleton animation data (DataSet-Pose) refers to the position and rotation data of the skeleton of a character recorded in each frame during game development and animation production. For example, the skeleton of a game character includes the head, torso, arms, and legs. The skeleton animation data of each frame includes: ① the position and rotation of the head skeleton; ② the position and rotation of the torso skeleton; ③ the position and rotation of the left and right arms; ④ the position and rotation of the left and right legs, etc. Among them, the skeleton animation data set can be denoted as Y char = [y char-0 ,y char-1 ,L,y char-n ], where y char-i represents the position and rotation data (Pose pose) of the i-th frame, x e [0, 1, 2, L, n], and n is a positive integer.
[0042] Obtaining skin data (Data Skin) can be to configure skin data for skeleton animation, that is, to assign weights to each vertex of the surface mesh of the character model. For example, in a 3D modeling software, manually adjust the weights of each vertex of the surface mesh of the character model to ensure natural animation. Or through an automatic weight distribution tool (such as Weights Paint Mode), generate the weights of each vertex of the surface mesh of the character model. Obtaining skin data can also record the skin data corresponding to the skeleton animation when recording the skeleton animation data set of the character in the game. Among them, the skin data contains all the necessary skin information, such as weight data, skeleton hierarchy relationship, etc.
[0043] It should be noted that in 3D animation and game development, skin data is the skin data of a character. In this disclosure, skin data refers to the body data of a 3D model of a character without clothes, that is, the skin data in this disclosure is the surface mesh data of the character model, which can be driven by a skeleton animation system to achieve various actions.
[0044] Skin data is used to describe how to combine the surface mesh of a 3D model with the skeleton in order to achieve the effect of skeleton animation. Specifically, skin data makes the character model deform according to the changes of skeleton animation, achieving realistic animation effects. In game and virtual reality applications, skin data makes the character make corresponding actions according to user input or other game logic.
[0045] The skin data contains information such as (1) Weights: the degree of association between each vertex of the surface mesh of the 3D model and the bones. Weights represent the degree to which each vertex is affected by one or more bones. For example, the vertices of an arm are mainly affected by the upper arm bone and the forearm bone, and the weight value determines the relative strength of these influences. (2) Bone Indices: the index of the bone associated with each vertex of the surface mesh of the 3D model. Each vertex is affected by multiple bones, so the index of these bones in the bone array needs to be recorded. (3) Bone Transformations: information such as the position, rotation, and scaling of the bones in the animation. These information is used to calculate the position and pose of the bones in each frame. (4) Calculation in vertex shader: in real-time rendering, skin data is used in vertex shader to calculate the final position of the vertex. The vertex shader calculates the new position of each vertex based on the current position and rotation of the bone and the weight of the vertex.
[0046] The DataSet-Character is obtained by applying the bone position and rotation data in each frame of the bone animation to the skin data, calculating the new position of each vertex of the surface mesh of the character model through the weight distribution, and forming a new mesh shape. The vertex position data in the new mesh shape is the vertex animation data, which contains the animation state of the character in the current frame. That is, the DataSet-Character is obtained by driving the bone animation data with the skin data.
[0047] It should be noted that in computer graphics and game development, the DataSet-Character is used to describe the animation state and behavior of the character. It contains information such as (1) the position (coordinates) and rotation angle of each bone in each frame of animation; the weight relationship between each vertex of the surface mesh of the character and the relevant bones, used to calculate the position change of each vertex in the animation. (2) The animation of the character in different states, such as standing, walking, running, attacking, and being injured; the animation data in each state may include key frames, animation curves, etc. (3) How to mix the data of different animation states when the character smoothly transitions between different animations. (4) Events triggered on specific frames of the animation, such as triggering a strike effect or sound effect at the strike point of the attack action.
[0048] The vertex animation data of the simulated clothes (DataSet Simlated) can be obtained by loading or creating a 3D character model in a DCC software, applying the character animation data to the 3D character model, and starting the clothes simulation function in the DCC software. During the simulation process, the vertex positions of the clothes change according to the character animation data and the simulation results of the clothes. The changed vertex position data is the vertex animation data of the simulated clothes.
[0049] It should be noted that the DCC software refers to professional tools for creating and editing 3D models, animations and the like, such as Blender, Maya, 3ds Max, etc.
[0050] In some embodiments, the vertex animation inertia data of the third frame simulated entity is obtained based on the vertex animation data of the second frame simulated entity and the position change amount of the same vertex of the simulated entity, and the vertex animation inertia data of the third frame simulated entity is obtained based on the vertex animation data of the second frame simulated entity and the position change amount of the same vertex of the simulated entity.
[0051] The vertex animation data of the second frame simulated entity is multiplied by a corresponding first weight, and the position change amount of the same vertex of the simulated entity is multiplied by a corresponding second weight, and then added to obtain a weighted sum as the vertex animation inertia data of the third frame simulated entity.
[0052] In the embodiments of the present disclosure, as shown in FIG. 2, a flowchart of another method of physical simulation is provided, the obtained vertex animation data of the second frame simulated entity is x i-1 , the obtained vertex animation data of the first frame simulated entity is x i-2 , and the vertex animation inertia data of the third frame simulated entity is x init-i , which can be calculated by the following formula 1. x init-i =αe x i-1 +βe(x i-1 -x i-2 ) (Formula 1)
[0053] Wherein, α is the first weight corresponding to the vertex animation data x i-1 of the second frame simulated entity. β is the second weight corresponding to the position change amount x i-1 -x i-2 of the same vertex of the simulated entity in the vertex animation of the first frame simulated entity and the vertex animation of the second frame simulated entity. e is a component wise multiplication, which means performing element-wise multiplication operation on two vectors or matrices. By multiplication operation, the elements in the corresponding positions are multiplied to generate a result vector or matrix with the same dimension.
[0054] In some embodiments, before the step of adding the second frame simulation entity's vertex animation data multiplied by a corresponding first weight and the same vertex of the simulation entity's position change amount in the first frame simulation entity's vertex animation multiplied by a corresponding second weight, the method further comprises:
[0055] obtaining vertex animation data of a plurality of third frame simulation entities, vertex animation data of a second frame simulation entity adjacent to a vertex animation of each third frame simulation entity, and vertex animation data of a first frame simulation entity adjacent to a vertex animation of the second frame simulation entity;
[0056] generating vertex animation prediction data of the plurality of third frame simulation entities based on the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity, and the same vertex of the simulation entity's position change amount in the vertex animation of each first frame simulation entity and the vertex animation data of each second frame simulation entity;
[0057] minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity, to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the same vertex of the simulation entity's position change amount in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity.
[0058] In some embodiments, the minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity comprises:
[0059] generating a linear model based on the vertex animation data of the second frame simulation entity, the first weight corresponding to the vertex animation data of the second frame simulation entity, the same vertex of the simulation entity's position change amount in the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity, the second weight corresponding to the same vertex of the simulation entity's position change amount, and the vertex animation data of the third frame simulation entity;
[0060] fitting the linear model to meet a preset condition by a least square method to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the same vertex of the simulation entity's position change amount in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity, wherein the preset condition is that the residual sum of squares between the vertex animation data of the third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity is minimized.
[0061] In the embodiments of the present disclosure, based on the vertex animation data x i-1 of the i-1 frame simulation entity, the vertex animation data x i-1The corresponding first weight α, the position change amount x of the same vertex of the i-2 frame simulated entity and the vertex animation of the i-1 frame simulated entity i-1 -x i-2 , the position change amount x of the same vertex of the simulated entity, the corresponding second weight β, and the vertex animation data x of the third frame simulated entity i , and the linear model is generated as formula 2 x i =[α,β]*[x i-1 , x i-1 -x i-2 ] (Formula 2)
[0062] The equation of the above formula 2 is solved by using the least square method, and the first weight α and the second weight β are fitted.
[0063] In step S102, the vertex animation inertia data of the third frame simulated entity, the vertex animation data of the second frame simulated entity, and the vertex animation corresponding to the vertex animation influencing factor data of the third frame simulated entity are input into the pre-trained correction model, and the pre-trained correction model outputs the vertex animation correction data of the third frame simulated entity; wherein the vertex animation influencing factor data is used to represent the factors affecting the dynamic behavior of the simulated entity.
[0064] In the embodiments of the present disclosure, the vertex animation inertia data of the simulated entity is used to represent the motion of the simulated entity without external force. Wherein, without external force means that no force is applied or only conservative force such as gravity is applied.
[0065] The vertex animation influencing factor data is used to represent the factors affecting the dynamic behavior of the simulated entity, that is, the vertex animation influencing factor data is the factor affecting the simulation result of the simulated entity. It includes: (1) The basic physical properties of the simulated object, such as mass, density, elastic modulus, friction coefficient, etc. These properties directly affect the behavior of the object under force. (2) The state at the beginning of simulation, including position, velocity, angular velocity, etc. The initial condition is the basis of the simulation, which determines the starting point of the subsequent motion. (3) The force acting on the simulated object, including gravity, thrust, tension, etc., and the torque generated by rotation. These forces will determine the acceleration and rotation of the object. (4) Environmental conditions, such as air resistance, fluid dynamics effects, ground friction, etc. These factors will affect the motion trajectory of the object. (5) The constraint conditions (such as hinge connection, rope, etc.) of the simulated object, which need to define the specific form and strength of these constraints.
[0066] In the physical simulation of the game character clothes as described above, in addition to the bone structure described above, other factors affecting the simulation results of the game character clothes also need to be considered, which are referred to as environmental parameter data (DataSet Env), including but not limited to the height of the ground, the direction and size of the wind, the size of the gravity, the motion parameters of the character relative to the scene, the position and shape of other collision bodies, etc.
[0067] It should be noted that the environmental parameter data refers to the environmental parameter data used in each frame when generating the simulation entity, which can be denoted as Y Env = [y env-0 , y env-1 , L, y env-n ], wherein y env-0 represents the environmental parameter data of the simulation entity in the first frame vertex animation data.
[0068] Taking the physical simulation of the game character clothes as an example, the character costume of the character model is designed in the 3D costume design and simulation software (such as Marvelous Designer). The character costume can include armor, cloak, skirt, etc. When designing the character costume of the character model, it is ensured that the costume can naturally flutter in the wind or fit the body when the character moves. The designed character costume of the character model is placed on the character model constructed in the DCC, and the environmental parameter data corresponding to each frame of animation is set in the DCC. The character model in the DCC is driven by the character animation data, the vertex animation data of the simulated clothes is generated and exported. At the same time, the environmental parameter data is recorded and exported.
[0069] In the embodiment of the present disclosure, as shown in FIG. 2, the third frame vertex animation inertia data x init-i of the simulation entity, the second frame vertex animation data x i-1 of the simulation entity and the vertex animation influencing factor data a i corresponding to the third frame vertex animation of the simulation entity are input into the pre-trained correction model, and the pre-trained correction model outputs the third frame vertex animation correction data of the simulation entity.
[0070] In some embodiments, before the step of inputting the third frame vertex animation inertia data of the simulation entity, the second frame vertex animation data of the simulation entity and the vertex animation influencing factor data corresponding to the third frame vertex animation of the simulation entity into the pre-trained correction model, the method further comprises:
[0071] obtaining a training data set, the training data including a plurality of training samples and a label corresponding to each training sample, each training sample including vertex animation inertia data of a third frame of a simulated entity, vertex animation data of a second frame of the simulated entity, and vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity, and the label corresponding to each training sample being the vertex animation data of the third frame of the simulated entity in reality;
[0072] inputting the training sample into a to-be-trained correction model, the to-be-trained correction model outputting third frame vertex animation correction data of the simulated entity predicted by the to-be-trained correction model;
[0073] superimposing the third frame vertex animation correction data of the simulated entity on the vertex animation inertia data of the third frame of the simulated entity to obtain predicted vertex animation data of the third frame of the simulated entity;
[0074] training the to-be-trained correction model based on the predicted vertex animation data of the third frame of the simulated entity and the vertex animation data of the third frame of the simulated entity in reality to obtain a pre-trained correction model.
[0075] In the embodiments of the present disclosure, a plurality of groups of adjacent vertex animation of a first frame of a simulated entity, vertex animation of a second frame of the simulated entity, and vertex animation of a third frame of the simulated entity can be obtained. Based on the vertex animation data of the first frame of the simulated entity and the vertex animation data of the second frame of the simulated entity of each group, vertex animation inertia data of the third frame of the simulated entity is obtained. Then, the vertex animation inertia data of the third frame of the simulated entity, the vertex animation data of the second frame of the simulated entity adjacent to a previous frame of the third frame of the simulated entity, and the vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity of each group are input into a to-be-trained correction model, and the to-be-trained correction model outputs third frame vertex animation correction data of the simulated entity predicted by the to-be-trained correction model. The vertex animation inertia data of the third frame of the simulated entity is corrected by using the predicted third frame vertex animation correction data of the simulated entity to obtain predicted vertex animation data of the third frame of the simulated entity. Then, a difference between the predicted vertex animation data of the third frame of the simulated entity and the vertex animation data of the third frame of the simulated entity in reality is taken as a loss function of the to-be-trained correction model, and the to-be-trained correction model is trained until the model converges, and a pre-trained correction model is obtained.
[0076] In some embodiments, after the step of obtaining the training data set, the method further includes:
[0077] splicing the vertex animation inertia data of the third frame of the simulated entity, the vertex animation data of the second frame of the simulated entity, and the vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity by frames to obtain spliced input data.
[0078] In this embodiment, the physical simulation of the game character's clothing will continue to be used as an example. The skeletal animation data, environment parameter data, and vertex animation data of the simulated entity have the same number of frames, and they correspond one-to-one frame. When organizing the training data, the skeletal animation data and environment parameter data are first concatenated frame by frame into input data (DataSet input), which can be denoted as Y = [y0, y1, L, y]. n ], where y i =[y char-i y env-i ], y i This represents the input data for the i-th frame, which is a concatenation of the skeletal animation data and the environment parameter data. i∈[0,1,2,L,n], where n is a positive integer.
[0079] It should be noted that, in this embodiment of the disclosure, it is assumed that the factors affecting the simulation results of the simulated entity include skeletal animation and environment. The skeletal animation data and environment parameter data are concatenated frame by frame as input data. By concatenating the skeletal animation data and environment parameter data frame by frame as input data, machine learning algorithms can comprehensively process the influence of skeletal animation data and environment parameter data on the simulation results of the simulated entity.
[0080] In some embodiments, after the step of obtaining the training dataset, the method further includes:
[0081] The training dataset is subjected to dimensionality reduction processing to obtain the dimensionality-reduced data corresponding to the training dataset.
[0082] In this embodiment, the physical simulation of the game character's clothing will be used as an example for further explanation. PCA dimensionality reduction is performed on the input data to obtain the first PCA code corresponding to the input data, which can be denoted as W = [w0, w1, L, w...]. n ], where w i The first PCA encoding of the input data of the i-th frame after dimensionality reduction.
[0083] It should be noted that the relationship between Y and W is W = U(Yy) u ), where U is the transformation matrix for PCA dimensionality reduction, y u This is the mean of the input data for all frames in Y.
[0084] Among them, y i and w i The relationship between them is: y i =U T *w i +y u (Formula 3)
[0085] Among them, U TThe transpose matrix of the conversion matrix U.
[0086] If the input data is not subjected to PCA dimension reduction, W=Y can be directly set.
[0087] In the embodiments of the present disclosure, the vertex animation data of the simulation entity is also subjected to PCA dimension reduction to obtain second PCA encoding corresponding to the vertex animation data of the simulation entity, which can be denoted as Z=[z0, z1, L, z n ],wherein z i is the second PCA encoding corresponding to the vertex animation data of the i-th frame of the simulation entity. The second PCA encoding is taken as the output data.
[0088] The relationship between the vertex animation data X of the simulation entity and the PCA encoding Z corresponding to the vertex animation data of the simulation entity is Z=U(X-x u ), where U is a conversion matrix of PCA dimension reduction, and x u is the mean value of the vertex animation data of the simulation entity in all frames of X.
[0089] wherein the relationship between x i and z i is x i =U T *z i +x u (Formula 4)
[0090] It should be noted that the complexity of the input data and the vertex animation data of the simulation entity is reduced through PCA dimension reduction, thereby reducing the difficulty of training the model in machine learning.
[0091] Dimension reduction is a kind of preprocessing method for high-dimensional features of data. Dimension reduction is to retain some of the most important features of high-dimensional data, remove noise and unimportant features, and thus achieve the purpose of improving data processing speed. In actual production and application, dimension reduction can save a lot of time and cost within a certain range of information loss. Dimension reduction can make the data set more easily used, reduce the computational overhead of the algorithm, remove noise, and make the results easier to understand.
[0092] PCA (principal component analysis) is a widely used data compression algorithm. In PCA, the data is converted from the original coordinate system to a new coordinate system determined by the data itself. When converting the coordinate system, the direction with the largest variance is taken as the coordinate axis direction. The first new coordinate axis is selected as the direction with the largest variance in the original data, and the second new coordinate axis is selected as the direction orthogonal to the first new coordinate axis and with the second largest variance. Repeat the process, and the number of repetitions is the feature dimension of the original data.
[0093] In the embodiments of the present disclosure, during the model training, the first PCA encoding W = [w0, w1, L, w n ] corresponding to the input data is taken as one of the input data of the to-be-trained correction model, the second PCA encoding Z = [z0, z1, L, z n ] corresponding to the vertex animation data of the simulation entity is taken as the output data of the to-be-trained correction model, and the to-be-trained correction model is trained. Specifically, the following steps are included:
[0094] Step 1: generating first noise data r0 and second noise data r1;
[0095] Step 2: applying the first noise data r0 to the first-frame second PCA encoding z0 to obtain z * 0 = z0 + r0; wherein z * 0 can be taken as the PCA encoding corresponding to the vertex animation prediction data of the first-frame simulation entity;
[0096] applying the second noise data r1 to the second-frame second PCA encoding z1 to obtain z * 1 = z1 + r1; z * 1 can be taken as the PCA encoding corresponding to the vertex animation prediction data of the second-frame simulation entity;
[0097] Step 3: starting from the third frame, the following calculation is performed: z * init-i = αe z * i-1 + βe(z * i-1 - z * i-2 ) (Formula 5)
[0098] wherein z * init-i is the PCA encoding corresponding to the vertex inertia data of the i-th frame simulation entity, and the vertex inertia data of the simulation entity is used to represent the motion of the simulation entity without external force. e is a component wise multiplication, which means performing element-wise multiplication operation on two vectors or matrices. Through the multiplication operation, the elements at corresponding positions are multiplied to generate a result vector or matrix with the same dimension. z * i-1 is the PCA encoding corresponding to the vertex animation prediction data of the i-1-th frame simulation entity, z * i-2 is the PCA encoding corresponding to the vertex animation prediction data of the i-2-th frame simulation entity, and z * i-1 - z *i-2 The PCA code corresponding to the change amount of the vertex position in the vertex animation prediction data of the i-2 frame simulation entity and the vertex animation prediction data of the i-1 frame simulation entity.
[0099] α is a first weight vector corresponding to the vertex animation prediction data of the i-1 frame simulation entity; and β is a second weight vector corresponding to the change amount of the vertex position in the vertex animation prediction data of the i-2 frame simulation entity and the vertex animation prediction data of the i-1 frame simulation entity.
[0100] It should be noted that α and β can be solved by using the least square method to fit the linear model given in formula 4. i = [α, β] * [z i-1 , z i-1 -z i-2 ] (Formula 6)
[0101] wherein z i , z i-1 and z i-2 may be any three adjacent frames of vertex animation data of the simulation entity in the second PCA code Z = [z0, z1, L, z n ] corresponding to the vertex animation data of the simulation entity, and α and β are obtained by minimizing the residual sum of squares between z i and [α, β] * [z i-1 , z i-1 -z i-2 ].
[0102] The least square method is a technique for estimating unknown parameters by minimizing the residual sum of squares between the observed values and the model predicted values to find the best fitting parameters.
[0103] Step 4: input the PCA code z * init-i corresponding to the vertex inertia data of the i frame simulation entity, the PCA code z i-1 corresponding to the vertex animation data of the i-1 frame simulation entity, and the PCA code w i corresponding to the i-1 frame input data into the trained correction model, and the trained correction model outputs the vertex correction data Φ(z * init-i , z i-1 , w i ) of the i frame simulation entity. The vertex correction data Φ(z * init-i , z i-1 , w i ) of the simulation entity is used to correct the vertex inertia data of the simulation entity.
[0104] Step 5: Obtain the PCA encoding of the vertex animation predicted data of the i-th frame of the simulated entity by the vertex inertia data z * init-i and the vertex correction data Φ(z * init-i , z i-1 , w i ) of the i-th frame of the simulated entity. Specifically, z * i = z * init-i + Φ(z * init-i , z i-1 , w i ) (Equation 7)
[0105] That is, the PCA encoding of the vertex animation predicted data of the i-th frame of the simulated entity is obtained by calculating the vertex inertia data z * init-i and the vertex correction data Φ(z * init-i , z i-1 , w i ) of the i-th frame of the simulated entity according to the above Equation 5.
[0106] Step 6: Calculate the error L L pos = L vel (Equation 8) L pos = L pos-0 + ||z * i - z i || (Equation 9) L vel = L vel-0 + ||(z * i - z * i-1 ) - (z i - z i-1 )|| (Equation 10)
[0107] wherein L pos is the error between the PCA encoding z * i of the vertex animation predicted data of the i-th frame of the simulated entity and the PCA encoding z i of the vertex animation actual data of the i-th frame of the simulated entity. ||z * i - z i || is the error between the PCA encoding z * iThe norm between the PCA coding z corresponding to the vertex animation actual data of the i-th frame simulation entity and the vertex animation actual data of the i-1-th frame simulation entity i The norm between the PCA coding z corresponding to the vertex animation actual data of the i-th frame simulation entity and the vertex animation actual data of the i-1-th frame simulation entity vel The error between the PCA coding z corresponding to the change amount of the first vertex position and the change amount of the second vertex position. The change amount of the first vertex position is the change amount of the vertex position in the vertex animation predicted data of the i-th frame simulation entity and the vertex animation predicted data of the i-1-th frame simulation entity; the change amount of the second vertex position is the change amount of the vertex position in the vertex animation actual data of the i-th frame simulation entity and the vertex animation actual data of the i-1-th frame simulation entity. * i -z * i-1 )-(z i -z i-1 The norm between the PCA coding z corresponding to the change amount of the first vertex position and the change amount of the second vertex position.
[0108] Step 7: using the gradient descent method (AdamW, AmsGrad, etc. optimization algorithm) to optimize the parameters of the to-be-trained correction model on the error L in step 6, so as to minimize the error function, and obtain the pre-trained correction model.
[0109] In some embodiments, after the step of obtaining the training data set, the method further comprises:
[0110] Divide the training data set into multiple groups of data windows using a training window of a preset length;
[0111] Train the to-be-trained correction model using the training data in each group of data windows to obtain the pre-trained correction model.
[0112] In the implementation of the present disclosure, the input data and the output data are divided into multiple groups by a training window window, wherein the size of the training window window is s. The input data in each training window window is [w0, w1, L, w s ], and the output data is [z0, z1, L, z s ].
[0113] Divide the training data by the training window window to obtain multiple groups of data windows. Training the to-be-trained correction model using all the data windows can reduce the expansion of the error of the to-be-trained correction model over time.
[0114] Step S103, generating vertex animation data of the third frame simulation entity based on the vertex animation inertia data of the third frame simulation entity and the vertex animation correction data of the third frame simulation entity.
[0115] In the embodiments of the present disclosure, the vertex animation correction data Φ(x init-i , x i-1 , a i ) of the third frame simulation entity obtained in step S102 is used to correct the vertex animation inertia data x init-i of the third frame simulation entity obtained in step S101. In the correction, the vertex animation correction data of the third frame simulation entity can be directly superimposed on the vertex animation inertia data x init-i of the third frame simulation entity, and specifically, the superimposition can be implemented by the following formula 10: x i = x init-i + Φ(x init-i , x i-1 , a i ) (Formula 11)
[0116] It should be noted that if the training data used to train the correction model to be trained is processed by dimension reduction, when the vertex animation data of the i-th frame simulation entity is predicted in the process of real-time running of the game, the vertex animation inertia data of the i-th frame simulation entity, the vertex animation data of the (i-1)-th frame simulation entity and the vertex animation influencing factor data corresponding to the vertex animation data of the i-th frame simulation entity can be processed by dimension reduction to obtain corresponding dimension reduction results, and then the pre-trained correction model is input. Alternatively, the vertex animation inertia data of the i-th frame simulation entity, the vertex animation data of the (i-1)-th frame simulation entity and the vertex animation influencing factor data corresponding to the vertex animation data of the i-th frame simulation entity are first corresponded one by one, then spliced to obtain a spliced result, and the spliced result is processed by dimension reduction. The dimension reduction results of the vertex animation inertia data of the i-th frame simulation entity, the vertex animation data of the (i-1)-th frame simulation entity and the vertex animation influencing factor data corresponding to the vertex animation data of the i-th frame simulation entity are input into the pre-trained correction model, and the pre-trained correction model outputs the dimension reduction results corresponding to the vertex animation correction data of the i-th frame simulation entity. The dimension reduction results corresponding to the vertex animation correction data of the i-th frame simulation entity are superimposed on the dimension reduction results corresponding to the vertex animation inertia data of the i-th frame simulation entity to obtain the dimension reduction results corresponding to the predicted vertex animation data of the i-th frame simulation entity.
[0117] After obtaining the dimension reduction results corresponding to the vertex animation data of the i-th frame simulation entity, the dimension reduction results corresponding to the vertex animation data of the i-th frame simulation entity can be restored to the vertex animation data of the i-th frame simulation entity according to formula 4. It should be noted that in the restoration to the vertex animation data of the i-th frame simulation entity, x u in formula 4 can take the mean value of the vertex animation data of all frames of the simulation entity in X.
[0118] The method for physical simulation provided in the embodiments of the present disclosure determines vertex animation inertia data of a third frame simulation entity based on vertex animation data of a first frame simulation entity and vertex animation data of a second frame simulation entity, wherein the vertex animation of the first frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the second frame simulation entity, and the vertex animation of the second frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity. That is, in the present disclosure, the animation data of the current frame simulation entity when not subjected to any force is first predicted using the previous frame adjacent to the current frame and the previous frame adjacent to the previous frame. Then the vertex animation inertia data of the third frame simulation entity, the vertex animation data of the second frame simulation entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame simulation entity are input into a pre-trained correction model, and the pre-trained correction model outputs vertex animation correction data of the third frame simulation entity. The vertex animation influencing factor data is used to represent factors influencing the dynamic behavior of the simulation entity. That is, the pre-trained correction model predicts the vertex animation correction data of the current frame using the animation data of the current frame simulation entity when not subjected to any force, the animation data of the previous frame adjacent to the current frame, and the vertex animation influencing factor data corresponding to the vertex animation of the current frame simulation entity. Finally, the vertex animation data of the third frame simulation entity is generated based on the vertex animation inertia data of the third frame simulation entity and the vertex animation correction data of the third frame simulation entity. That is, the animation data of the current frame simulation entity when not subjected to any force is corrected using the predicted vertex animation correction data of the current frame, and the vertex animation data of the current frame simulation entity is obtained. This method can simulate the simulation effect of the simulation entity in real time during game running, and the simulation effect is better.
[0119] Corresponding to the method for physical simulation provided in the embodiments of the present disclosure, the embodiments of the present disclosure also provide a device for physical simulation. As shown in FIG. 3, the device 300 comprises:
[0120] A first determination module 301 is configured to determine vertex animation inertia data of a third frame simulation entity based on vertex animation data of a first frame simulation entity and vertex animation data of a second frame simulation entity, wherein the vertex animation of the first frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the second frame simulation entity, and the vertex animation of the second frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0121] The second determining module 302 is configured to input the vertex animation inertia data of the third frame simulation entity, the vertex animation data of the second frame simulation entity, and the vertex animation corresponding factor data of the third frame simulation entity into a pre-trained correction model, and output vertex animation correction data of the third frame simulation entity.
[0122] The generating module 303 is configured to generate the vertex animation data of the third frame simulation entity based on the vertex animation inertia data of the third frame simulation entity and the vertex animation correction data of the third frame simulation entity.
[0123] In some embodiments, the first determining module is further configured to determine, based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, a position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity; and obtain the vertex animation inertia data of the third frame simulation entity based on the vertex animation data of the second frame simulation entity and the position change amount of the same vertex of the simulation entity.
[0124] In some embodiments, the first determining module is further configured to multiply the vertex animation data of the second frame simulation entity by a corresponding first weight, multiply the position change amount of the same vertex of the simulation entity by a corresponding second weight, and then add the two weighted sums to obtain the vertex animation inertia data of the third frame simulation entity.
[0125] In some embodiments, the device further comprises an obtaining module configured to obtain vertex animation data of a plurality of third frame simulation entities, vertex animation data of a second frame simulation entity adjacent to the vertex animation of each third frame simulation entity, and vertex animation data of a first frame simulation entity adjacent to the vertex animation of the second frame simulation entity; generate vertex animation prediction data of the plurality of third frame simulation entities based on the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity, and a position change amount of the same vertex of the simulation entity in the vertex animation of each first frame simulation entity and the vertex animation data of each second frame simulation entity; and minimize a difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity to obtain a first weight corresponding to the vertex animation data of the second frame simulation entity and a second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity.
[0126] In some embodiments, the obtaining module is further configured to perform: generating a linear model based on the vertex animation data of the second frame simulation entity, the first weight corresponding to the vertex animation data of the second frame simulation entity, the position change amount of the same vertex of the simulation entity between the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity, the second weight corresponding to the position change amount of the same vertex of the simulation entity between the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity, and the vertex animation data of the third frame simulation entity; and obtaining the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight corresponding to the position change amount of the same vertex of the simulation entity between the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity by fitting the linear model to satisfy a preset condition through a least square method, wherein the preset condition is that a residual sum of squares between the vertex animation data of the third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity is minimum.
[0127] In some embodiments, the device further comprises a training module configured to perform: obtaining a training data set, wherein the training data set comprises a plurality of training samples and a label corresponding to each training sample, each training sample comprises vertex animation inertia data of a third frame simulation entity, vertex animation data of a second frame simulation entity, and vertex animation influence factor data corresponding to the vertex animation of the third frame simulation entity, and the label corresponding to each training sample is the real vertex animation data of the third frame simulation entity; inputting the training sample into a to-be-trained correction model, wherein the to-be-trained correction model outputs third frame simulation entity vertex animation correction data predicted by the training sample; superimposing the third frame simulation entity vertex animation correction data on the third frame simulation entity vertex animation inertia data to obtain predicted third frame simulation entity vertex animation data; and training the to-be-trained correction model based on the predicted third frame simulation entity vertex animation data and the real third frame simulation entity vertex animation data to obtain a pre-trained correction model.
[0128] In some embodiments, the device further comprises a dimension reduction module configured to perform: performing dimension reduction processing on the training data set to obtain dimension reduction data corresponding to the training data set.
[0129] In some embodiments, the device further comprises a splicing module configured to perform: splicing the vertex animation inertia data of the third frame simulation entity, the vertex animation data of the second frame simulation entity, and the vertex animation influence factor data corresponding to the vertex animation of the third frame simulation entity by frame to obtain spliced input data.
[0130] In some embodiments, the apparatus further comprises a dividing module configured to perform: dividing the training data set with a preset length of training window to obtain a plurality of groups of data windows; and training the to-be-trained correction model with the training data in each group of data windows to obtain a pre-trained correction model.
[0131] In some embodiments, the vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity comprises at least one of skeleton animation data and environmental parameter data.
[0132] Corresponding to the method for physical simulation provided by the embodiments of the present disclosure, the embodiments of the present disclosure also provide an electronic device. As shown in FIG. 4, the electronic device comprises: a processor 401; and a memory 402 for storing a program of the method for physical simulation, after the electronic device is powered on and the processor runs the program of the method for physical simulation, the following steps are performed:
[0133] determining vertex animation inertia data of a third frame of the simulated entity based on vertex animation data of a first frame of the simulated entity and vertex animation data of a second frame of the simulated entity; wherein the vertex animation of the first frame of the simulated entity is a vertex animation of a previous frame of the simulated entity adjacent to the vertex animation of the second frame of the simulated entity, and the vertex animation of the second frame of the simulated entity is a vertex animation of a previous frame of the simulated entity adjacent to the vertex animation of the third frame of the simulated entity;
[0134] inputting the vertex animation inertia data of the third frame of the simulated entity, the vertex animation data of the second frame of the simulated entity, and vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity into a pre-trained correction model, and the pre-trained correction model outputs vertex animation correction data of the third frame of the simulated entity; wherein the vertex animation influence factor data is used to represent factors influencing the dynamic behavior of the simulated entity;
[0135] generating the vertex animation data of the third frame of the simulated entity based on the vertex animation inertia data of the third frame of the simulated entity and the vertex animation correction data of the third frame of the simulated entity.
[0136] In some embodiments, the determination of the vertex animation inertia data of the third frame of the simulated entity based on the vertex animation data of the first frame of the simulated entity and the vertex animation data of the second frame of the simulated entity can be achieved by the following steps: determining a position change amount of the same vertex of the simulated entity in the vertex animation of the first frame of the simulated entity and the vertex animation of the second frame of the simulated entity based on the vertex animation data of the first frame of the simulated entity and the vertex animation data of the second frame of the simulated entity; and obtaining the vertex animation inertia data of the third frame of the simulated entity based on the vertex animation data of the second frame of the simulated entity and the position change amount of the same vertex of the simulated entity.
[0137] In some embodiments, the step of obtaining the vertex animation inertia data of the third frame simulation entity based on the vertex animation data of the second frame simulation entity and the position change amount of the same vertex of the simulation entity can be implemented by the following steps: multiplying the vertex animation data of the second frame simulation entity by a corresponding first weight, multiplying the position change amount of the same vertex of the simulation entity by a corresponding second weight, and then adding the weighted sums to obtain the vertex animation inertia data of the third frame simulation entity.
[0138] In some embodiments, before the step of adding the vertex animation data of the second frame simulation entity multiplied by the corresponding first weight and the position change amount of the same vertex of the simulation entity multiplied by the corresponding second weight, the following steps can also be performed: obtaining the vertex animation data of a plurality of third frame simulation entities, the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity, and the vertex animation data of the first frame simulation entity adjacent to the vertex animation of the second frame simulation entity; generating vertex animation prediction data of the plurality of third frame simulation entities based on the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity and the position change amount of the same vertex of the simulation entity in the vertex animation data of each first frame simulation entity and each second frame simulation entity; minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity.
[0139] In some embodiments, the step of minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity can be implemented by the following steps: generating a linear model based on the vertex animation data of the second frame simulation entity, the first weight corresponding to the vertex animation data of the second frame simulation entity, the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity, the second weight corresponding to the position change amount of the same vertex of the simulation entity, and the vertex animation data of the third frame simulation entity; fitting the linear model to meet a preset condition by the least square method to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity, wherein the preset condition is that the sum of the squared residuals between the vertex animation data of the third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity is minimized.
[0140] In some embodiments, before the step of inputting the vertex animation inertia data of the third frame simulated entity, the vertex animation data of the second frame simulated entity, and the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity into the pre-trained correction model, the following steps can also be performed: obtaining a training data set, the training data containing a plurality of training samples and a label corresponding to each training sample, each training sample containing vertex animation inertia data of a third frame simulated entity, vertex animation data of a second frame simulated entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity; the label corresponding to each training sample being the real vertex animation data of the third frame simulated entity; inputting the training sample into the correction model to be trained, the correction model to be trained outputting the third frame simulated entity vertex animation correction data predicted by the training sample; superimposing the third frame simulated entity vertex animation correction data on the third frame simulated entity vertex animation inertia data to obtain predicted third frame simulated entity vertex animation data; training the correction model to be trained based on the predicted third frame simulated entity vertex animation data and the real third frame simulated entity vertex animation data, and obtaining the pre-trained correction model.
[0141] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: performing dimension reduction processing on the training data set to obtain dimension-reduced data corresponding to the training data set.
[0142] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: splicing the vertex animation inertia data of the third frame simulated entity, the vertex animation data of the second frame simulated entity, and the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity by frame to obtain spliced input data.
[0143] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: dividing the training data set with a preset length of training window to obtain a plurality of data windows; training the correction model to be trained with the training data in each data window to obtain the pre-trained correction model.
[0144] In some embodiments, the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity is at least one of skeletal animation data and environment parameter data.
[0145] Through the above steps, the simulation effect of the simulated entity can be simulated in real time during game running, and the simulation effect is better.
[0146] Corresponding to the method for physical simulation provided by the embodiments of the present disclosure, the embodiments of the present disclosure also provide a computer readable storage medium, which stores a program of the method for physical simulation, and the program is run by a processor to perform the following steps:
[0147] determine vertex animation inertia data of the third frame of the simulation entity based on the vertex animation data of the first frame of the simulation entity and the vertex animation data of the second frame of the simulation entity, wherein the vertex animation of the first frame of the simulation entity is a vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the second frame of the simulation entity, and the vertex animation of the second frame of the simulation entity is a vertex animation of a previous frame of the simulation entity adjacent to the vertex animation of the third frame of the simulation entity;
[0148] input the vertex animation inertia data of the third frame of the simulation entity, the vertex animation data of the second frame of the simulation entity, and vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulation entity into a pre-trained correction model, wherein the pre-trained correction model outputs vertex animation correction data of the third frame of the simulation entity, and the vertex animation influence factor data is used to represent factors influencing dynamic behavior of the simulation entity;
[0149] generate the vertex animation data of the third frame of the simulation entity based on the vertex animation inertia data of the third frame of the simulation entity and the vertex animation correction data of the third frame of the simulation entity.
[0150] In some embodiments, the determination of the vertex animation inertia data of the third frame of the simulation entity based on the vertex animation data of the first frame of the simulation entity and the vertex animation data of the second frame of the simulation entity can be achieved by the following steps: determining a position change amount of the same vertex of the simulation entity in the vertex animation of the first frame of the simulation entity and the vertex animation of the second frame of the simulation entity based on the vertex animation data of the first frame of the simulation entity and the vertex animation data of the second frame of the simulation entity; and obtaining the vertex animation inertia data of the third frame of the simulation entity based on the vertex animation data of the second frame of the simulation entity and the position change amount of the same vertex of the simulation entity.
[0151] In some embodiments, the obtaining of the vertex animation inertia data of the third frame of the simulation entity based on the vertex animation data of the second frame of the simulation entity and the position change amount of the same vertex of the simulation entity can be achieved by the following steps: multiplying the vertex animation data of the second frame of the simulation entity by a corresponding first weight, multiplying the position change amount of the same vertex of the simulation entity by a corresponding second weight, and then adding the two weighted sums to obtain the vertex animation inertia data of the third frame of the simulation entity.
[0152] In some embodiments, before the step of adding the vertex animation data of the second frame simulation entity multiplied by the corresponding first weight and the position change amount of the same vertex of the simulation entity in the vertex animation data of the second frame simulation entity multiplied by the corresponding second weight, the following steps can also be performed: obtaining the vertex animation data of a plurality of third frame simulation entities, the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity, and the vertex animation data of the first frame simulation entity adjacent to the vertex animation of the second frame simulation entity; generating the vertex animation prediction data of the plurality of third frame simulation entities based on the position change amount of the same vertex of the simulation entity in the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity and the vertex animation of each first frame simulation entity and the vertex animation data of each second frame simulation entity; minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity.
[0153] In some embodiments, the above-mentioned minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity can be achieved by the following steps: generating a linear model based on the vertex animation data of the second frame simulation entity, the first weight corresponding to the vertex animation data of the second frame simulation entity, the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity, the second weight corresponding to the position change amount of the same vertex of the simulation entity, and the vertex animation data of the third frame simulation entity; fitting the linear model to meet a preset condition by the least square method to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity, wherein the preset condition is that the residual sum of squares between the vertex animation data of the third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity is minimized.
[0154] In some embodiments, before the step of inputting the vertex animation inertia data of the third frame simulated entity, the vertex animation data of the second frame simulated entity, and the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity into the pre-trained correction model, the following steps can also be performed: obtaining a training data set, the training data containing a plurality of training samples and a label corresponding to each training sample, each training sample containing vertex animation inertia data of a third frame simulated entity, vertex animation data of a second frame simulated entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity; the label corresponding to each training sample being the real vertex animation data of the third frame simulated entity; inputting the training sample into the correction model to be trained, the correction model to be trained outputting the third frame simulated entity vertex animation correction data predicted by the training sample; superimposing the third frame simulated entity vertex animation correction data on the third frame simulated entity vertex animation inertia data to obtain predicted third frame simulated entity vertex animation data; training the correction model to be trained based on the predicted third frame simulated entity vertex animation data and the real third frame simulated entity vertex animation data, and obtaining the pre-trained correction model.
[0155] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: performing dimensionality reduction processing on the training data set to obtain dimensionality reduction data corresponding to the training data set.
[0156] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: splicing the vertex animation inertia data of the third frame simulated entity, the vertex animation data of the second frame simulated entity, and the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity by frame to obtain spliced input data.
[0157] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: dividing the training data set with a preset length of training window to obtain a plurality of data windows; training the correction model to be trained with the training data in each data window to obtain the pre-trained correction model.
[0158] In some embodiments, the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity is at least one of skeletal animation data and environment parameter data.
[0159] Through the above steps, the simulation effect of the simulated entity can be simulated in real time during game running, and the simulation effect is better.
[0160] Corresponding to the method for physical simulation provided in the embodiments of the present disclosure, the embodiments of the present disclosure also provide a computer program product. The program product comprises a computer program stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to enable the electronic device to perform the following steps:
[0161] determining vertex animation inertia data of the third frame simulation entity based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, wherein the vertex animation of the first frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the second frame simulation entity, and the vertex animation of the second frame simulation entity is the vertex animation of a previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0162] inputting the vertex animation inertia data of the third frame simulation entity, the vertex animation data of the second frame simulation entity, and vertex animation influence factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, wherein the pre-trained correction model outputs vertex animation correction data of the third frame simulation entity, and the vertex animation influence factor data is used to represent factors influencing the dynamic behavior of the simulation entity;
[0163] generating the vertex animation data of the third frame simulation entity based on the vertex animation inertia data of the third frame simulation entity and the vertex animation correction data of the third frame simulation entity.
[0164] In some embodiments, the determination of the vertex animation inertia data of the third frame simulation entity based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity can be achieved by the following steps: determining the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity; and obtaining the vertex animation inertia data of the third frame simulation entity based on the vertex animation data of the second frame simulation entity and the position change amount of the same vertex of the simulation entity.
[0165] In some embodiments, the obtaining of the vertex animation inertia data of the third frame simulation entity based on the vertex animation data of the second frame simulation entity and the position change amount of the same vertex of the simulation entity can be achieved by the following steps: multiplying the vertex animation data of the second frame simulation entity by a corresponding first weight, multiplying the position change amount of the same vertex of the simulation entity by a corresponding second weight, and then adding the two weighted sums to obtain the vertex animation inertia data of the third frame simulation entity.
[0166] In some embodiments, before the step of adding the vertex animation data of the second frame simulation entity multiplied by the corresponding first weight and the position change amount of the same vertex of the simulation entity in the vertex animation data of the second frame simulation entity multiplied by the corresponding second weight, the following steps can also be performed: obtaining the vertex animation data of a plurality of third frame simulation entities, the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity, and the vertex animation data of the first frame simulation entity adjacent to the vertex animation of the second frame simulation entity; generating the vertex animation prediction data of the plurality of third frame simulation entities based on the position change amount of the same vertex of the simulation entity in the vertex animation data of the second frame simulation entity adjacent to the vertex animation of each third frame simulation entity and the vertex animation of each first frame simulation entity and the vertex animation data of each second frame simulation entity; minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity.
[0167] In some embodiments, the above-mentioned minimizing the difference between the vertex animation data of each third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity can be achieved by the following steps: generating a linear model based on the vertex animation data of the second frame simulation entity, the first weight corresponding to the vertex animation data of the second frame simulation entity, the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity, the second weight corresponding to the position change amount of the same vertex of the simulation entity, and the vertex animation data of the third frame simulation entity; fitting the linear model to meet a preset condition by the least square method to obtain the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity, wherein the preset condition is that the residual sum of squares between the vertex animation data of the third frame simulation entity and the corresponding vertex animation prediction data of the third frame simulation entity is minimized.
[0168] In some embodiments, before the step of inputting the vertex animation inertia data of the third frame simulated entity, the vertex animation data of the second frame simulated entity, and the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity into the pre-trained correction model, the following steps can also be performed: obtaining a training data set, the training data containing a plurality of training samples and a label corresponding to each training sample, each training sample containing vertex animation inertia data of a third frame simulated entity, vertex animation data of a second frame simulated entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity; the label corresponding to each training sample being the real vertex animation data of the third frame simulated entity; inputting the training sample into the correction model to be trained, the correction model to be trained outputting the third frame simulated entity vertex animation correction data predicted by the training sample; superimposing the third frame simulated entity vertex animation correction data on the third frame simulated entity vertex animation inertia data to obtain predicted third frame simulated entity vertex animation data; and training the correction model to be trained based on the predicted third frame simulated entity vertex animation data and the real third frame simulated entity vertex animation data, to obtain the pre-trained correction model.
[0169] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: performing dimensionality reduction processing on the training data set to obtain dimensionality reduction data corresponding to the training data set.
[0170] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: splicing the vertex animation inertia data of the third frame simulated entity, the vertex animation data of the second frame simulated entity, and the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity by frame to obtain spliced input data.
[0171] In some embodiments, after the step of obtaining the training data set, the following step can also be performed: dividing the training data set with a preset length of training window to obtain a plurality of data windows; and training the correction model to be trained with the training data in each data window to obtain the pre-trained correction model.
[0172] In some embodiments, the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulated entity is at least one of skeletal animation data and environment parameter data.
[0173] Through the above steps, the simulation effect of the simulated entity can be simulated in real time during game running, and the simulation effect is better.
[0174] It should be noted that the detailed description of the apparatus, electronic device, computer readable storage medium, and computer program product provided by the embodiments of the present disclosure can refer to the related description of the method of the embodiments of the present disclosure, which will not be described here.
[0175] The above disclosure is preferred embodiments of the present disclosure, but is not intended to limit the present disclosure. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present disclosure, and the protection scope of the present disclosure should be subject to the scope defined by the claims of the present disclosure.
[0176] In several embodiments provided by the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the above-described device embodiments are only illustrative, for example, the division of the modules is only a logical function division, and actual implementation can have another division manner, for example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed modules can be indirect coupling or communication connection through some interfaces, devices or modules, and can be electrical, mechanical or other forms.
[0177] The integrated modules implemented in the form of software function modules described above can be stored in a computer readable storage medium. The software function modules described above are stored in a storage medium, including a plurality of instructions for causing an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute part of the steps of the method described in various embodiments of the present disclosure.
[0178] It should be understood that the above processor can be a central processing module (English: Central Processing Unit, abbreviated as: CPU), and can also be other general-purpose processors, digital signal processors (English: Digital Signal Processor, abbreviated as: DSP), application specific integrated circuits (English: Application Specific Integrated Circuit, abbreviated as: ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the application can be directly embodied as hardware processor execution or executed by hardware and software module combination in the processor.
[0179] The memory can include a high-speed RAM memory, and can also include a non-volatile storage NVM, for example, at least one disk memory, and can also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0180] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present disclosure does not limit to only one bus or one type of bus.
[0181] The storage medium described above can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0182] It can be understood by those skilled in the art that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the foregoing storage medium includes ROM, RAM, magnetic disk or optical disk and various storage media that can store program codes.
[0183] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, and not to limit them; although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A method of physical simulation, the method comprising: determining vertex animation inertia data of a third frame of a simulated entity based on vertex animation data of a first frame of the simulated entity and vertex animation data of a second frame of the simulated entity, wherein the vertex animation of the first frame of the simulated entity is a previous frame of the simulated entity adjacent to the vertex animation of the second frame of the simulated entity, and the vertex animation of the second frame of the simulated entity is a previous frame of the simulated entity adjacent to the vertex animation of the third frame of the simulated entity; inputting the vertex animation inertia data of the third frame of the simulated entity, the vertex animation data of the second frame of the simulated entity, and vertex animation influencing factor data corresponding to the vertex animation of the third frame of the simulated entity into a pre-trained correction model, the pre-trained correction model outputting vertex animation correction data of the third frame of the simulated entity, wherein the vertex animation influencing factor data is used to represent factors influencing dynamic behavior of the simulated entity; generating the vertex animation data of the third frame of the simulated entity based on the vertex animation inertia data of the third frame of the simulated entity and the vertex animation correction data of the third frame of the simulated entity.
2. The method of physical simulation of claim 1, wherein, The determination of the vertex animation inertia data of the third frame of the simulated entity based on the vertex animation data of the first frame of the simulated entity and the vertex animation data of the second frame of the simulated entity comprises: determining a position change amount of a same vertex of the simulated entity in the vertex animation of the first frame of the simulated entity and the vertex animation of the second frame of the simulated entity based on the vertex animation data of the first frame of the simulated entity and the vertex animation data of the second frame of the simulated entity; obtaining the vertex animation inertia data of the third frame of the simulated entity based on the vertex animation data of the second frame of the simulated entity and the position change amount of the same vertex of the simulated entity.
3. The method of physical simulation of claim 2, wherein, The obtaining of the vertex animation inertia data of the third frame of the simulated entity based on the vertex animation data of the second frame of the simulated entity and the position change amount of the same vertex of the simulated entity comprises: the vertex animation data of the second frame of the simulated entity is multiplied by a corresponding first weight, and the position change amount of the same vertex of the simulated entity is multiplied by a corresponding second weight, and then the multiplication results are added to obtain a weighted sum as the vertex animation inertia data of the third frame of the simulated entity.
4. The method of physical simulation of claim 3, wherein, Before the step of adding the vertex animation data of the second frame of the simulated entity multiplied by the corresponding first weight and the position change amount of the same vertex of the simulated entity multiplied by the corresponding second weight, the method further comprises: obtaining vertex animation data of a plurality of third frames of simulated entities, vertex animation data of a second frame of a simulated entity adjacent to a vertex animation of each third frame of a simulated entity, and vertex animation data of a first frame of a simulated entity adjacent to a vertex animation of the second frame of the simulated entity; generating a plurality of vertex animation prediction data of the third frames of the simulated entities based on the vertex animation data of the second frame of the simulated entity adjacent to the vertex animation of each third frame of the simulated entity, and a position change amount of a same vertex of the simulated entity in the vertex animation of each first frame of the simulated entity and the vertex animation data of each second frame of the simulated entity. minimizing the difference between the vertex animation data of each third frame simulation entity and the vertex animation prediction data corresponding to the third frame simulation entity, obtaining the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity.
5. The method of physical simulation of claim 4, wherein, Said minimizing the difference between the vertex animation data of each third frame simulation entity and the vertex animation prediction data corresponding to the third frame simulation entity, comprising: based on the vertex animation data of the second frame simulation entity, the first weight corresponding to the vertex animation data of the second frame simulation entity, the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation of the second frame simulation entity, the second weight corresponding to the position change amount of the same vertex of the simulation entity, and the vertex animation data of the third frame simulation entity, a linear model is generated; fitting the linear model by least square method to meet the preset condition, obtaining the first weight corresponding to the vertex animation data of the second frame simulation entity and the second weight of the position change amount of the same vertex of the simulation entity in the vertex animation of the first frame simulation entity and the vertex animation data of the second frame simulation entity, wherein the preset condition is that the residual sum of squares between the vertex animation data of the third frame simulation entity and the vertex animation prediction data corresponding to the third frame simulation entity is minimum.
6. The method of physical simulation of claim 1, wherein, Before the step of inputting the vertex animation inertia data of the third frame simulation entity, the vertex animation data of the second frame simulation entity and the vertex animation corresponding to the vertex animation influencing factor data of the third frame simulation entity into the pre-trained correction model, the method further comprises: obtaining a training data set, the training data set containing a plurality of training samples and a label corresponding to each training sample, each training sample containing vertex animation inertia data of a third frame simulation entity, vertex animation data of a second frame simulation entity and vertex animation corresponding to vertex animation influencing factor data of a third frame simulation entity; the label corresponding to each training sample is the real vertex animation data of the third frame simulation entity; inputting the training sample into the correction model to be trained, and the correction model to be trained outputs the third frame simulation entity vertex animation correction data predicted by the training sample; superimposing the third frame simulation entity vertex animation correction data on the third frame simulation entity vertex animation inertia data to obtain the predicted third frame simulation entity vertex animation data; based on the predicted third frame simulation entity vertex animation data and the real third frame simulation entity vertex animation data, training the correction model to be trained to obtain the pre-trained correction model.
7. The method of physical simulation of claim 6, wherein, After the step of obtaining the training data set, the method further comprises: dimensionality reduction processing is performed on the training data set to obtain the dimensionality reduction data corresponding to the training data set.
8. The method of physical simulation of claim 6, wherein, After the step of obtaining the training data set, the method further comprises: The vertex animation inertia data of the third frame of the simulated entity, the vertex animation data of the second frame of the simulated entity, and vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity are spliced by frames to obtain spliced input data.
9. The method of physical simulation of claim 6, wherein, After the step of obtaining the training data set, the method further comprises: dividing the training data set by a preset length of a training window to obtain a plurality of groups of data windows; training the to-be-trained correction model with the training data in each group of data windows to obtain a pre-trained correction model.
10. The method of physical simulation of claim 1, wherein, The vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity is at least one of skeletal animation data and environment parameter data.
11. An apparatus for physical simulation, the apparatus comprising: a first determining module configured to determine vertex animation inertia data of a third frame of a simulated entity based on vertex animation data of a first frame of the simulated entity and vertex animation data of a second frame of the simulated entity, wherein the vertex animation of the first frame of the simulated entity is a vertex animation of a previous frame of the simulated entity adjacent to the vertex animation of the second frame of the simulated entity, and the vertex animation of the second frame of the simulated entity is a vertex animation of a previous frame of the simulated entity adjacent to the vertex animation of the third frame of the simulated entity; a second determining module configured to input the vertex animation inertia data of the third frame of the simulated entity, the vertex animation data of the second frame of the simulated entity, and vertex animation influence factor data corresponding to the vertex animation of the third frame of the simulated entity into a pre-trained correction model, wherein the pre-trained correction model outputs vertex animation correction data of the third frame of the simulated entity, and the vertex animation influence factor data is used to represent factors influencing dynamic behavior of the simulated entity; a generating module configured to generate vertex animation data of the third frame of the simulated entity based on the vertex animation inertia data of the third frame of the simulated entity and the vertex animation correction data of the third frame of the simulated entity.
12. An electronic device comprising: a processor; and a memory for storing a data processing program, after the electronic device is powered on and the program is run by the processor, the method according to any one of claims 1-10 is executed.
13. A computer readable storage medium storing a data processing program, the program is run by a processor to execute the method according to any one of claims 1-10.
Citation Information
Patent Citations
Mobile game distribution simulation method and system based on grid vertexes, equipment and storage medium
CN110148200A
Skeletal animation vertex correction method and model learning method, device and apparatus
CN113554736A
Virtual clothing prediction method, apparatus and device, and computer readable storage medium
CN116664733A
Physical simulation method and device, electronic equipment and readable storage medium
CN119312664A
Animation generation method and apparatus for virtual character, and storage medium and terminal
WO2023109753A1