Physical simulation method and device, electronic equipment and readable storage medium
Patent Information
- Application Number
- CN202411303526.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-09-18
AI Technical Summary
The existing flexible body simulation technology has a large amount of calculation in large-scale scenarios, making it difficult to achieve high-quality physical simulation effects, especially the deformation and complex physical performance of soft tissues, resulting in poor simulation effects.
Through the prediction and correction model based on vertex animation data, high-quality vertex animation data are generated. The pre-trained correction model combines vertex animation inertial data and influencing factor data to simulate the dynamic behavior of flexible bodies in real time and improve the simulation effect.
It realizes high-quality physical simulation effects during game running, which can better simulate the deformation and complex physical performance of soft tissues, and improves the authenticity and immersion of simulated entities.
Smart Images

Figure CN119312664A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a physical simulation method, device, electronic device and computer-readable storage medium. Background Art
[0002] Real-time physics simulation refers to the technology of simulating the movement and behavior of objects in computer games or simulation software in a way that is close to the physical 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 and make their movement more realistic.
[0003] Flexible body simulation is a physical simulation technology performed in a real-time computing environment. Existing implementation methods include particle-spring modeling and real-time finite element method solving. Particle-spring modeling discretizes flexible objects into a set of particles (nodes) and springs connecting these particles. For example, clothes and hair are considered to be composed of a large number of particles and springs connecting these particles. By calculating and simulating the force conditions of each particle and spring, the real dynamic effect of cloth in different environments can be achieved. Real-time finite element method solving establishes a muscle tissue model and discretizes the muscle tissue model into a finite element mesh. The finite element mesh is usually composed of voxel elements and nodes. Voxel elements calculate the deformation in the continuous space, use the finite element method to perform numerical calculations on the muscle tissue model, and simulate the deformation and stress distribution of the muscle tissue by solving the elastic equation. Apply the stress of the finite element mesh to each simulation node, update the new position of the node, and render the latest dynamic effect.
[0004] Although the above-mentioned implementation methods of real-time physical simulation have 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, the developers adopted the Soft Bone Solution. Among them, the Soft Bone Solution models the bones in the game, adds elastic constraints between bones, and performs real-time elastic simulation between bones. After the simulation is completed, the final rendering mesh is generated through linear skinning technology. However, due to the limitations of the bone structure, linear skinning technology is difficult to handle large-scale simulated soft tissue deformation or complex physical performance, or distortion or plastic deformation of the model surface, resulting in poor simulation effect. Summary of the invention
[0005] The present application provides a physical simulation method, device, electronic device and computer-readable storage medium, which solve the problem of poor physical simulation effect of simulated entities.
[0006] In a first aspect, an embodiment of the present application provides a method for physical simulation, the method comprising:
[0007] Based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0008] 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0009] 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, vertex animation data of the third frame simulation entity is generated.
[0010] In a second aspect, an embodiment of the present application further provides a physical simulation device, the device comprising:
[0011] A first determination module is used to determine 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; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0012] A second determination module is used 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, and the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0013] The generating module is used 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.
[0014] In a third aspect, an embodiment of the present application further provides an electronic device, including:
[0015] Processor; and
[0016] The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the following steps are performed:
[0017] Based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0018] 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0019] 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, vertex animation data of the third frame simulation entity is generated.
[0020] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a data processing program, which is executed by a processor to perform the following steps:
[0021] Based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0022] 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0023] 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, vertex animation data of the third frame simulation entity is generated.
[0024] Compared with the prior art, this application has the following advantages:
[0025] The embodiment of the present application provides a method for physical simulation, which determines 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; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity. That is, in the present application, the previous frame adjacent to the current frame and the previous previous frame adjacent to the previous frame are first used to predict the animation data of the current frame simulation entity when no force is applied. Then, 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 influencing factor data corresponding to the vertex animation of the third frame simulation 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 simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors affecting the dynamic behavior of the simulation entity. That is, the pre-trained correction model uses the animation data of the current frame simulation entity when it is not subject 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 to predict the vertex animation correction data of the current frame. Finally, 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, the vertex animation data of the third frame simulation entity is generated. That is, the predicted animation data of the current frame simulation entity when it is not subject to any force is corrected with the predicted vertex animation correction data of the current frame to obtain the vertex animation data of the current frame simulation entity. 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 THE DRAWINGS
[0026] Figure 1 It is a flow chart of a physical simulation method provided in an embodiment of the present application;
[0027] Figure 2 It is a flow chart of another physical simulation method provided in an embodiment of the present application;
[0028] Figure 3 It is a structural block diagram of a physical simulation device provided in an embodiment of the present application;
[0029] Figure 4 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0031] It should be noted that the terms "first", "second", "third", etc. in the claims, description and drawings of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence. The data used in this way are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having" and their variants are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Real-time physics simulation refers to the technology of simulating the movement and behavior of objects in computer games or simulation software in a way that is close to the physical 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 and make their movement more realistic. For example, clothes flutter in the wind or sway naturally with the character's movements; the character's hair will have real dynamic performance when running or being blown by the wind; in some simulation games, the character's body parts (such as chest and buttocks) can have more realistic physical feedback, especially with the support of motion capture technology and animation fusion technology. Flexible body simulation makes the virtual environment closer to the real world, thereby attracting players and improving the entertainment value of the game.
[0033] Flexible body simulation is a physical simulation technology performed in a real-time computing environment. Particle-Spring Model is the most common method used to discretize flexible objects into a set of particles (nodes) and springs connecting these particles. For example, clothes and hair are considered to be composed of a large number of particles and springs connecting these particles. Taking clothing simulation as an example, Particle-Spring Model can simulate the softness, elasticity and dynamic behavior of cloth. Each particle represents a vertex of the cloth mesh, while the spring simulates the constraints between adjacent particles. During 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 cloth when it is subjected to external forces. By calculating and simulating the force conditions of each particle and spring, the real dynamic effects of cloth in different environments can be achieved, such as wind blowing, collision of objects, etc.
[0034] Real-time Finite Element MethodSolving 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. Next, the muscle tissue model is discretized into a finite element mesh. The finite element mesh is usually composed of voxel elements and nodes, where voxel elements usually use tetrahedral or hexahedral voxels. Voxel elements are used to calculate the deformation in the continuous space in which they are located. The finite element method is used to perform numerical calculations on the muscle tissue model, 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 to render the latest dynamic effect.
[0035] Although the above-mentioned implementation methods of real-time physical simulation have 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 the simulation of flexible bodies, the developers adopted the Soft Bone Solution. Among them, the Soft Bone Solution models the bones in the game, adds elastic constraints between bones, and performs real-time elastic simulation between bones. After the simulation is completed, the final rendering mesh is generated by 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 mesh through linear skinning technology. However, linear skinning technology often has difficulty in accurately simulating the deformation of soft tissues, such as muscles, fat and skin, which will cause stiff and unrealistic deformation in character animation. If the deformation of simulated soft tissues is in some parts between the bone chains, the final rendering mesh generated by linear skinning technology will have unreasonable deformation and stretching. Due to the limitations of the bone structure, 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.
[0036] In order to solve the above problems in the related art, the embodiments of the present application provide a method, device, electronic device and computer-readable storage medium for physical simulation. The method of physical simulation of one embodiment of the present application can be performed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, and other terminal devices. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0037] The physical simulation method provided in the present application can be used to obtain vertex animation data of a simulated entity in real time, thereby achieving a simulation effect of the simulated entity in real time.
[0038] like Figure 1 FIG. 1 is a flow chart of a physical simulation method provided in an embodiment of the present application, wherein the method comprises:
[0039] Step S101, based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0040] In the embodiments of the present application, a simulated entity refers to an object whose dynamic behavior is realized through physical simulation in a virtual environment. Flexible body simulation usually involves objects with soft and deformable properties, such as cloth, ropes, liquids, balloons, etc. This type of simulation usually needs to consider the physical properties of the object, such as elasticity, density, friction, etc., and calculate the deformation and movement of the object in real time during the simulation process. During the simulation process of the simulated entity, the dynamic behavior will be simulated according to its physical properties, including deformation, movement and interaction with other objects.
[0041] The vertex animation data of the simulated entity refers to the position information of each vertex of the simulated entity in each frame of animation. It can be expressed as X = [x0, x1, ..., x n ], where x i Represents the vertex animation data of the simulated entity at the i-th frame, where n is a positive integer.
[0042] It should be noted that a 3D model is a mesh composed of multiple polygons (usually triangles), each of which is defined by a number of vertices. Each vertex has a specific spatial coordinate (x, y, z).
[0043] Application scenarios of simulated entities in flexible body simulation include: (1) Cloth simulation: simulate the natural swing and folding of cloth such as clothing, flags, curtains, etc. (2) Liquid simulation: simulate the flow and ripple effects of liquids such as water and oil. (3) Rope simulation: simulate the bending and stretching of slender objects such as ropes and chains. (4) Balloon simulation: simulate the dynamic effects of balloon inflation and deflation. (4) Collision detection: perform collision detection during the simulation process to ensure that the interaction between objects conforms to the laws of physics.
[0044] To obtain the vertex animation data of the simulated entity, you can create or import a 3D model in a 3D modeling software. Enable the physics engine (such as Blender's Soft Body Dynamics, Maya's Nucleus, etc.). Set the conditions for physical simulation, such as gravity, collision detection, etc. Run the physical simulation and observe the physical behavior of the 3D model in the animation. Record the new position information of all vertices in each frame. Then obtain the vertex animation data of the simulated entity. To obtain the vertex animation data of the simulated entity, you can also create a particle system in the 3D modeling software and set the properties of the particles, such as emission speed, lifespan, etc. Run the particle simulation and observe the behavior of the particles. Record the position information of all particles in each frame. The position information of all particles can be regarded as vertex animation data. To obtain the vertex animation data of the simulated entity, you can also create or import a 3D model in the 3D modeling software and manually adjust the position of the vertices in each frame to achieve the desired animation effect. Record the position information of all vertices in each frame to form vertex animation data.
[0045] It should be noted that the vertex animation of the simulated entity in the first frame, the vertex animation of the simulated entity in the second frame and the vertex animation of the simulated entity in the third frame are three adjacent frames of images. For example, the vertex animation of the simulated entity in the first frame is the vertex animation of the simulated entity in the i-2th frame, the vertex animation of the simulated entity in the second frame is the vertex animation of the simulated entity in the i-1th frame, and the vertex animation of the simulated entity in the third frame is the vertex animation of the simulated entity in the i-th frame.
[0046] In this application, the physical simulation of game character clothing is used as an example for explanation. The physical simulation of clothing in game characters refers to the realistic dynamic performance of virtual clothing in the game through the physics engine. It aims to enable the character clothing in the game to move and deform naturally according to the character's actions and environmental changes, thereby enhancing the immersion and realism of the game.
[0047] Acquiring vertex animation data of simulated clothes includes: acquiring skeletal animation data of a character model. Configuring corresponding skinning data for the character model. Driving skeletal animation data through skinning data to obtain character animation data of the character model. Then applying simulated clothes to the character model to obtain vertex animation data of simulated clothes.
[0048] Among them, obtaining skeletal animation data can be to manually create animations using professional 3D modeling software (such as Blender, Maya, 3dsMax, etc.). Use the skeletal binding (Rigging) function in the 3D modeling software to add bones to the 3D model, and set the position and rotation of the bones frame by frame through keyframe animation technology. Obtaining skeletal animation data can also be to purchase or download already made animation files for free in various online resource stores (such as Unity Asset Store, Unreal Marketplace, etc.). Obtaining skeletal animation data can also be to access the source files of a game or project and extract the animation data already in the game.
[0049] Exemplarily, skeletal animation data can be obtained by recording the skeletal animation of the character in the game. That is, determine the animation clips of the character that need to be recorded, such as basic actions such as walking, running, and attacking, as well as special actions in a specific game situation. The motion data of the character is recorded in real time through a motion capture system (including a camera, a sensor, a computing device, etc.) to obtain skeletal animation data.
[0050] 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 erroneous 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 games. (3) Animation fusion: multiple action clips can be spliced together to form a smoother animation sequence.
[0051] Skeletal animation drives the movement of the character model by controlling the bones of the character. Skeletal animation is a series of continuous skeleton images, and each frame of the skeleton image represents a moment in the time series.
[0052] Each bone of a character represents a joint or body part, which can be changed in position and rotation. Position refers to the coordinates of each bone in three-dimensional space (usually the values on the x, y, and z axes). Position determines the spatial position of the bone in the current frame. Rotation refers to the direction or posture of each bone, usually expressed in Euler angles, Quaternions, or Rotation matrices, which describe the rotation angle of the bone relative to its parent bone or world coordinates.
[0053] Skeletal animation data (DataSet-Pose) refers to the position and rotation data of the character's skeleton in each frame recorded in game development and animation production. For example, the skeleton of a game character includes the head, torso, arms, and legs. The skeletal 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 skeletal animation dataset can be recorded as Y char =[y char-0 ,y char-1 ,…,y char-n ], where y char-i Represents the position and rotation data (Pose form) of the i-th frame, x∈[0,1,2,…,n], where n is a positive integer.
[0054] Obtaining skin data (Data Skin) can be to configure skin data for skeletal animation, that is, to assign weights to each vertex of the surface mesh of the character model, such as manually adjusting the weight of each vertex of the surface mesh of the character model in 3D modeling software to ensure natural animation. Or, through automatic weight assignment tools (such as Weights Paint Mode), generate weights for each vertex of the surface mesh of the character model. Obtaining skin data can also be done by recording the skeletal animation of the character in the game to obtain the skeletal animation data set, and recording the skin data corresponding to the skeletal animation. Among them, the skin data contains all necessary skin information, such as weight data, bone hierarchy relationships, etc.
[0055] It should be noted that in 3D animation and game development, skinning data is the skin data of the character. In the present application, skinning data refers to the body data of the 3D model of the character without clothes, that is, the skinning data in the present application is the surface mesh data of the character model, which can be driven by the skeletal animation system to realize various actions.
[0056] Skin data is used to describe how to combine a 3D model's surface mesh with bones in order to achieve the effect of skeletal animation. Specifically, skin data enables the character model to deform according to the changes in skeletal animation, achieving realistic animation effects. In games and virtual reality applications, skin data enables the character to make corresponding actions based on user input or other game logic.
[0057] The skinning data contains the following information: (1) Weight distribution: the degree of association between each vertex of the surface mesh of the 3D model and the bone. The weight indicates 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 index: the index of the bone associated with each vertex of the surface mesh of the 3D model. Each vertex is affected by multiple bones at the same time, so it is necessary to record the index of these bones in the bone array. (3) Bone transformation: information such as the position, rotation, and scale of the bone in the animation. This information is used to calculate the position and posture of the bone in each frame. (4) Calculation in the vertex shader: In real-time rendering, the skinning data will be used in the vertex shader to calculate the final position of the vertex. The vertex shader will calculate the new position of each vertex based on the current bone position and rotation combined with the vertex weight.
[0058] To obtain character animation data (DataSet Character), the bone position and rotation data in each frame of skeletal animation is applied to the skinning data, and the new position of each vertex of the surface mesh of the character model is calculated through weight distribution to form 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 skeletal animation data is driven by the skinning data to obtain the character animation data.
[0059] It should be noted that in computer graphics and game development, character animation data (DataSet-Character) is a dataset used to describe the animation state and behavior of a character. It contains information about the character in different animation states, 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 character's surface mesh and the relevant bones, which is 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, being injured, etc.; the animation data in each state may include keyframes, animation curves, etc. (3) How to mix data of different animation states when the character smoothly transitions between different animations. (4) Events triggered at specific frames of the animation, such as triggering a hit effect or sound effect at the hitting point of an attack action.
[0060] To obtain the vertex animation data (DataSet Simlated) of simulated clothes, you can load or create a 3D character model in the DCC software, apply the character animation data to the 3D character model, and start 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 results of the clothes simulation. These changed vertex position data are the vertex animation data of the simulated clothes.
[0061] It should be noted that DCC software refers to professional tools used to create and edit 3D models, animations, etc., such as Blender, Maya, 3ds Max, etc.
[0062] In some embodiments, the step of obtaining the vertex animation inertia data of the simulated entity in the third frame based on the vertex animation data of the simulated entity in the second frame and the position change of the same vertex of the simulated entity includes:
[0063] The vertex animation data of the second frame simulation entity is multiplied by the corresponding first weight, and the position change of the same vertex of the simulation entity is multiplied by the corresponding second weight and then added. The weighted sum obtained is the vertex animation inertia data of the third frame simulation entity.
[0064] In the embodiments of the present application, Figure 2 As shown, it is a flow chart of another physical simulation method provided by an embodiment of the present application, and the vertex animation data of the second frame simulation entity obtained is x i-1 , the vertex animation data of the first frame simulation entity is obtained as x i-2 , then the vertex animation inertia data x of the simulated entity in the third frame init-i It can be calculated by the following formula 1.
[0065] x init-i =α⊙x i-1 +β⊙(x i-1 -x i-2 ) (Formula 1)
[0066] Among them, α is the vertex animation data x of the second frame simulation entity i-1 β is the position change x of the same vertex of the simulated entity in the vertex animation of the simulated entity in the first frame and the vertex animation of the simulated entity in the second frame i-1 -x i-2 The corresponding second weight. ⊙ is the element-wise multiplication, which refers to the element-wise multiplication of two vectors or matrices. The elements at corresponding positions are multiplied by multiplication to generate a result vector or matrix with the same dimension.
[0067] 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 of the same vertex of the simulation entity multiplied by the corresponding second weight, the method further includes:
[0068] Acquire vertex animation data of multiple third-frame simulation entities, vertex animation data of second-frame simulation entities adjacent to the vertex animation of each third-frame simulation entity, and vertex animation data of first-frame simulation entities adjacent to the vertex animation of the second-frame simulation entity;
[0069] Generate a plurality of third-frame simulation entity vertex animation prediction data based on vertex animation data of a second-frame simulation entity adjacent to vertex animation of each third-frame simulation entity and position changes of the same vertex of the simulation entity in vertex animation of each first-frame simulation entity and vertex animation data of each second-frame simulation entity;
[0070] Minimize the difference between the vertex animation data of each third-frame simulated entity and the corresponding vertex animation prediction data of the third-frame simulated entity, obtain the first weight corresponding to the vertex animation data of the second-frame simulated entity and the second weight of the position change of the same vertex of the simulated entity in the vertex animation data of the first-frame simulated entity and the vertex animation data of the second-frame simulated entity.
[0071] In some embodiments, minimizing the difference between the vertex animation data of each third-frame simulation entity and the vertex animation prediction data of the corresponding third-frame simulation entity comprises:
[0072] Generate 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 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 of the same vertex of the simulation entity, and the vertex animation data of the third frame simulation entity;
[0073] The linear model is fitted by the least squares method to meet the preset conditions, and the first weight corresponding to the vertex animation data of the simulated entity in the second frame and the second weight of the position change of the same vertex of the simulated entity in the vertex animation data of the simulated entity in the first frame and the vertex animation data of the simulated entity in the second frame are obtained, wherein the preset condition is that the sum of squares of the residuals between the vertex animation data of the simulated entity in the third frame and the corresponding vertex animation prediction data of the simulated entity in the third frame is minimized.
[0074] In the embodiment of the present application, based on the vertex animation data x of the simulated entity at the i-1th frame, i-1 , the vertex animation data x of the simulated entity of the i-1th frame i-1The corresponding first weight α, the position change x of the same vertex of the simulated entity in the vertex animation of the simulated entity in the i-2th frame and the vertex animation of the simulated entity in the i-1th frame i-1 -x i-2 , the second weight β corresponding to the position change of the same vertex of the simulated entity and the vertex animation data x of the simulated entity in the third frame i , the resulting linear model is Formula 2
[0075] x i =[α,β]*[x i-1 , x i-1 -x i-2 ](Formula 2)
[0076] The least square method is used to solve the equation of Formula 2 above, and the first weight α and the second weight β are fitted.
[0077] Step S102, 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, and the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0078] In the embodiment of the present application, the vertex animation inertia data of the simulated entity is used to characterize the movement of the simulated entity when there is no external force acting on it, wherein no external force acting on it means that no force is applied or only conservative forces such as gravity are acting on it.
[0079] Vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulated entity, that is, vertex animation influencing factor data is the factors that affect the simulation results 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 the simulation, including position, velocity, angular velocity, etc. The initial condition is the basis of the simulation and determines the starting point of the subsequent movement. (3) The forces acting on the simulated object, including gravity, thrust, tension, etc., as well as 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 trajectory of the object. (5) The constraints on the simulated object (such as hinge connections, ropes, etc.), it is necessary to define the specific form and strength of these constraints.
[0080] In the physical simulation of the game character's clothes as shown above, in addition to the above-mentioned bone structure, other factors that affect the dynamic behavior of the simulated clothes need to be considered. These factors are called 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 gravity, the motion parameters of the character relative to the scene, the position and shape of other collision bodies, etc.
[0081] 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 recorded as Y Env =[y env-0 ,y env-1 , …, y env-n ], where y env-0 Represents the environment parameter data of the simulated entity in the first frame of vertex animation data.
[0082] Taking the physical simulation of the game character's clothes as an example, the character model's character clothing is designed in 3D clothing design and simulation software (such as Marvelous Designer). Among them, the character clothing can include armor, cloaks, skirts, etc. When designing the character model's character clothing, ensure that the clothing can naturally flutter in the wind or fit the body when the character moves. Place the designed character model's character clothing on the character model built in DCC, and set the environmental parameter data corresponding to each frame of animation in DCC. Use the character animation data to drive the character model in DCC, generate and export the vertex animation data of the simulated clothes. At the same time, record the environmental parameter data and export it.
[0083] In the embodiments of the present application, Figure 2 As shown, the vertex animation inertia data x of the third frame simulation entity init-i , the second frame simulates the vertex animation data x of the entity i-1 And the vertex animation influencing factor data a corresponding to the vertex animation of the simulated entity in the third frame i A pre-trained correction model is input, and the pre-trained correction model outputs vertex animation correction data of a third frame simulation entity.
[0084] In some embodiments, 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into the pre-trained correction model, the method further includes:
[0085] Acquire a training data set, wherein the training data includes a plurality of training samples and a label corresponding to each training sample, wherein each training sample includes 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 is the real vertex animation data of the third-frame simulated entity;
[0086] Inputting the training sample into the correction model to be trained, and the correction model to be trained outputs vertex animation correction data of the third frame simulation entity predicted by the training sample;
[0087] superimposing the vertex animation correction data of the third frame simulation entity on the vertex animation inertia data of the third frame simulation entity to obtain predicted vertex animation data of the third frame simulation entity;
[0088] Based on the predicted vertex animation data of the third frame simulation entity and the actual vertex animation data of the third frame simulation entity, the correction model to be trained is trained to obtain a pre-trained correction model.
[0089] In an embodiment of the present application, multiple groups of adjacent vertex animations of the first frame simulation entity, vertex animations of the second frame simulation entity, and vertex animations of the third frame simulation entity can be obtained. Based on each group of vertex animation data of the first frame simulation entity and vertex animation data of the second frame simulation entity, the vertex animation inertia data of the third frame simulation entity is obtained. Then, each group of vertex animation inertia data of the third frame simulation entity, the vertex animation data of the second frame simulation entity in the previous frame adjacent to each vertex animation of the third frame simulation entity, and the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulation entity are input into the correction model to be trained, and the correction model to be trained outputs the predicted vertex animation correction data of the third frame simulation entity. The vertex animation inertia data of the third frame simulation entity is corrected with the predicted vertex animation correction data of the third frame simulation entity to obtain the predicted vertex animation data of the third frame simulation entity. Then, the difference between the predicted vertex animation data of the third frame simulation entity and the real vertex animation data of the third frame simulation entity is used as the loss function of the correction model to be trained, and the correction model to be trained is trained until the model converges to obtain the pre-trained correction model.
[0090] In some embodiments, after the step of acquiring the training data set, the method further comprises:
[0091] 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity are spliced frame by frame to obtain spliced input data.
[0092] In the embodiment of the present application, the physical simulation of the above-mentioned game character clothes is continued as an example. The number of frames of the skeletal animation data, the environmental parameter data and the vertex animation data of the simulated entity is the same, and the skeletal animation data, the environmental parameter data and the vertex animation data of the simulated entity correspond one to one by frame. When collating the training data, the skeletal animation data and the environmental parameter data are first spliced into the input data DataSet input by frame, which can be recorded as Y=[y0,y1,…,y n ], where y i =[y char-i ,y env-i ],y i Represents the i-th frame input data spliced with the skeletal animation data and environmental parameter data of the i-th frame, i∈[0,1,2,…,n], and n is a positive integer.
[0093] It should be noted that, in the embodiment of the present application, it is assumed that the factors affecting the simulation result of the simulated entity include skeletal animation and environment, and the skeletal animation data and the environmental parameter data are spliced as input data by frame. By splicing the skeletal animation data and the environmental parameter data as input data by frame, it is convenient for the machine learning algorithm to coordinately process the influence of the skeletal animation data and the environmental parameter data on the simulation result of the simulated entity.
[0094] In some embodiments, after the step of acquiring the training data set, the method further comprises:
[0095] Perform dimensionality reduction processing on the training data set to obtain dimensionality reduction data corresponding to the training data set.
[0096] In the embodiment of the present application, the physical simulation of the game character's clothes is taken as an example to continue the description. The input data is subjected to PCA dimensionality reduction to obtain the first PCA code corresponding to the input data, which can be recorded as W = [w0, w1, ..., w n ], where w i The first PCA encoding of the i-th frame input data after dimensionality reduction.
[0097] It should be noted that the relationship between Y and W is W = U (Yy u ), where U is the transformation matrix of PCA dimensionality reduction, y u is the mean of the input data of all frames in Y.
[0098] Among them, y i and w i The relationship between them is:
[0099] y i =U T *w i +y u (Formula 3)
[0100] Among them, U T is the transposed matrix of the transformation matrix U.
[0101] If PCA dimensionality reduction is not performed on the input data, W = Y can be directly set.
[0102] In the embodiment of the present application, PCA dimensionality reduction is also performed on the vertex animation data of the simulated entity to obtain a second PCA code corresponding to the vertex animation data of the simulated entity, which can be recorded as Z = [z0, z1, ..., z n ], where z i The second PCA code corresponding to the vertex animation data of the simulated entity of the i-th frame is used as the output data.
[0103] The relationship between the vertex animation data X of the simulated entity and the PCA code Z corresponding to the vertex animation data of the simulated entity is Z=U(Xx u ), U is the transformation matrix of PCA dimensionality reduction, x u The average of the vertex animation data of the simulated entity in all frames in X.
[0104] Among them, x i With z i The relationship between them is:
[0105] x i =U T *z i +x u (Formula 4)
[0106] It should be noted that PCA dimensionality reduction can reduce the complexity of input data and vertex animation data of simulated entities, thereby reducing the difficulty of model training in machine learning.
[0107] Dimensionality reduction is a preprocessing method for high-dimensional features of data. Dimensionality reduction is to retain the most important features of high-dimensional data and remove noise and unimportant features, so as to achieve the purpose of improving data processing speed. In actual production and application, dimensionality reduction can save a lot of time and cost within a certain range of information loss. Dimensionality reduction can make data sets easier to use, reduce the computational overhead of algorithms, remove noise, and make results easier to understand.
[0108] PCA (principal component analysis) is the most widely used data compression algorithm. In PCA, data is transformed from the original coordinate system to a new coordinate system, which is determined by the data itself. When transforming the coordinate system, the direction with the largest variance is used as the coordinate axis direction. The first new coordinate axis is the direction with the largest variance in the original data, and the second new coordinate axis is the direction orthogonal to the first new coordinate axis and with the second largest variance. Repeat this process, and the number of repetitions is the characteristic dimension of the original data.
[0109] In the embodiment of the present application, during model training, the first PCA code W corresponding to the input data is W=[w0, w1, ..., w n ] as one of the input data of the modified model to be trained, to simulate the second PCA encoding Z corresponding to the vertex animation data of the entity = [z0, z1, ..., z n ] as the output data of the correction model to be trained, and the correction model to be trained is trained. Specifically, the following steps are included:
[0110] Step 1: Generate first noise data r0 and second noise data r1;
[0111] Step 2: Apply the first noise data r0 to the second PCA code z0 of the first frame to obtain z * 0=z0+r0; where z * 0 can be used as the PCA code corresponding to the vertex animation prediction data of the first frame simulation entity;
[0112] Apply the second noise data r1 to the second PCA code z1 of the second frame to obtain z * 1=z1+r1;z * 1 can be used as the PCA encoding corresponding to the vertex animation prediction data of the second frame simulation entity;
[0113] Step 3: Starting from the third frame, perform the following calculations:
[0114] z * init-i =α⊙z * i-1 +β⊙(z * i-1 -z * i-2 ) (Formula 5)
[0115] Among them, z* init-iis the PCA code corresponding to the vertex inertia data of the simulated entity in the i-th frame, and the vertex inertia data of the simulated entity is used to characterize the movement of the simulated entity when there is no external force. ⊙ is the element-wise multiplication, which refers to the element-by-element multiplication of two vectors or matrices. The elements at corresponding positions are multiplied by multiplication to generate a result vector or matrix with the same dimension. * i-1 is the PCA encoding corresponding to the vertex animation prediction data of the simulated entity in the i-1th frame, z * i-2 The PCA encoding corresponding to the vertex animation prediction data of the simulated entity in the i-2th frame, z * i-1 -z * i-2 The PCA encoding corresponding to the change in vertex position between the vertex animation prediction data of the simulated entity at the i-2th frame and the vertex animation prediction data of the simulated entity at the i-1th frame.
[0116] α is the first weight vector corresponding to the vertex animation prediction data of the simulated entity in the i-1th frame; β is the second weight vector corresponding to the change in vertex position between the vertex animation prediction data of the simulated entity in the i-2th frame and the vertex animation prediction data of the simulated entity in the i-1th frame.
[0117] It should be noted that α and β can be fitted by solving the linear model given by Formula 4 using the least squares method.
[0118] z i =[α,β]*[z i-1 , z i-1 -z i-2 ](Formula 6)
[0119] Among them, z i 、z i-1 and z i-2 It can be the second PCA encoding Z corresponding to the vertex animation data of the simulated entity = [z0, z1, ..., z n ], by minimizing z i and [α, β]*[z i-1 , z i-1 -z i-2 ] to obtain α and β.
[0120] The least squares method is a technique for estimating unknown parameters by minimizing the sum of squared residuals between observed values and model predictions to find the best-fitting parameters.
[0121] Step 4: The PCA code z* corresponding to the vertex inertia data of the simulated entity of the i-th frame init-i , PCA code z corresponding to the vertex animation data of the simulated entity in the i-1th frame i-1 And the PCA code w corresponding to the i-1 frame input data i Input the correction model to be trained, and the correction model to be trained outputs the vertex correction data Φ(z* init-i , z i-1 , w i ). Vertex correction data Φ(z* init-i , z i-1 , w i ) is used to correct the vertex inertia data of the simulated entity.
[0122] Step 5: PCA encoding z* corresponding to the vertex inertia data of the simulated entity in the i-th frame init-i and the vertex correction data Φ(z* init-i , z i-1 , w i ) obtains the PCA code corresponding to the vertex animation prediction data of the simulated entity of the i-th frame. Specifically:
[0123] z*i=z* init-i +Φ(z* init-i , z i-1 , w i )(Formula 7)
[0124] That is, the vertex inertia data z* of the simulated entity in the i-th frame is calculated by the above formula 5. init-i and the vertex correction data Φ(z* init-i , z i-1 , w i ) is calculated to obtain the PCA code corresponding to the vertex animation prediction data of the simulated entity in the i-th frame.
[0125] Step 6: Calculate the error L
[0126] L=L pos +L vel (Formula 8)
[0127] L pos =L pos-0 +||z * i -z i || (Formula 9)
[0128] L vel =L vel-0 +||(z * i -z* i-1 )-(z i -z i-1 )|| (Formula 10)
[0129] Among them, L pos The PCA code z corresponding to the vertex animation prediction data of the simulated entity in the i-th frame * i The PCA code z corresponding to the actual data of the vertex animation of the simulated entity in the i-th frame i The error between ||z * i -z i || is the PCA code z corresponding to the vertex animation prediction data of the simulated entity in the i-th frame * i The PCA code z corresponding to the actual data of the vertex animation of the simulated entity in the i-th frame i The norm between L vel is the error between the PCA codes corresponding to the change in the first vertex position and the change in the second vertex position. The change in the first vertex position is the change in the vertex animation prediction data of the simulated entity in the i-th frame and the vertex animation prediction data of the simulated entity in the i-1th frame; the change in the second vertex position is the change in the vertex animation actual data of the simulated entity in the i-th frame and the vertex animation actual data of the simulated entity in the i-1th frame. ||(z * i -z * i-1 )-(z i -z i-1 )||The norm between the PCA codes corresponding to the change in the first vertex position and the change in the second vertex position.
[0130] Step 7: Use the gradient descent method (AdamW, AmsGrad and other optimization algorithms) to optimize the parameters of the correction model to be trained for the error L in step 6, so that the error function is minimized and the pre-trained correction model is obtained.
[0131] In some embodiments, after the step of acquiring the training data set, the method further comprises:
[0132] Dividing the training data set into training windows of preset lengths to obtain multiple groups of data windows;
[0133] The correction model to be trained is trained using the training data in each group of data windows to obtain a pre-trained correction model.
[0134] In the implementation of this application, the input data and the output data are divided into multiple groups using a training window, where the size of the training window is s. The input data in each training window is [w0, w1, ..., w s ], the output data is [z0, z1, …, z s ].
[0135] The training data is divided into multiple groups of data windows by training windows. Using all the data windows to train the correction model to be trained can reduce the error of the correction model to be trained from expanding over time.
[0136] 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.
[0137] In the embodiment of the present application, based on the vertex animation correction data Φ(x init-i , x i-1 , a i ) The vertex animation inertia data x of the third frame simulation entity obtained in step S101 init-i During the correction, the vertex animation correction data of the third frame simulation entity can be directly superimposed on the vertex animation inertia data x of the third frame simulation entity. init-i Specifically, it can be realized by the following formula 10:
[0138] x i =x init-i +Φ(x init-i , x i-1 , a i )(Formula 11)
[0139] It should be noted that if the training data used to train the correction model to be trained has been processed by dimensionality reduction, when predicting the vertex animation data of the i-th frame simulation entity during the 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-th frame simulation entity, and the vertex animation influencing factor data corresponding to the vertex animation of the i-th frame simulation entity can be processed by dimensionality reduction respectively, and after obtaining the corresponding dimensionality reduction results, they are input into the pre-trained correction model. Alternatively, the vertex animation inertia data of the i-th frame simulation entity, the vertex animation data of the i-th frame simulation entity, and the vertex animation influencing factor data corresponding to the vertex animation of the i-th frame simulation entity are first matched one by one, and then spliced to obtain the splicing result, and the splicing result is processed by dimensionality reduction. The result of the dimensionality reduction processing of the vertex animation inertia data of the i-th frame simulation entity, the vertex animation data of the i-th frame simulation entity, and the vertex animation influencing factor data corresponding to the vertex animation of the i-th frame simulation entity is input into the pre-trained correction model, and the pre-trained correction model outputs the dimensionality reduction result corresponding to the vertex animation correction data of the i-th frame simulation entity. The dimension reduction result corresponding to the vertex animation correction data of the i-th frame simulation entity is superimposed on the dimension reduction result corresponding to the vertex animation inertia data of the i-th frame simulation entity to obtain the predicted dimension reduction result corresponding to the vertex animation data of the i-th frame simulation entity.
[0140] After obtaining the dimension reduction result corresponding to the vertex animation data of the i-th frame simulation entity, the dimension reduction result 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 when restoring to the vertex animation data of the i-th frame simulation entity, x in Formula 4 is u The value can be taken as the average of the vertex animation data of the simulated entity in all frames in X.
[0141] The embodiment of the present application provides a method for physical simulation, which determines 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; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity. That is, in the present application, the previous frame adjacent to the current frame and the previous previous frame adjacent to the previous frame are first used to predict the animation data of the current frame simulation entity when no force is applied. Then, 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 influencing factor data corresponding to the vertex animation of the third frame simulation 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 simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors affecting the dynamic behavior of the simulation entity. That is, the pre-trained correction model uses the animation data of the current frame simulation entity when it is not subject 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 to predict the vertex animation correction data of the current frame. Finally, 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, the vertex animation data of the third frame simulation entity is generated. That is, the predicted animation data of the current frame simulation entity when it is not subject to any force is corrected with the predicted vertex animation correction data of the current frame to obtain the vertex animation data of the current frame simulation entity. 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.
[0142] Corresponding to the physical simulation method provided in the embodiment of the present application, the embodiment of the present application also provides a physical simulation device, such as Figure 3 As shown, the device 300 includes:
[0143] The first determination module 301 is used to determine 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; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0144] The second determination module 302 is used 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, and the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0145] The generating module 303 is used 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.
[0146] In some embodiments, the first determining module is further configured to:
[0147] Based on vertex animation data of the first frame simulation entity and vertex animation data of the second frame simulation entity, determining 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;
[0148] Based on the vertex animation data of the simulation entity in the second frame and the position change of the same vertex of the simulation entity, the vertex animation inertia data of the simulation entity in the third frame is obtained.
[0149] In some embodiments, the first determining module is further configured to:
[0150] The vertex animation data of the second frame simulation entity is multiplied by the corresponding first weight, and the position change of the same vertex of the simulation entity is multiplied by the corresponding second weight and then added. The weighted sum obtained is the vertex animation inertia data of the third frame simulation entity.
[0151] In some embodiments, the apparatus further comprises:
[0152] An acquisition module, used to acquire vertex animation data of multiple third-frame simulation entities, vertex animation data of second-frame simulation entities adjacent to the vertex animation of each third-frame simulation entity, and vertex animation data of first-frame simulation entities adjacent to the vertex animation of the second-frame simulation entity;
[0153] Generate a plurality of third-frame simulation entity vertex animation prediction data based on vertex animation data of a second-frame simulation entity adjacent to vertex animation of each third-frame simulation entity and position changes of the same vertex of the simulation entity in vertex animation of each first-frame simulation entity and vertex animation data of each second-frame simulation entity;
[0154] Minimize the difference between the vertex animation data of each third-frame simulated entity and the corresponding vertex animation prediction data of the third-frame simulated entity, obtain the first weight corresponding to the vertex animation data of the second-frame simulated entity and the second weight of the position change of the same vertex of the simulated entity in the vertex animation data of the first-frame simulated entity and the vertex animation data of the second-frame simulated entity.
[0155] In some embodiments, the acquisition module is further configured to:
[0156] Generate 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 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 of the same vertex of the simulation entity, and the vertex animation data of the third frame simulation entity;
[0157] The linear model is fitted by the least squares method to meet the preset conditions, and the first weight corresponding to the vertex animation data of the simulated entity in the second frame and the second weight of the position change of the same vertex of the simulated entity in the vertex animation data of the simulated entity in the first frame and the vertex animation data of the simulated entity in the second frame are obtained, wherein the preset condition is that the sum of squares of the residuals between the vertex animation data of the simulated entity in the third frame and the corresponding vertex animation prediction data of the simulated entity in the third frame is minimized.
[0158] In some embodiments, the apparatus further comprises:
[0159] A training module is used to obtain a training data set, wherein the training data includes a plurality of training samples and a label corresponding to each training sample, wherein each training sample includes 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 is the real vertex animation data of the third-frame simulated entity;
[0160] Inputting the training sample into the correction model to be trained, and the correction model to be trained outputs vertex animation correction data of the third frame simulation entity predicted by the training sample;
[0161] superimposing the vertex animation correction data of the third frame simulation entity on the vertex animation inertia data of the third frame simulation entity to obtain predicted vertex animation data of the third frame simulation entity;
[0162] Based on the predicted vertex animation data of the third frame simulation entity and the actual vertex animation data of the third frame simulation entity, the correction model to be trained is trained to obtain a pre-trained correction model.
[0163] In some embodiments, the apparatus further comprises:
[0164] The dimension reduction module is used to perform dimension reduction processing on the training data set to obtain dimension reduction data corresponding to the training data set.
[0165] In some embodiments, the apparatus further comprises:
[0166] The splicing module is used to splice 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity frame by frame to obtain the spliced input data.
[0167] In some embodiments, the apparatus further comprises:
[0168] A partitioning module, used to partition the training data set using training windows of preset lengths to obtain multiple groups of data windows;
[0169] The correction model to be trained is trained using the training data in each group of data windows to obtain a pre-trained correction model.
[0170] In some embodiments, the vertex animation influencing factor data corresponding to the vertex animation of the third frame simulation entity is at least one of skeletal animation data and environmental parameter data.
[0171] Corresponding to the physical simulation method provided in the embodiment of the present application, the embodiment of the present application also provides an electronic device. Figure 4 As shown, the electronic device includes: a processor 401; and a memory 402, which is used to store a program of a physical simulation method. After the electronic device is powered on and the program storing the physical simulation method is run by the processor, the following steps are performed:
[0172] Based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0173] 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0174] 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, vertex animation data of the third frame simulation entity is generated.
[0175] Corresponding to the physical simulation method provided in the embodiment of the present application, the embodiment of the present application further provides a computer-readable storage medium storing a program of the physical simulation method, the program is executed by a processor to perform the following steps:
[0176] Based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0177] 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0178] 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, vertex animation data of the third frame simulation entity is generated.
[0179] Corresponding to the physical simulation method provided in the embodiment of the present application, the embodiment of the present application further provides a computer program product, the program product comprising: a computer program, the computer program is stored in a readable storage medium, at least one processor of the electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device performs the following steps:
[0180] Based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity;
[0181] 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity;
[0182] 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, vertex animation data of the third frame simulation entity is generated.
[0183] It should be noted that for the detailed description of the apparatus, electronic device, computer-readable storage medium and computer program product provided in the embodiments of the present application, reference can be made to the relevant description of the method in the embodiments of the present application, which will not be repeated here.
[0184] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0185] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0186] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application.
[0187] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
[0188] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0189] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may 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 application is not limited to only one bus or one type of bus.
[0190] The above storage medium can be implemented by any type of volatile or non-volatile storage device 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 memory, 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.
[0191] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned 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 aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0192] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A physical simulation method, characterized in that: The method comprises: Based on the vertex animation data of the first frame simulation entity and the vertex animation data of the second frame simulation entity, determining the vertex animation inertia data of the third frame simulation entity; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity; 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the 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, vertex animation data of the third frame simulation entity is generated.
2. The method of physical simulation according to claim 1, characterized in that: The step of determining 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 comprises: Based on vertex animation data of the first frame simulation entity and vertex animation data of the second frame simulation entity, determining 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; Based on the vertex animation data of the simulation entity in the second frame and the position change of the same vertex of the simulation entity, the vertex animation inertia data of the simulation entity in the third frame is obtained.
3. The method of physical simulation according to claim 2, characterized in that: The step of obtaining the vertex animation inertia data of the simulated entity in the third frame based on the vertex animation data of the simulated entity in the second frame and the position change of the same vertex of the simulated entity comprises: The vertex animation data of the second frame simulation entity is multiplied by the corresponding first weight, and the position change of the same vertex of the simulation entity is multiplied by the corresponding second weight and then added. The weighted sum obtained is the vertex animation inertia data of the third frame simulation entity.
4. The method of physical simulation according to claim 3, characterized in that: Before the step of adding the vertex animation data of the second frame simulation entity by the corresponding first weight and the position change of the same vertex of the simulation entity by the corresponding second weight, the method further includes: Acquire vertex animation data of multiple third-frame simulation entities, vertex animation data of second-frame simulation entities adjacent to the vertex animation of each third-frame simulation entity, and vertex animation data of first-frame simulation entities adjacent to the vertex animation of the second-frame simulation entity; Generate a plurality of third-frame simulation entity vertex animation prediction data based on vertex animation data of a second-frame simulation entity adjacent to vertex animation of each third-frame simulation entity and position changes of the same vertex of the simulation entity in vertex animation of each first-frame simulation entity and vertex animation data of each second-frame simulation entity; Minimize the difference between the vertex animation data of each third-frame simulated entity and the corresponding vertex animation prediction data of the third-frame simulated entity, obtain the first weight corresponding to the vertex animation data of the second-frame simulated entity and the second weight of the position change of the same vertex of the simulated entity in the vertex animation data of the first-frame simulated entity and the vertex animation data of the second-frame simulated entity.
5. The method of physical simulation according to claim 4, characterized in that: The minimizing the difference between the vertex animation data of each third-frame simulation entity and the vertex animation prediction data of the corresponding third-frame simulation entity comprises: Generate 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 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 of the same vertex of the simulation entity, and the vertex animation data of the third frame simulation entity; The linear model is fitted by the least squares method to meet the preset conditions, and the first weight corresponding to the vertex animation data of the simulated entity in the second frame and the second weight of the position change of the same vertex of the simulated entity in the vertex animation data of the simulated entity in the first frame and the vertex animation data of the simulated entity in the second frame are obtained, wherein the preset condition is that the sum of squares of the residuals between the vertex animation data of the simulated entity in the third frame and the corresponding vertex animation prediction data of the simulated entity in the third frame is minimized.
6. The method of physical simulation according to claim 1, characterized in that: 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into the pre-trained correction model, the method further includes: Acquire a training data set, wherein the training data includes a plurality of training samples and a label corresponding to each training sample, wherein each training sample includes 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 is the real vertex animation data of the third-frame simulated entity; Inputting the training sample into the correction model to be trained, and the correction model to be trained outputs vertex animation correction data of the third frame simulation entity predicted by the training sample; superimposing the vertex animation correction data of the third frame simulation entity on the vertex animation inertia data of the third frame simulation entity to obtain predicted vertex animation data of the third frame simulation entity; Based on the predicted vertex animation data of the third frame simulation entity and the actual vertex animation data of the third frame simulation entity, the correction model to be trained is trained to obtain a pre-trained correction model.
7. The method of physical simulation according to claim 6, characterized in that: After the step of acquiring the training data set, the method further comprises: Perform dimensionality reduction processing on the training data set to obtain dimensionality reduction data corresponding to the training data set.
8. The method of physical simulation according to claim 6, characterized in that: After the step of acquiring the training data set, the method further comprises: 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity are spliced frame by frame to obtain spliced input data.
9. The method of physical simulation according to claim 6, characterized in that: After the step of acquiring the training data set, the method further comprises: Dividing the training data set into training windows of preset lengths to obtain multiple groups of data windows; The correction model to be trained is trained using the training data in each group of data windows to obtain a pre-trained correction model.
10. The method of physical simulation according to claim 1, characterized in that: The vertex animation influencing factor data corresponding to the vertex animation of the third frame simulation entity is at least one of skeletal animation data and environmental parameter data.
11. A physical simulation device, characterized in that: The device comprises: A first determination module is used to determine 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; wherein the vertex animation of the first frame simulation entity is the vertex animation of the 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 the previous frame simulation entity adjacent to the vertex animation of the third frame simulation entity; A second determination module is used 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 influencing factor data corresponding to the vertex animation of the third frame simulation entity into a pre-trained correction model, and the pre-trained correction model outputs the vertex animation correction data of the third frame simulation entity; wherein the vertex animation influencing factor data is used to characterize the factors that affect the dynamic behavior of the simulation entity; The generating module is used 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.
12. An electronic device, characterized in that: include: processor; as well as The memory is used to store 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 to 10 is executed.
13. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Virtual clothing prediction method, apparatus and device, and computer readable storage medium
CN116664733A
System and method for simulating hair and cloth using polyhedral-based constraints
US20110273445A1
Cited By
Physics simulation method and apparatus, and electronic device and readable storage medium
WO2026061202A1