Cutting interactive software simulation method and system based on GPU (Graphics Processing Unit) accelerated substance point method
By accelerating matter point method on the GPU, combining constitutive models compatible with particle grid method and Kirchoff stress tensors, the calculation overhead problem of existing software simulation methods in large-scale or high-resolution scenarios is solved, efficient simulation and multi-material effects of the software are achieved, and interactive rigid body cutting and crushing simulation are supported.
Patent Information
- Application Number
- CN202510123133.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-01-26
AI Technical Summary
The existing software simulation methods are too computationally expensive in large-scale or high-resolution virtual scenarios, so they cannot achieve interactive simulation results, and it is difficult to effectively simulate complex multi-material coupling problems.
The material point method based on GPU acceleration is adopted, through particle sampling and Euler grid construction, combined with constitutive models compatible with particle grid method and Kirchoff stress tensor, the software is efficiently simulated and multi-material effects, and an explicit crushing field and real-time surface reconstruction are introduced.
It realizes efficient simulation and multi-material effect of the software, supports interactive rigid body cutting and crushing simulation of the software, and realizes real-time surface reconstruction, meeting the performance requirements of interactive simulation in fields such as medical animation.
Smart Images

Figure CN120010998A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer graphics physical simulation, and in particular relates to a cuttable interactive software simulation method and system based on a GPU accelerated material point method. Background Art
[0002] Soft body simulation is an important and challenging technology in the field of computer graphics. Its difficulties mainly include the following aspects: reasonable modeling of software in the computer to show real physical properties, interaction with rigid bodies to produce collision crushing and cutting effects, the performance of multiple materials and material changes during the interaction process, while also meeting the interactive performance requirements. At present, in the commonly used soft body simulation methods, the particle-spring system is difficult to represent the volume and difficult to adjust the parameters. Although the finite element method has high accuracy, it is computationally complex. When it involves topological changes, it often requires re-meshing, which leads to additional increase in computational overhead. Although the method based on position dynamics is stable and efficient, it has limited accuracy and it is difficult to effectively simulate complex multi-material coupling problems.
[0003] Recently, the material point method (MPM), which has been developing rapidly in computer graphics, can solve the above-mentioned simulation quality problems. The material point method has a natural advantage in dealing with large deformations and topological changes due to its hybrid Eulerian and Lagrangian characteristics. Its effectiveness has been proven in simulating a variety of materials such as snow, foam, gravel, cloth and rubber. The introduction of a compatible particle grid algorithm further solves the numerical viscosity problem of the material point method in thin plate cutting, laying the foundation for the use of the material point method in cutting scenarios. Compared with finite element methods, the material point method is very suitable for dealing with cutting, phase change and multi-material coupling.
[0004] However, in large-scale and high-resolution virtual scenes, a large number of Lagrangian particles are required (more than 500,000), and the Euler grid needs to be finer (such as a background grid with a side length of 256). Therefore, the simulation overhead on modern high-performance CPUs is too high, and it usually takes several minutes to hours to obtain a frame of simulation results. Although the material point method is easy to parallelize, and there are many parallel acceleration methods based on modern GPUs, it still faces the problem of excessive video memory and excessive computational overhead. Therefore, it is still impossible to achieve interactive simulation results, which hinders its application in fields such as medical animation. In addition, although existing methods can realize the heterogeneity and cutting of soft bodies, they are all presented independently and have not been well considered for performance. At present, there is no interactive soft body simulation method that unifies multi-material soft body deformation, cutting interaction, fragmentation, and real-time surface reconstruction. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a cuttable interactive software simulation method based on GPU accelerated material point method, comprising the following steps:
[0006] Step S1: obtaining a three-dimensional soft body model to be simulated and a rigid body model interacting with the three-dimensional soft body model; performing particle sampling on the three-dimensional soft body model to obtain Lagrangian particles and initialize them, and performing rigid body particle sampling and initialization on the rigid body model;
[0007] Step S2: Based on the virtual scene to be simulated, construct an Euler grid, encode the grid using Morton code, and further convert the grid into 4 4 The size of 4 constitutes a secondary space block block; construct mapping tables between the Lagrangian particles and the grid and block respectively; record the block containing the Lagrangian particles as a core block and register it in the hash registry;
[0008] Step S3: Obtain the neighbor space block of the core block and add it to the hash registry, and the grid corresponding to the core block and all its neighbor blocks is called the GPU secondary sparse acceleration structure Ggrid;
[0009] Step S4: updating the state of the rigid body model and constructing a rigid body cutting field based on Ggrid;
[0010] Step S5: Based on Ggrid and the rigid body cutting field, the physical explicit integral of the three-dimensional soft body model to be simulated is solved in parallel to obtain the position of the Lagrangian particle at the next moment. The solving process is divided into four stages: the Lagrangian particle to Ggrid transfer stage, the Ggrid update stage, the Ggrid to Lagrangian particle transfer stage and the Lagrangian particle update stage; steps S2 to S5 are executed for n iterations for each frame;
[0011] Step S6: At the last nth iteration of each frame, the surface triangular mesh of the Lagrangian particle cluster is reconstructed in real time based on Ggrid according to the position of the current Lagrangian particle, and the mesh surface is further smoothed, thereby realizing the simulation and interaction between the three-dimensional soft body model and the rigid body model. Beneficial effects:
[0012] 1. The present invention provides a cuttable interactive software simulation method based on GPU accelerated material point method. Aiming at the requirements of large-scale or high-resolution software simulation scenes, the GPU accelerated material point method is used to simulate the physical movement of the software to achieve efficient simulation of the software. Aiming at the heterogeneity and dynamic material changes of the software, a constitutive model based on Kirchhoff stress tensor is introduced to support the parametric dynamic definition of different materials, achieving richer multi-material software effects, and at the same time, an explicit crushing field is introduced to achieve the object crushing effect.
[0013] 2. The present invention couples the compatible particle grid method to the material point method accelerated by GPU by building a rigid body cutting field on the GPU secondary sparse acceleration structure to support interactive rigid body cutting of software. At the same time, the original sparse acceleration grid is expanded, and the density field is built on the GPU secondary sparse acceleration structure Ggrid in accordance with the particle-to-grid transfer process. By reusing the Ggrid grid as the voxel grid for surface reconstruction, real-time surface reconstruction based on the density field is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A schematic flow chart of a cuttable interactive software simulation method based on a GPU-accelerated material point method according to the present invention;
[0015] Figure 2 This is a schematic diagram of the simulation effect of deformation and cutting of a 3D soft model;
[0016] Figure 3 This is a schematic diagram of the effect of crushing simulation;
[0017] Figure 4 This is a schematic diagram of the rendering effect after surface reconstruction;
[0018] Figure 5 It is a schematic diagram of the simulation process of cuttable interactive software based on GPU accelerated material point method;
[0019] Figure 6 The present invention is a structural block diagram of a cuttable interactive software simulation system based on a GPU-accelerated material point method. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0021] Embodiment 1
[0022] like Figure 1 As shown, an embodiment of the present invention provides a cuttable interactive software simulation method based on a GPU accelerated material point method, comprising the following steps:
[0023] Step S1: obtaining a three-dimensional soft body model to be simulated and a rigid body model interacting with the three-dimensional soft body model; performing particle sampling on the three-dimensional soft body model to obtain Lagrangian particles and initialize them, and performing rigid body particle sampling and initialization on the rigid body model;
[0024] Step S2: Based on the virtual scene to be simulated, construct an Euler grid, encode the grid using Morton code, and further convert the grid into 4 4 The size of 4 constitutes the second-level space block; construct the mapping table between Lagrangian particles and grid and block respectively; record the block containing Lagrangian particles as core block and register it in the hash registry;
[0025] Step S3: Get the neighbor block of the core block and add it to the hash registry. The grid corresponding to the core block and all its neighbor blocks is called the GPU secondary sparse acceleration structure Ggrid.
[0026] Step S4: Update the state of the rigid body model and construct a rigid body cutting field based on Ggrid;
[0027] Step S5: Based on Ggrid and the rigid body cutting field, the physical explicit integral of the three-dimensional soft model to be simulated is solved in parallel to obtain the position of the Lagrangian particle at the next moment. The solving process is divided into four stages: the Lagrangian particle to Ggrid transfer stage, the Ggrid update stage, the Ggrid to Lagrangian particle transfer stage and the Lagrangian particle update stage; steps S2 to S5 are executed for n iterations for each frame;
[0028] Step S6: At the last nth iteration of each frame, the surface triangular mesh of the Lagrangian particle cluster is reconstructed in real time based on Ggrid according to the position of the current Lagrangian particle, and the mesh surface is further smoothed, thereby realizing the simulation and interaction between the three-dimensional soft body model and the rigid body model.
[0029] In one embodiment, the above step S1: obtaining a three-dimensional soft model to be simulated and a rigid body model interacting with the three-dimensional soft model; performing particle sampling on the three-dimensional soft model to obtain Lagrangian particles and initialize them, and performing rigid body particle sampling and initialization on the rigid body model, specifically includes:
[0030] Step S11: Perform particle sampling on the 3D soft model, discretize it into Lagrangian particles of the material point method, and initialize the position of the Lagrangian particles according to the sampling points and conditions. ,quality ,density ,volume ,speed , velocity gradient and deformation gradient ;
[0031] Step S12: Sample the rigid body particles of the rigid body model and set the positions of the initial rigid body particles according to the sampling points and conditions. , as well as the world initial position, rotation matrix and velocity of the rigid body as a whole in the virtual scene.
[0032] The present invention performs physical simulation on a three-dimensional software model based on the material point method. This method discretizes the three-dimensional software model into Lagrangian particles and discretizes the computational domain into an Euler grid. First, the software model to be simulated and the rigid body model that interacts with the software are obtained through 3D scanning, modeling software or other methods. Use special software (such as Meshlab) to sample the three-dimensional software model into discrete initial point coordinates, use them as the initial reference position of the Lagrangian particles, and initialize the particle position according to the material and physical properties of the software. ,quality ,density ,volume ,speed , velocity gradient and deformation gradient Use open source geometry processing software or programmatically sample rigid body particles for rigid body models that need to interact with 3D soft body models, and initialize rigid body particles according to sampling points and condition settings. Location , as well as the world initial position, rotation matrix and velocity attributes of the rigid body as a whole in the virtual scene. For the convenience of description, the following uses subscripts represents the particle index, Indicates the grid index, superscript Respectively represent the discrete time and , time step The sampling process needs to be reasonably controlled according to the accuracy required by the simulation. The higher the sampling density, the higher the simulation accuracy, but the computational overhead also increases. Therefore, the sampling density should be adjusted according to the simulation requirements and hardware performance.
[0033] In one embodiment, the above step S2: based on the virtual scene to be simulated, construct an Euler grid, encode the grid using Morton code, and further convert the grid into 4 4 The size of 4 constitutes the second-level space block; construct the mapping table between Lagrangian particles and grid and block respectively; record the block containing Lagrangian particles as coreblock and register it in the hash registry, including:
[0034] Step S21: Divide the computational domain of the virtual scene to be simulated into Cartesian grids, use the divided Cartesian grids as the Euler grids of the material point method, encode the grids using Morton codes, and further convert the grids into 4 4 The size of 4 constitutes the second-level space block;
[0035] The computational domain of the virtual scene to be simulated is divided uniformly according to the Cartesian grid (e.g. 128 128 128), the divided Cartesian grid is used as the Euler grid for the material point method. The Morton code is used to encode the Euler grid in space. Each grid corresponds to a 64-bit Morton code according to its Cartesian grid coordinates. In order to reduce the cost of video memory and make the grid structure more suitable for GPU parallel computing, the three-dimensional Euler grid needs to be further encode with 4 4 The size of 4 constitutes a second-level spatial grid block, which will serve as an important unit for CUDA block scheduling.
[0036] Step S22: sort the Lagrangian particles according to the position of each step according to the Morton code, and generate mapping tables between the sorted Lagrangian particles and the grid and block respectively; record the block containing the Lagrangian particles as a core block, and register the core block in the hash registry;
[0037] In order to locally parallelize the global calculation, the Morton code of the grid where the Lagrangian particle is located is calculated according to its position in each frame, and the particles are sorted according to the Morton code using GPU parallel accelerated bucket sorting, histogram sorting and other algorithms. For the sorted Lagrangian particles, the mapping tables between Lagrangian particles and grids and blocks are generated respectively, and the core block containing the Lagrangian particles is registered in the hash registry. In the hash registry, the key is the Morton code of the core block, and the value is the increasing registration number. The registration number will be used as the offset when the core block is linearly compactly stored in the video memory.
[0038] Step S23: For each rigid body particle, query the hash register through its Morton code to obtain the offset of its block in the video memory, and generate a mapping from the rigid body particle serial number to the block video memory offset; if the query fails, it means that the block where the current rigid body particle is located is not registered.
[0039] In one embodiment, the above step S3: obtaining the neighbor space block of the core block and adding it to the hash register, and calling the grid corresponding to the core block and all its neighbor blocks as the GPU secondary sparse acceleration structure Ggrid, specifically includes:
[0040] Step S31: register the 7 neighbor blocks on the upper right of the core block into the hash register, and establish a neighbor mapping table to record the offsets of the 7 neighbor blocks of each core block in the video memory;
[0041] Step S32: register the remaining 19 neighbor blocks at the bottom left of the core block into the hash registry; add the neighbor mapping information of all neighbor blocks to the neighbor mapping table by searching the hash registry again, and if the neighbor block search fails, it is mapped to -1;
[0042] Step S33: The grid corresponding to the core block and all its neighbor blocks is called the GPU secondary sparse acceleration structure Ggrid.
[0043] This step further improves and expands the hash registry and neighbor mapping table by adding neighbor block information based on the hash registry and mapping table obtained in S2, thereby completing the construction of the GPU secondary sparse acceleration structure Ggrid.
[0044] In one embodiment, the above step S4: updating the state of the rigid body model and constructing a rigid body cutting field based on Ggrid specifically includes:
[0045] Step S41: Each frame will update the position and velocity of the rigid body model according to the input information, and update the position of the rigid body particles according to the current state of the rigid body model. ;
[0046] The state of the rigid body model is updated according to the interactive information input by the keyboard in each frame, such as the position, rotation matrix and velocity of the rigid body, thereby correspondingly updating the position of the rigid body particles. The required physical properties.
[0047] After updating the rigid body particle state, the following steps will further construct the color distance field (CDF) on the Euler grid based on the compatible particle grid method (CPIC). The difference is that the present invention will accelerate the information transfer process of rigid body particles to the Euler grid based on Ggrid parallel.
[0048] Step S42: Constructing a color distance field on Ggrid based on a compatible particle grid method: Each rigid body particle calculates the grid color information of the Ggrid grid node within the influence range of its B-spline kernel function, and stores and transfers the grid color information in the corresponding channel of the linear storage position of the corresponding Ggrid grid node in the video memory, wherein the grid color information includes the proximity and tags and unsigned distance ; During calculation, the information transmission of each rigid body particle to Ggrid is treated as a thread parallel calculation. According to the mapping of the rigid body particle serial number to the block memory offset, the rigid body particles mapped to -1 are eliminated from the calculation;
[0049] For each rigid body particle , calculate its surrounding 3 3 3 Ggrid grid nodes To its cutting surface Projection and signed distance of , it is considered that only when the projection point of the Ggrid grid node falls on Inside Only valid, and record the minimum unsigned distance . Proximity A value that is either 0 or 1. For Ggrid grid nodes , if the cutting surface If there is an effective distance, 1 if yes, 0 otherwise. The grid With cutting dough During calculation, the information transmission of each rigid body particle to the grid is parallelized as a thread. According to the mapping of the rigid body particle serial number to the spatial block memory offset in step S2, the rigid body particles mapped to -1 are eliminated in the calculation to speed up the calculation of the rigid body cutting field.
[0050] Step S43: Based on the cutting field information of Ggrid, the cutting field information of Lagrangian particles is constructed by information transmission from Ggrid to Lagrangian particles.
[0051] Based on the cutting field information on the Ggrid grid, the cutting field information on the particle is constructed through information transfer from the Ggrid grid to the Lagrangian particle. Inherited directly from Ggrid grid, label Calculated by weighted average: ,in For Ggrid grid With Lagrangian particles The interpolation weight between the Lagrangian particles and the normal vector Solved by moving least squares.
[0052] In one embodiment, the above step S5: updating the state of the rigid body model and constructing a rigid body cutting field based on Ggrid, specifically includes: based on Ggrid and the rigid body cutting field, solving the physical explicit integral of the three-dimensional soft body model to be simulated in parallel to obtain the position of the Lagrangian particle at the next moment, and the solving process is divided into four stages: the Lagrangian particle to Ggrid transfer stage, the Ggrid update stage, the Ggrid to Lagrangian particle transfer stage and the Lagrangian particle update stage; executing steps S2 to S5 for each frame for n iterations, specifically including:
[0053] Step S51: Lagrangian particle to Ggrid transfer stage: The mass, momentum and density of the Lagrangian particle need to be interpolated and transferred to the grid nodes of Ggrid within the range of its kernel function through the affine particle grid method; during the transfer, the cutting field compatibility relationship from the Lagrangian particle to Ggrid is judged to determine whether the physical information of the current Lagrangian particle is transferred to Ggrid. The compatibility relationship is defined as if and only if all the labels are the same for all the surfaces shared by the Lagrangian particle and the grid nodes of Ggrid, the grid nodes of Ggrid and Lagrangian particles are compatible, otherwise the two are incompatible:
[0054] ;
[0055] ;
[0056] ;
[0057] in, Represents a grid node and Lagrangian particles Compatible, incompatible is indicated by ; For the nth iteration quality; Lagrangian particle Quality, Lagrangian particle The density of For the nth iteration and The interpolation weight of For the nth iteration Momentum For the nth iteration The affine variation of is a 3 3's matrix; For the nth iteration speed;
[0058] In this stage, the embodiment of the present invention adopts B-spline as the kernel function, and the transmission range is 3 3 3, the specific steps of parallel computing are as follows: 512 threads are used as the number of threads enabled on a CUDA block. The number of CUDA blocks is determined by the number of core blocks. If the number of particles on a core block exceeds 512, it needs to be divided into multiple CUDA blocks for calculation, and most of the atomic addition operations are eliminated by using the CUDA functions at the thread warp level to optimize performance.
[0059] Step S52: Ggrid update phase: Use the moving least squares material point method to solve the force balance equation to update the grid velocity of Ggrid:
[0060] ;
[0061] in, Lagrangian particle The initial volume of For the nth iteration location; For the nth iteration location; For the nth iteration The amount of deformation gradient carried; For the secondary particle mesh kernel, , is the energy density function; the energy density function is used to describe the relationship between deformation gradient and stress. In order to express the heterogeneity of the soft body and the dynamic changes of material parameters, the generalized Kirchhoff stress tensor is introduced , by defining the bulk modulus on the Lagrangian particle , shear modulus and viscosity coefficient Realize the simulation of 3D soft models with multiple materials:
[0062] ;
[0063] in, , , ; for The determinant of ; For The gradient is 3 3 matrix; The calculation is based on the Cauchy tensor In order to achieve the crushing field effect, according to The relationship with 1 divides the Cauchy tensor into expansions With contraction Two parts, and according to The maximum eigenvalue, i.e. the breaking field value, is used to attenuate the shrinkage part, thereby achieving a crushing effect; is the bulk modulus, is the shear modulus, is the viscosity coefficient, is a 3 3 matrix, used to measure the local change of speed, Representation 3 3 Matrix Trace of.
[0064] The simulation effect of deformation and cutting of 3D software model is as follows Figure 2 In order to show the heterogeneity of the soft body and the dynamic changes of material parameters, the present invention uses Kirchhoff stress tensor to calculate stress, and realizes multi-material soft body simulation by defining different and dynamically changing bulk modulus, shear modulus and viscosity coefficient on each particle. When the maximum eigenvalue is obtained, the present invention does not use a direct eigenvalue calculation method, but uses the minimum branch 3x3 SVD decomposition to first calculate its singular value, and takes the absolute value of the singular value to find the maximum eigenvalue, thereby reducing the calculation overhead. The realization effect of the fragmentation simulation is as follows Figure 3 shown.
[0065] Step S53: Ggrid to Lagrangian particle transfer stage: Update the Lagrangian particle velocity according to the grid velocity of the new Ggrid, and do particle advection according to the new Lagrangian particle velocity to update the position of the Lagrangian particle ; During the transmission, the compatibility relationship between the Lagrangian particle and the cutting field of Ggrid is judged to determine whether the current particle collects the grid velocity. If it is not compatible, the velocity after the particle collision projection is collected and a certain thrust is applied:
[0066] ;
[0067] ;
[0068] in, for The normal vector of the rigid body at the location; is a projection function used to transform Speed Project to the appropriate value; is a coefficient used to adjust the thrust; is the unit time step;
[0069] At the same time, a certain penetration penalty force is imposed on the Lagrangian particles that penetrate the cutting surface:
[0070] ;
[0071] in, is the coefficient used to adjust the size of the penalty force; Lagrangian particle The unsigned distance, that is, the unsigned distance of the Lagrangian particle from the rigid body surface;
[0072] Step S54: Lagrangian particle update phase: update the velocity gradient and deformation gradient on the Lagrangian particle:
[0073] ;
[0074] ;
[0075] Step S55: Repeat steps S2 to S5 for n times for each frame to perform iteration.
[0076] In one embodiment, the above step S6: at the last n-th iteration of each frame, based on the position of the current Lagrangian particle, the surface triangular mesh of the Lagrangian particle cluster is reconstructed in real time based on Ggrid, and the mesh surface is further smoothed, so as to realize the simulation and interaction between the three-dimensional soft body model and the rigid body model, specifically including:
[0077] Step S61: at the last nth iteration of each frame, based on the Surface Net algorithm, the density field of the Lagrangian particles is used as a substitute for the directed signed distance field, and the B-spline interpolation function is used as the kernel function for density field calculation. At the last sub-step of each frame, the surface triangular mesh of the current frame is updated according to the density field information generated on the Ggrid grid nodes in the transfer stage from the Lagrangian particles to the Ggrid, thereby obtaining the surface triangular mesh of the Ggrid;
[0078] Step S62: De-duplicate mesh vertices in parallel and generate new vertex indices, use the Laplace method to smooth the mesh surface, thereby achieving physical simulation and interaction of objects, and completing scene rendering at the end of each frame.
[0079] The traditional Surface Net algorithm divides the space into uniform Cartesian grid cubes and calculates the directed distance (SDF) to the surface of the object at the 8 vertices of each voxel. Similar to marching cubes, the intersection points on the cube edges need to be calculated first. For an edge on a cube, if one of its two vertices is inside the object (SDF <= 0) and the other is outside the object (SDF > 0), the edge intersection points on the edge are linearly interpolated. Then the centroid of the edge intersection point is used as the isosurface vertex of each cube, and connected with the isosurface vertices in the surrounding cubes in winding order to form a triangular mesh.
[0080] Based on the material point method and Ggird structure, the present invention optimizes the Surface Net method to reconstruct the surface mesh of particles in real time. In terms of data structure, the core block containing the Lagrangian particles and its adjacent neighbor blocks are retained when reconstructing the surface, and are stored linearly in the video memory. The Ggird proposed by the present invention is reused here, that is, the computational domain space is divided into 4 4 The size of 4 is further divided into blocks. Only the blocks registered in the construction phase, namely the core block and the neighbor block, are actually used for the surface mesh calculation of Surface Net, while those unregistered blank blocks are eliminated. In addition, on the basis of the original, in step S3, the neighbor block is expanded from 7 neighbors of the semi-enclosed structure to 26 neighbors of the fully enclosed structure to solve the problem of holes caused by the density field not being completely wrapped by 0 values.
[0081] When using Surface Net to calculate the surface mesh, the particle density field is used as a substitute for the signed distance field, and the B-spline interpolation function is used as the kernel function when calculating the density field. In the last substep of each frame, the surface triangular mesh of the current frame is updated according to the density field information generated on the grid nodes during the transfer phase from the Lagrangian particles to the Ggrid grid. Specifically, a 6 6 6 GPU shared memory is used as a temporary spatial cache to fetch the density value, and a 5 5 The GPU shared memory of size 5 is used to store the required isosurface vertices. The Cartesian coordinates of the current block in the complete spatial grid can be extracted based on the spatial Morton code of the current block, and then the global position of the cube vertices is calculated by adding the local Cartesian coordinates inside the block in the GPU shared memory, and finally the vertex coordinates of the triangle mesh are interpolated.
[0082] After obtaining the triangular mesh of surface reconstruction, the surface mesh is smoothed by the Laplace method. First, use the sort function in the Thrust library to perform GPU parallel sorting on all triangular mesh vertices so that equal vertices are arranged continuously, and then use the unique function to deduplicate the vertices. Finally, a parallel binary search of the vertex list is performed to find the new index of each triangular mesh vertex. After deduplicate vertices are deduplicated, sort and deduplicate the edges of the triangular mesh, record the starting position and size of each vertex in the edge table to obtain the mapping relationship of the edge table, and smooth the position of the current vertex to the average position of its neighboring vertices. The rendering effect after surface reconstruction is as follows: Figure 4 shown.
[0083] Figure 5 A schematic diagram of the simulation process of cuttable interactive software based on GPU accelerated material point method is shown.
[0084] Table 1 shows the computational overhead of the runtime of the method of the present invention.
[0085] Table 1. Runtime computation overhead
[0086]
[0087] The present invention couples the compatible particle grid method to the GPU-accelerated material point method for the first time, which can realize efficient and fast rigid body cutting of software, thereby meeting the performance requirements of interactive simulation in fields such as medical animation. At the same time, since the present invention introduces a constitutive model based on Kirchhoff stress tensor, it can support a wider range of soft material simulation effects, and by introducing an explicit crushing field, it supports interactive simulation of object crushing effects. By constructing and reusing the GPU secondary sparse acceleration structure Ggrid as the voxel grid for surface reconstruction, the density field can be quickly constructed and the surface grid can be generated in parallel. The present invention further supports real-time surface reconstruction.
[0088] Embodiment 2
[0089] like Figure 6 As shown, an embodiment of the present invention provides a cuttable interactive software simulation system based on a GPU accelerated material point method, comprising the following modules:
[0090] The initialization module 71 is used to obtain the three-dimensional soft body model to be simulated and the rigid body model interacting with it; perform particle sampling on the three-dimensional soft body model to obtain Lagrangian particles and initialize them, and perform rigid body particle sampling and initialization on the rigid body model;
[0091] The Ggrid construction module 72 is used to construct an Euler grid based on the virtual scene to be simulated, encode the grid using Morton code, and further convert the grid into 4 4 The size of 4 constitutes the second-level space block; construct the mapping table between Lagrangian particles and grid and block respectively; record the block containing Lagrangian particles as core block and register it in the hash registry;
[0092] Expand the Ggrid module 73, which is used to obtain the neighbor space block of the core block and add it to the hash registry, and the grid corresponding to the core block and all its neighbor blocks is called the GPU secondary sparse acceleration structure Ggrid;
[0093] A rigid body cutting field construction module 74 is used to update the state of the rigid body model and construct a rigid body cutting field based on Ggrid;
[0094] The three-dimensional soft model solving module 75 is used to solve the physical explicit integral of the three-dimensional soft model to be simulated in parallel based on Ggrid and the rigid cutting field to obtain the position of the Lagrangian particle at the next moment. The solving process is divided into four stages: the Lagrangian particle to Ggrid transfer stage, the Ggrid update stage, the Ggrid to Lagrangian particle transfer stage and the Lagrangian particle update stage; for each frame, the Ggrid construction module, the Ggrid expansion module, the rigid cutting field construction module and the three-dimensional soft model solving module are executed for n-1 iterations;
[0095] The particle cluster surface reconstruction module 76 is used to reconstruct the surface triangular mesh of the Lagrangian particle cluster in real time based on the position of the current Lagrangian particle based on Ggrid during the last nth iteration of each frame, and further smooth the mesh surface, thereby realizing the simulation and interaction between the three-dimensional soft body model and the rigid body model.
[0096] A cuttable interactive software simulation device based on GPU accelerated material point method comprises one or more electronic devices, wherein the one or more electronic devices are used to implement a cuttable interactive software simulation method, system and device based on GPU accelerated material point method.
[0097] An electronic device comprises: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a cuttable interactive software simulation method, system and device based on a GPU accelerated material point method.
[0098] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present invention will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied herein.
Claims
1. A cuttable interactive software simulation method based on GPU accelerated material point method, characterized in that: include: Step S1: obtaining a 3D soft body model to be simulated and a rigid body model interacting with the soft body model; Performing particle sampling on the three-dimensional soft body model to obtain Lagrangian particles and initializing them, and performing rigid body particle sampling and initialization on the rigid body model; Step S2: Based on the virtual scene to be simulated, construct an Euler grid, encode the grid using Morton code, and further convert the grid into 4 4 The size of 4 constitutes a secondary space block block; construct mapping tables between the Lagrangian particles and the grid and block respectively; record the block containing the Lagrangian particles as a core block and register it in the hash registry; Step S3: Obtain the neighbor space block of the core block and add it to the hash registry, and the grid corresponding to the core block and all its neighbor blocks is called the GPU secondary sparse acceleration structure Ggrid; Step S4: updating the state of the rigid body model and constructing a rigid body cutting field based on Ggrid; Step S5: Based on Ggrid and the rigid body cutting field, the physical explicit integral of the three-dimensional soft body model to be simulated is solved in parallel to obtain the position of the Lagrangian particle at the next moment. The solving process is divided into four stages: the Lagrangian particle to Ggrid transfer stage, the Ggrid update stage, the Ggrid to Lagrangian particle transfer stage and the Lagrangian particle update stage; steps S2 to S5 are executed for n iterations for each frame; Step S6: At the last nth iteration of each frame, the surface triangular mesh of the Lagrangian particle cluster is reconstructed in real time based on Ggrid according to the position of the current Lagrangian particle, and the mesh surface is further smoothed, thereby realizing the simulation and interaction between the three-dimensional soft body model and the rigid body model.
2. The cuttable interactive software simulation method based on GPU accelerated material point method according to claim 1, characterized in that: The step S1: obtaining a three-dimensional soft model to be simulated and a rigid body model interacting with the three-dimensional soft model; performing particle sampling on the three-dimensional soft model to obtain Lagrangian particles and initialize them, and performing rigid body particle sampling and initialization on the rigid body model, specifically includes: Step S11: Perform particle sampling on the three-dimensional software model, discretize it into Lagrangian particles of the material point method, and initialize the position of the Lagrangian particles according to the sampling points and condition settings. ,quality ,density ,volume ,speed , velocity gradient and deformation gradient ; Step S12: Sample the rigid body particles of the rigid body model and set the positions of the initial rigid body particles according to the sampling points and conditions. , as well as the world initial position, rotation matrix and velocity of the rigid body as a whole in the virtual scene.
3. The cuttable interactive software simulation method based on GPU accelerated material point method according to claim 2, characterized in that: The step S2: constructing an Euler grid based on the virtual scene to be simulated, encoding the grid using Morton code, and further converting the grid into 4 4 The size of 4 constitutes a secondary space block block; constructs a mapping table between the Lagrangian particle and the grid and block respectively; the block containing the Lagrangian particle is recorded as a core block and registered in the hash registry, specifically including: Step S21: Divide the computational domain of the virtual scene to be simulated into Cartesian grids, use the divided Cartesian grids as the Euler grids of the material point method, encode the grids using Morton codes, and further convert the grids into 4 4 The size of 4 constitutes the second-level space block; Step S22: sorting the Lagrangian particles according to the position of each step according to the Morton code, and generating mapping tables between the sorted Lagrangian particles and the grid and the block respectively; recording the block containing the Lagrangian particles as a core block, and registering the core block in the hash registry; Step S23: For each rigid body particle, query the hash register through its Morton code to obtain the offset of its block in the video memory, and generate a mapping from the rigid body particle serial number to the block video memory offset; if the query fails, it means that the block where the current rigid body particle is located is not registered.
4. The cuttable interactive software simulation method based on GPU accelerated material point method according to claim 3, characterized in that: The step S3: obtaining the neighbor space block of the core block and adding it to the hash register, and calling the grid corresponding to the core block and all its neighbor blocks as the GPU secondary sparse acceleration structure Ggrid, specifically includes: Step S31: register the 7 neighbor blocks on the upper right of the core block into the hash register, and establish a neighbor mapping table to record the offsets of the 7 neighbor blocks of each core block in the video memory; Step S32: register the remaining 19 neighbor blocks at the lower left of the core block into the hash registry; and append the neighbor mapping information of all neighbor blocks to the neighbor mapping table by searching the hash registry again. If the neighbor block search fails, it is mapped to -1. Step S33: The grid corresponding to the core block and all its neighbor blocks is called the GPU secondary sparse acceleration structure Ggrid.
5. The cuttable interactive software simulation method based on GPU accelerated material point method according to claim 4, characterized in that: The step S4: updating the state of the rigid body model and constructing a rigid body cutting field based on Ggrid, specifically includes: Step S41: Each frame will update the position and speed of the rigid body model according to the input information, and update the position of the rigid body particles according to the current state of the rigid body model. ; Step S42: constructing a color distance field on Ggrid based on a compatible particle grid method: each rigid body particle calculates the grid color information of the Ggrid grid node within the influence range of its B-spline kernel function, and stores and transfers the grid color information in the corresponding channel of the linear storage position of the corresponding Ggrid grid node in the video memory, wherein the grid color information includes the proximity and tags and unsigned distance During calculation, the information transmission of each rigid body particle to Ggrid is used as a thread parallel calculation, and according to the mapping of the rigid body particle sequence number to the block memory offset, the rigid body particles mapped to -1 are eliminated from the calculation; Step S43: Based on the cutting field information of Ggrid, the cutting field information of the Lagrangian particle is constructed by information transmission from Ggrid to the Lagrangian particle.
6. The cuttable interactive software simulation method based on GPU accelerated material point method according to claim 5, characterized in that: The step S5: based on Ggrid and the rigid body cutting field, the physical explicit integral of the three-dimensional soft body model to be simulated is solved in parallel to obtain the position of the Lagrangian particle at the next moment, and the solving process is divided into four stages: the Lagrangian particle to Ggrid transfer stage, the Ggrid update stage, the Ggrid to Lagrangian particle transfer stage and the Lagrangian particle update stage; Steps S2 to S5 are executed for each frame for n iterations, specifically including: Step S51: Lagrangian particle to Ggrid transfer stage: The mass, momentum and density of the Lagrangian particle need to be interpolated and transferred to the grid nodes of Ggrid within the range of its kernel function through the affine particle grid method; during the transfer, the cutting field compatibility relationship from the Lagrangian particle to Ggrid is judged to determine whether the physical information of the current Lagrangian particle is transferred to Ggrid. The compatibility relationship is defined as if and only if all the labels are the same for all the surfaces shared by the Lagrangian particle and the grid nodes of Ggrid, the grid nodes of Ggrid and Lagrangian particles are compatible, otherwise the two are incompatible: ; ; ; in, Represents a grid node and Lagrangian particles Compatible, incompatible is indicated by ; For the nth iteration quality; Lagrangian particle Quality, Lagrangian particle The density of For the nth iteration and The interpolation weight of For the nth iteration Momentum For the nth iteration The affine variation of is a 3 3's matrix; For the nth iteration speed; Step S52: Ggrid update phase: Use the moving least squares material point method to solve the force balance equation to update the grid velocity of Ggrid: ; in, Lagrangian particle The initial volume of For the nth iteration location; For the nth iteration location; For the nth iteration The amount of deformation gradient carried; For the secondary particle mesh kernel, , is the energy density function; the energy density function is used to describe the relationship between deformation gradient and stress. In order to express the heterogeneity of the soft body and the dynamic changes of material parameters, the generalized Kirchhoff stress tensor is introduced , by defining the bulk modulus on the Lagrangian particle , shear modulus and viscosity coefficient Realize the simulation of the three-dimensional software model: ; in, , , ; for The determinant of ; For The gradient is 3 3 matrix; The calculation is based on the Cauchy tensor In order to achieve the crushing field effect, according to The relationship with 1 divides the Cauchy tensor into expansions With contraction Two parts, and according to The maximum eigenvalue, i.e. the breaking field value, is used to attenuate the shrinkage part, thereby achieving a crushing effect; is the bulk modulus, is the shear modulus, is the viscosity coefficient, is a 3 3 matrix, used to measure the local change of speed, Representation 3 3 Matrix traces; Step S53: Ggrid to Lagrangian particle transfer stage: Update the Lagrangian particle velocity according to the grid velocity of the new Ggrid, and do particle advection according to the new Lagrangian particle velocity to update the position of the Lagrangian particle ; During the transmission, the compatibility relationship between the Lagrangian particle and the cutting field of Ggrid is judged to determine whether the current particle collects the grid velocity. If it is not compatible, the velocity after the particle collision projection is collected and a certain thrust is applied: ; ; in, for The normal vector of the rigid body at the location; is a projection function used to transform Speed Project to the appropriate value; is a coefficient used to adjust the thrust; is the unit time step; At the same time, a certain penetration penalty force is imposed on the Lagrangian particles that penetrate the cutting surface: ; in, is the coefficient used to adjust the size of the penalty force; Lagrangian particle The signed distance of , that is, the signed distance of the Lagrangian particle from the rigid body surface; Step S54: Lagrangian particle update phase: update the velocity gradient and deformation gradient on the Lagrangian particle: ; ; Step S55: Repeat steps S2 to S5 for n times for each frame to perform iteration.
7. The cuttable interactive software simulation method based on GPU accelerated material point method according to claim 6, characterized in that: The step S6: for the last n-th iteration of each frame, based on the position of the current Lagrangian particle, the surface triangular mesh of the Lagrangian particle cluster is reconstructed in real time based on Ggrid, and the mesh surface is further smoothed, so as to realize the simulation and interaction between the three-dimensional soft body model and the rigid body model, specifically including: Step S61: at the last nth iteration of each frame, based on the Surface Net algorithm, the density field of the Lagrangian particles is used as a substitute for the directed signed distance field, and the B-spline interpolation function is used as the kernel function for density field calculation. At the last sub-step of each frame, the surface triangular mesh of the current frame is updated according to the density field information generated on the Ggrid grid nodes in the transfer stage from the Lagrangian particles to the Ggrid, thereby obtaining the surface triangular mesh of the Ggrid; Step S62: De-duplicate mesh vertices in parallel and generate new vertex indices, use the Laplace method to smooth the mesh surface, thereby achieving physical simulation and interaction of objects, and completing scene rendering at the end of each frame.
8. A cuttable interactive software simulation system based on GPU accelerated material point method, characterized in that: Includes the following modules: An initialization module is used to obtain a three-dimensional soft body model to be simulated and a rigid body model interacting with the three-dimensional soft body model; perform particle sampling on the three-dimensional soft body model to obtain Lagrangian particles and initialize them, and perform rigid body particle sampling and initialization on the rigid body model; Construct the Ggrid module, which is used to construct the Euler grid based on the virtual scene to be simulated, encode the grid using Morton code, and further convert the grid into 4 4 The size of 4 constitutes a secondary space block block; construct mapping tables between the Lagrangian particles and the grid and block respectively; the block containing the Lagrangian particles is recorded as coreblock and registered in the hash registry; Expand the Ggrid module to obtain the neighbor space block of the core block and add it to the hash registry, and call the grid corresponding to the core block and all its neighbor blocks the GPU secondary sparse acceleration structure Ggrid; Constructing a rigid body cutting field module, which is used to update the state of the rigid body model and construct a rigid body cutting field based on Ggrid; A three-dimensional soft body model solving module is used to solve the physical explicit integral of the three-dimensional soft body model to be simulated in parallel based on Ggrid and the rigid body cutting field to obtain the position of the Lagrangian particle at the next moment. The solving process is divided into four stages: the Lagrangian particle to Ggrid transfer stage, the Ggrid update stage, the Ggrid to Lagrangian particle transfer stage and the Lagrangian particle update stage; for each frame, the Ggrid construction module, the Ggrid expansion module, the rigid body cutting field construction module and the three-dimensional soft body model solving module are executed for n iterations; The particle cluster surface reconstruction module is used to reconstruct the surface triangular mesh of the Lagrangian particle cluster in real time based on the position of the current Lagrangian particle and Ggrid at the last nth iteration of each frame, and further smooth the mesh surface, so as to realize the simulation and interaction between the three-dimensional soft model and the rigid body model.
9. A cuttable interactive software simulation device based on GPU accelerated material point method, characterized in that: The method comprises one or more electronic devices, wherein the one or more electronic devices are used to implement the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Fluid simulation method based on Eulerian-Lagrangian coupling method
CN104268943A
Variable calculation domain Lagrange integral point finite element numerical simulation system and method
CN111859766A
Multiphase flow interactive simulation algorithm based on MPM and phase field model
CN115238604A
Soft robot simulation method based on material point method
CN115688212A
Phase change simulation method for elastic-viscous plastic material based on material point method
CN116092613A
Cited By
Mould bag sand cofferdam MPM simulation method and system based on artificial intelligence
CN120562220A
An artificial intelligence-based bagged sand cofferdam MPM simulation method and system
CN120562220B
Virtual reality level simulation method based on material point method and gridding surface reconstruction
CN121280679A
A virtual reality level simulation method based on material point method and gridding surface reconstruction
CN121280679B