Cuttable interactive soft body simulation method and system based on gpu accelerated material point method
By using GPU-accelerated material point method combined with compatible particle mesh method, and by constructing a sparse acceleration structure of Eulerian mesh and Morton coding, the problem of excessive computational overhead in large-scale virtual scenes in existing technologies is solved. This enables software heterogeneity and cutting interaction, fragmentation and real-time surface reconstruction, meeting the performance requirements of fields such as medical animation.
Patent Information
- Application Number
- CN202510123133.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-01-26
AI Technical Summary
Existing software simulation methods incur excessive computational overhead in large-scale and high-resolution virtual scenes, fail to achieve interactive simulation results, and do not effectively address the issues of software heterogeneity, cutting interaction, fragmentation, and real-time surface reconstruction.
We employ a GPU-accelerated material point method, constructing a two-level sparse acceleration structure using Euler meshes and Morton coding, combined with a compatible particle mesh method, to achieve interactive cutting of soft and rigid bodies. We also introduce a Kirchhoff stress tensor model to support multi-material simulation, utilize explicit fracture fields to achieve fracture effects, and perform surface reconstruction using a GPU two-level sparse acceleration structure.
It achieves efficient simulation of large-scale or high-resolution software simulation, supports the heterogeneity of software and dynamic material changes, is compatible with particle mesh method to realize interactive rigid body cutting, and reconstructs surfaces in real time, meeting the performance requirements of fields such as medical animation.
Smart Images

Figure CN120010998B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computer graphics and physical simulation, and particularly relates to a cuttable interactive soft body simulation method and system based on GPU accelerated material point method. BACKGROUND
[0002] Soft body simulation is an important and challenging technology in the field of computer graphics, and its difficulties mainly include the following aspects: reasonable modeling of soft body in the computer to exhibit real physical properties, interaction with rigid body to produce collision, fragmentation and cutting effect, multi-material performance and material change in the interaction process, while also meeting the interactive performance requirements. In the current commonly used soft body simulation method, the particle spring system is difficult to represent volume and difficult to adjust parameters. Although the finite element method has high accuracy, it is complex to calculate, and when topological changes are involved, it often needs to redivide the grid, thereby causing additional increase in calculation overhead. The method based on position dynamics is stable and efficient, but the accuracy is limited, and it is difficult to effectively simulate complex multi-material coupling problems.
[0003] Recently, the material point method (MPM) rapidly developed in computer graphics can well solve the above simulation quality problems. The material point method mixes the characteristics of Euler and Lagrange, and has a natural advantage in handling large deformation and topological changes, and its effectiveness has been proven in the simulation of snow, foam, sandstone, cloth and rubber and other materials. The compatible particle grid algorithm further solves the numerical stickiness problem of the material point method under the cutting of thin plates, laying the foundation for the use of the material point method in cutting scenarios. Compared with the finite element method, the material point method is very suitable for processing cutting, phase change and multi-material coupling.
[0004] However, in a large-scale and high-resolution virtual scene, a large number of Lagrangian particles are required (more than 500,000), and the Euler grid needs to be more fine (such as a background grid with an edge length of 256), so the simulation overhead on a modern high-performance CPU is too large, 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 now many parallel acceleration methods based on modern GPUs, it still faces the problems of excessive memory and excessive calculation overhead, so it still cannot achieve interactive simulation results, which hinders its application in the field of medical animation. In addition, although existing methods can realize the heterogeneity and cutting of soft body, they are independently presented and have not been well considered in performance. At present, there is no unified interactive soft body simulation method for multi-material soft body deformation, cutting interaction, fragmentation and real-time surface reconstruction. SUMMARY
[0005] To solve the above technical problems, the present application provides a cuttable interactive soft body simulation method based on GPU accelerated material point method, comprising the following steps:
[0006] Step S1: obtaining a three-dimensional soft model to be simulated and a rigid model interacting with the three-dimensional soft model; performing particle sampling on the three-dimensional soft model to obtain Lagrangian particles and initializing the Lagrangian particles, and performing rigid particle sampling and initialization on the rigid model;
[0007] Step S2: based on a virtual scene to be simulated, constructing an Euler grid grid, encoding the grid using a Morton code, and further constructing a two-level spatial block block with a size of 4 4 4 from the grid; respectively constructing a mapping table between the Lagrangian particles and the grid and the block; recording a block containing the Lagrangian particles as a core block and registering the core block in a hash registry;
[0008] Step S3: obtaining neighbor spatial blocks neighbor blocks of the core block and adding the neighbor blocks to the hash registry, and referring to the core block and all neighbor blocks corresponding to the grid as a GPU two-level sparse acceleration structure Ggrid;
[0009] Step S4: updating the state of the rigid model and constructing a rigid cutting field based on the Ggrid;
[0010] Step S5: based on the Ggrid and the rigid cutting field, solving a physical explicit integration of the three-dimensional soft model to be simulated in parallel to obtain a position of the Lagrangian particles at a next time, and the solving process is divided into four stages: a Lagrangian particle to Ggrid transmission stage, a Ggrid update stage, a Ggrid to Lagrangian particle transmission stage, and a Lagrangian particle update stage; performing n iterations of steps S2-S5 for each frame;
[0011] Step S6: at the last n iteration of each frame, reconstructing a surface triangular mesh mesh of a Lagrangian particle cluster in real time based on the Ggrid according to the position of the current Lagrangian particle, and further smoothing the mesh surface grid, thereby realizing simulation and interaction between the three-dimensional soft model and the rigid model. Advantageous effects:
[0012] 1. The application provides a cuttable interactive soft body simulation method based on GPU accelerated material point method, aiming at the demand of large-scale or high-resolution soft body simulation scene, using GPU accelerated material point method to simulate the physical movement of soft body, realizing efficient simulation of soft body. And aiming at the heterogeneity of soft body and dynamic material change, the constitutive model based on Kirchhoff stress tensor is introduced to support the parameterized dynamic definition of different materials, realizing more rich multi-material soft body effect, and introducing explicit breaking field, realizing the object breaking effect.
[0013] 2. The application constructs a rigid body cutting field on the GPU two-level sparse acceleration structure, couples the particle grid method into the GPU accelerated material point method to support the interactive rigid body cutting of soft body. At the same time, the original sparse acceleration grid is expanded, and the density field is constructed on the GPU two-level sparse acceleration structure Ggrid consistent with the particle-to-grid transfer process, which realizes real-time surface reconstruction based on density field by reusing Ggrid grid as voxel grid for surface reconstruction. BRIEF DESCRIPTION OF DRAWINGS
[0014] Figure 1 A flowchart of a cuttable interactive soft body simulation method based on GPU accelerated material point method of the application;
[0015] Figure 2 A simulation implementation effect diagram of three-dimensional soft body model deformation and cutting;
[0016] Figure 3 A simulation implementation effect diagram of breaking;
[0017] Figure 4 A rendering effect diagram after surface reconstruction;
[0018] Figure 5 A cuttable interactive soft body simulation flowchart based on GPU accelerated material point method;
[0019] Figure 6 A structure block diagram of a cuttable interactive soft body simulation system based on GPU accelerated material point method of the application. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical scheme and advantages of the application clearer and more apparent, the application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the application and not to limit the application. In addition, the technical features involved in each embodiment of the application described below can be combined with each other as long as they do not conflict with each other.
[0021] Example 1
[0022] AsFigure 1 As shown, the embodiment of the application provides a GPU-accelerated material point method-based cuttable interactive soft body simulation method, which comprises the following steps:
[0023] Step S1: obtaining a three-dimensional soft body model to be simulated and a rigid body model interacting therewith; performing particle sampling on the three-dimensional soft body model to obtain Lagrangian particles and initializing the Lagrangian particles, and performing rigid body particle sampling and initialization on the rigid body model;
[0024] Step S2: based on a virtual scene to be simulated, constructing an Euler grid grid, encoding the grid using Morton code, and further constructing a two-level spatial block block with a size of 4 4 4 from the grid; respectively constructing a mapping table between the Lagrangian particles and the grid and the block; recording a block containing the Lagrangian particles as a core block and registering the core block in a hash registry;
[0025] Step S3: obtaining neighbor spatial blocks neighbor block of the core block and adding the neighbor block to the hash registry; referring to the core block and all neighbor blocks corresponding to the grid as a GPU two-level sparse acceleration structure Ggrid;
[0026] Step S4: updating the state of the rigid body model and constructing a rigid body cutting field based on the Ggrid;
[0027] Step S5: based on the Ggrid and the rigid body cutting field, solving a physical explicit integral of the three-dimensional soft body model to be simulated in parallel to obtain a position of the Lagrangian particles at a next time, and the solving process comprises four stages: a Lagrangian particle-to-Ggrid transmission stage, a Ggrid updating stage, a Ggrid-to-Lagrangian particle transmission stage, and a Lagrangian particle updating stage; performing n iterations of steps S2-S5 for each frame;
[0028] Step S6: at the last n iteration of each frame, reconstructing a surface triangular mesh of a Lagrangian particle cluster in real time based on the Ggrid according to the current position of the Lagrangian particles, and further smoothing the surface mesh, so as to realize 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 body model to be simulated and a rigid body model interacting therewith; performing particle sampling on the three-dimensional soft body model to obtain Lagrangian particles and initializing the Lagrangian particles, and performing rigid body particle sampling and initialization on the rigid body model, specifically comprises:
[0030] Step S11: Perform particle sampling on the 3D soft model, discretize it into Lagrange particles using the matter point method, and set the initial position of the Lagrange particles according to the sampling points and conditions. ,quality ,density ,volume ,speed velocity gradient and deformation gradient ;
[0031] Step S12: Sample rigid body particles on the rigid body model, and initialize the positions of the rigid body particles according to the sampling points and conditions. The initial position, rotation matrix, and velocity of the rigid body in the virtual scene.
[0032] This invention performs physical simulation of a 3D soft body model based on the matter point method. This method discretizes the 3D soft body model into Lagrange particles and the computational domain into an Eulerian mesh. First, the soft body model to be simulated and the rigid body model interacting with the soft body are obtained through 3D scanning, modeling software, or other methods. Using specialized software (such as Meshlab), the 3D soft body model is sampled into discrete initial point coordinates, which are used as the initial reference positions for the Lagrange particles. The particle positions are then initialized according to the material and physical properties of the soft body. ,quality ,density ,volume ,speed velocity gradient and deformation gradient Physical properties such as rigid body particle sampling are performed on the rigid body model that needs to interact with the 3D soft body model using open-source geometry processing software or programmatically, and the rigid body particles are initialized according to the sampling points and conditions. Location This includes the rigid body's initial world position, rotation matrix, and velocity properties within the virtual scene. For ease of explanation, subscripts will be used below. Indicates particle index, Indicates grid index, superscript They represent discrete time periods, respectively. and Time step The sampling process needs to be reasonably controlled according to the required accuracy of the simulation. The higher the sampling density, the higher the simulation accuracy, but the computational cost also increases. Therefore, the sampling density should be adjusted according to the simulation requirements and hardware performance.
[0033] In one embodiment, the step S2 of constructing the Euler grid based on the virtual scene to be simulated, encoding the grid by using the Morton code, and further constituting the secondary spatial block block with the size of 4 4 4; respectively constructing the mapping table between the Lagrangian particle and the grid and the block; recording the block containing the Lagrangian particle as the core block and registering the core block in the hash register table, specifically including:
[0034] Step S21: dividing the calculation domain of the virtual scene to be simulated according to the Cartesian grid, taking the divided Cartesian grid as the Euler grid grid of the material point method, encoding the grid by using the Morton code, and further constituting the secondary spatial block block with the size of 4 4 4;
[0035] uniformly dividing the calculation domain of the virtual scene to be simulated according to the Cartesian grid (such as 128 128 128), taking the divided Cartesian grid as the Euler grid (grid) for solving the material point method. The spatial encoding of the Euler grid grid is performed by using the Morton code, and each grid corresponds to a 64-bit Morton code according to the coordinates of the Cartesian grid. In order to reduce the memory overhead and make the grid structure more suitable for GPU parallel computing, the three-dimensional Euler grid grid needs to be further constituted into a secondary spatial grid block (block) with the size of 4 4 4.
[0036] Step S22: according to the position of each step of the Lagrangian particle, sorting the Lagrangian particle according to the Morton code, generating the mapping table between the sorted Lagrangian particle and the grid and the block respectively; recording the block containing the Lagrangian particle as the core block, and registering the core block in the hash register table;
[0037] In order to parallel the global calculation locally, according to the position of each frame of the Lagrange particle, the Morton code of the grid where the particle is located is calculated, and the particle is sorted by using the GPU parallel accelerated bucket sort and histogram sort algorithm according to the Morton code. For the sorted Lagrange particle, the mapping table between the Lagrange particle and the grid and the block is generated, and the core block containing the Lagrange particle 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 registration serial number which is incremented, and the registration serial number will be used as the offset of the core block in the linear and compact storage of the video memory.
[0038] Step S23: For each rigid particle, the offset of the block in the video memory where the rigid particle is located is obtained by querying the hash registry through the Morton code of the rigid particle, and the mapping table of the rigid particle serial number to the block video memory offset is generated; if the query fails, it means that the block where the current rigid particle is located is not registered.
[0039] In one embodiment, the above step S3: obtaining the neighbor spatial blocks neighbor block of the core block and adding the neighbor block to the hash registry, the grid corresponding to the core block and all the neighbor blocks is called GPU two-level sparse acceleration structure Ggrid, which specifically includes:
[0040] Step S31: register the 7 neighbor spatial blocks neighbor block above the right of the core block in the hash registry, and establish a neighbor mapping table to record the offset of the 7 neighbor blocks of each core block in the video memory;
[0041] Step S32: register the remaining 19 neighbor blocks below the left of the core block in the hash registry; again by querying the hash registry, append the neighbor mapping information of all neighbor blocks in the neighbor mapping table, and if the neighbor block lookup fails, map it to -1;
[0042] Step S33: the grid corresponding to the core block and all the neighbor blocks is called GPU two-level sparse acceleration structure Ggrid.
[0043] This step further perfects and expands the hash registry and the neighbor mapping table according to the hash registry and the mapping table obtained in S2 by adding the information of the neighbor block, so as to complete the construction of the GPU two-level sparse acceleration structure Ggrid.
[0044] In one embodiment, step S4 above: updating the state of the rigid body model and constructing a rigid body cutting field based on Ggrid, specifically includes:
[0045] Step S41: In each frame, the position and velocity of the rigid body model will be updated according to the input information, and the position of the rigid body particles will be updated accordingly based on the current state of the rigid body model. ;
[0046] The state of the rigid body model is updated based on interaction information such as keyboard input in each frame, including the rigid body's position, rotation matrix, and velocity, thereby updating the position of the rigid body particles accordingly. The required physical properties, etc.
[0047] After updating the rigid particle state, the following steps will further construct a color distance field (CDF) on the Euler mesh based on the Compatible Particle Mesh Method (CPIC). The difference is that this invention will accelerate the information transfer process from the rigid particle to the Euler mesh based on Ggrid in parallel.
[0048] Step S42: Construct a color distance field on the Ggrid based on the compatible particle mesh method: For each rigid particle, the mesh color information of the Ggrid grid nodes within the influence range of its B-spline kernel function is calculated and stored and transferred in the corresponding channel of the corresponding Ggrid grid node in the linear storage location in video memory. The mesh color information includes proximity information. and tags and unsigned distance During calculation, the information transfer between each rigid particle and the Ggrid is processed in parallel as a thread. Based on the mapping from the rigid particle index to the block memory offset, rigid particles mapped to -1 are removed during the calculation.
[0049] For each rigid body particle Calculate the surrounding 3 3 3 Ggrid grid nodes to its cutting surface Projection and signed distance It is assumed that only when the projection point of a Ggrid node falls on... Inside Only then will it be effective, and the minimum unsigned distance will be recorded. Proximity It is a value that is either 0 or 1 for a Ggrid grid node. If with the cutting surface If an effective distance exists, then 1 if true, 0 otherwise. (Tag) Then by grid With cut face pieces The sign of the signed distance is determined. During the calculation, the information of each rigid particle to the grid is transmitted as thread parallelism. According to the mapping of the rigid particle serial number to the spatial block memory offset in step S2, the rigid particle mapped as -1 is excluded in the calculation to accelerate the calculation of the rigid cutting field.
[0050] 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.
[0051] Based on the cutting field information on the Ggrid grid, the cutting field information on the particle is constructed by information transmission from the Ggrid grid to the Lagrangian particle. The proximity of the Lagrangian particle Inherited directly from the Ggrid grid, the label is calculated by weighted average: , wherein is the interpolation weight between the Ggrid grid and the Lagrangian particle , the distance and the normal vector on the Lagrangian particle are solved by moving least square.
[0052] In one embodiment, the above step S5: updating the state of the rigid model and constructing the Ggrid-based rigid cutting field, specifically includes: based on the Ggrid and the rigid cutting field, solving the physical explicit integration of the three-dimensional soft model to be simulated in parallel to obtain the position of the Lagrangian particle at the next time, and the solving process is divided into four stages: Lagrangian particle to Ggrid transmission stage, Ggrid update stage, Ggrid to Lagrangian particle transmission stage and Lagrangian particle update stage; performing step S2-S5 for n iterations for each frame, specifically including:
[0053] Step S51: Lagrangian particle to Ggrid transmission stage: the mass, momentum and density of the Lagrangian particle need to be interpolated and transmitted to the grid nodes of the Ggrid within the kernel function range by the affine particle grid method; during the transmission, it is determined whether the physical information of the current Lagrangian particle is transmitted to the Ggrid by judging the compatible relationship of the Lagrangian particle to the cutting field of the Ggrid, and the compatible relationship is defined as: the Ggrid grid node and the Lagrangian particle are compatible if and only if all the labels of all the surfaces shared by the Lagrangian particle and the Ggrid grid node are the same, otherwise they are incompatible:
[0054] ;
[0055] ;
[0056] ;
[0057] wherein, represents a grid node and is compatible with the Lagrangian particle , and is incompatible is represented as ; is the mass of the grid node at the n-th iteration; is the mass of the Lagrangian particle , is the density of the Lagrangian particle , is the interpolation weight of the grid node and at the n-th iteration; is the momentum of the grid node at the n-th iteration; is the affine transformation amount of the grid node at the n-th iteration, which is a 3 3 matrix; is the velocity of the grid node at the n-th iteration;
[0058] In this stage, the B-spline is used as the kernel function, the range of transmission is 3 3 3 Ggrid grid area, and the parallel computing specific steps 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 the core block exceeds 512, multiple CUDA blocks need to be calculated, and most of the atomic addition operations are eliminated by using the CUDA function of the thread bundle level to optimize the performance.
[0059] Step S52: Ggrid updating stage: the force balance equation is solved by using the moving least square particle method to update the grid velocity of the Ggrid:
[0060] ;
[0061] wherein, is the initial volume of the Lagrangian particle ; is the position of the grid node at the n-th iteration; is the position of the grid node at the n-th iteration; is the position of the grid node The amount of deformation gradient carried; For the secondary particle grid kernel is , Let be the energy density function; the energy density function is used to describe the relationship between deformation gradient and stress. To represent the heterogeneity of the software and the dynamic changes in material parameters, a generalized Kirchhoff stress tensor is introduced. By defining the bulk modulus on a Lagrange particle shear modulus and viscosity coefficient Simulating 3D soft body models with multiple materials:
[0062] ;
[0063] in, , , ; for The determinant; For is The gradient is 3 3 matrices; The calculation is based on the Cauchy tensor To achieve the desired crushing effect, according to The relationship between the Cauchy tensor and 1 divides it into expansions. With contraction Two parts, and according to The maximum eigenvalue, i.e., the breaking field value, is used to attenuate the contraction. Partially, thus achieving a breaking effect; among which Bulk modulus For shear modulus, The viscosity coefficient, It is a 3 A 3x3 matrix is used to measure the local variation of velocity. Indicates 3 3 matrix The traces.
[0064] The simulation effect of deformation and cutting of 3D soft model is as follows: Figure 2 As shown. To represent the heterogeneity of soft materials and the dynamic changes in material parameters, this invention uses Kirchhoff stress tensor to calculate stress, and achieves multi-material soft material simulation by defining different and dynamically changing bulk modulus, shear modulus, and viscosity coefficients for each particle. To achieve fracture simulation, the Cauchy tensor is calculated... When determining the maximum eigenvalue, this invention does not use a direct eigenvalue calculation method. Instead, it uses a minimum-branch 3x3 SVD decomposition to first calculate its singular values and then takes the absolute value of the singular values to find the maximum eigenvalue, thereby reducing computational overhead. The simulation effect is as follows:Figure 3 are shown.
[0065] Step S53: Ggrid to Lagrangian particle transfer stage: update the Lagrangian particle velocity according to the new grid velocity of Ggrid, and update the position of the Lagrangian particle according to the new Lagrangian particle velocity ; in the transfer, determine whether the current particle collects the grid velocity by judging the cutting field compatibility relationship of the Lagrangian particle and Ggrid, if incompatible, collect the velocity after the particle collision projection and exert a certain thrust:
[0066] ;
[0067] ;
[0068] wherein, is the normal vector of the rigid body at the position of ; is a projection function used to project the velocity of to a suitable value; is a coefficient used to adjust the size of the thrust; is a unit time step;
[0069] At the same time, a certain penetration penalty force is exerted on the Lagrangian particle penetrating the cutting surface:
[0070] ;
[0071] wherein, is a coefficient used to adjust the size of the penalty force; is the unsigned distance of the Lagrangian particle from the surface of the rigid body, that is, the unsigned distance of the Lagrangian particle from the surface of the rigid body;
[0072] Step S54: Lagrangian particle update stage: update the velocity gradient and deformation gradient on the Lagrangian particle:
[0073] ;
[0074] ;
[0075] Step S55: repeat steps S2-S5 n times for each frame to perform iteration.
[0076] In one embodiment, the step S6 described above: at the last n iteration of each frame, the surface triangular mesh of the Lagrangian particle cluster is reconstructed in real time based on the Ggrid according to the position of the current Lagrangian particle, and further smoothing is performed on the mesh surface grid, so as to realize the simulation and interaction between the three-dimensional soft model and the rigid model, which specifically includes:
[0077] Step S61: at the last n iteration of each frame, using the density field of the Lagrangian particle as an alternative to the directed signed distance field based on the Surface Net algorithm, and using the B-spline interpolation function as the kernel function during the density field calculation, the surface triangular mesh of the current frame is updated according to the density field information generated on the Ggrid grid nodes in the transmission stage of the Lagrangian particle to the Ggrid in the last substep of each frame, so as to obtain the surface triangular mesh mesh of the Ggrid;
[0078] Step S62: parallel de-duplication is performed on the mesh grid vertex to generate a new vertex index, and the Laplace method is used to realize the smoothing of the mesh surface grid, so as to realize the physical simulation and interaction of the object, and the scene rendering is completed 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 object surface on the 8 vertices of each voxel. Similar to marching cubes, the intersection point on the edge of the cube needs to be calculated first. For an edge on the cube, if the vertices at both ends are one inside the object (SDF <=0) and one outside the object (SDF >0), the edge intersection point on the edge is linearly interpolated. Then the barycenter of the edge intersection point is taken as the isosurface vertex of each cube, and the triangular mesh is connected according to the winding order and the isosurface vertices in the surrounding cubes.
[0080] Based on the material point method and the Ggird structure, the Surface Net method is optimized to reconstruct the surface mesh of the particle in real time. In terms of data structure, in view of the sparse characteristics that the object is often concentrated in some areas, the core block containing the Lagrangian particle and the neighbor block adjacent thereto are retained during the reconstruction of the surface, and are linearly stored in the video memory. Here, the Ggird proposed in the application is reused, that is, the calculation domain space is divided into 4 4 The size of the 4 is further divided into blocks. Only the blocks registered in the construction phase, i.e. the core block and the neighbor block, are actually used in the surface mesh calculation of the Surface Net. The blank blocks that are not registered are discarded. In addition, the neighbor block is expanded from 7 neighbors in the half-enclosing structure to 26 neighbors in the full-enclosing structure in step S3 to solve the problem of holes caused by the incomplete wrapping of the density field by 0 values.
[0081] In the calculation of the surface mesh mesh using the Surface Net, the density field of the particles is used as an alternative to the directed signed distance field, and the B-spline interpolation function is used as the kernel function in the calculation of the density field, In 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 grid nodes in the transfer stage of the Lagrangian particles to the Ggrid mesh. Specifically, a 6 6 6 GPU shared memory is used as a temporary space to cache the density values, and a 5 5 5 GPU shared memory is used to store the required isosurface vertex. According to the spatial Morton code of the current block, the Cartesian coordinates of the current block in the complete spatial grid can be extracted, and the global position of the cube vertex can be calculated by adding the local Cartesian coordinates inside the GPU shared memory block. Finally, the vertex coordinates of the triangular mesh are interpolated.
[0082] After obtaining the triangular mesh of the surface reconstruction, the surface mesh is smoothed by the Laplace method. First, the sort function in the Thrust library is used to perform GPU parallel sorting on all the triangular mesh vertices, so that the equal vertices are arranged continuously. Then, the unique function is used to complete the vertex de-duplication. Finally, the new index of each triangular mesh vertex is found by performing parallel binary search on the vertex list. After completing the vertex de-duplication, the edges of the triangular mesh are sorted and de-duplicated, and the mapping relationship of the edge table is recorded by recording the starting position and size of each vertex in the edge table, so that the position of the current vertex is smoothed to the average position of its neighbor vertices. The rendering effect after surface reconstruction is shown in Figure 4 .
[0083] Figure 5 A flowchart of the cuttable interactive soft body simulation process based on GPU accelerated particle method is shown.
[0084] Table 1 shows the calculation overhead of the method of the present application.
[0085] Table 1 shows the calculation overhead of the method of the present application.
[0086]
[0087] This invention is the first to couple a compatible particle mesh method to a GPU-accelerated matter point method, enabling efficient and rapid rigid body cutting of soft objects, thus meeting the performance requirements of interactive simulations in fields such as medical animation. Furthermore, by introducing a constitutive model based on Kirchhoff's stress tensor, this invention supports a wider range of soft material simulation effects, and by introducing an explicit fracture field, it supports interactive simulation of object fracture effects. Moreover, by constructing and reusing the GPU-accelerated secondary sparse structure Ggrid as the voxel mesh for surface reconstruction, density fields can be rapidly constructed and surface meshes generated in parallel, further supporting real-time surface reconstruction.
[0088] Example 2
[0089] like Figure 6 As shown, this embodiment of the invention provides a cuttable interactive software simulation system based on GPU-accelerated matter point method, comprising the following modules:
[0090] Initialization module 71 is used to acquire the three-dimensional soft body model to be simulated and the rigid body model to interact with it; to perform particle sampling on the three-dimensional soft body model to obtain Lagrange particles and initialize them, and to perform rigid body particle sampling and initialization on the rigid body model.
[0091] The Ggrid module 72 is constructed to build an Eulerian grid based on the virtual scene to be simulated. The grid is encoded using Morton codes and further encoded using 4x4. 4 A size of 4 constitutes a second-level spatial block; a mapping table is constructed between the Lagrange particle and the grid and the block respectively; the block containing the Lagrange particle is recorded as the core block and registered in the hash registry;
[0092] The Ggrid module 73 is extended to obtain the neighbor blocks of the core block and add them 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.
[0093] Construct a rigid body cutting field module 74 to update the state of the rigid body model and construct a rigid body cutting field based on Ggrid;
[0094] A three-dimensional soft body model solving module 75 is configured to solve the physical explicit integration of the three-dimensional soft body model to be simulated based on the Ggrid and the rigid body cutting field in parallel to obtain the position of the Lagrangian particle at the next time, and the solving process is divided into four stages: the Lagrangian particle to Ggrid transmission stage, the Ggrid updating stage, the Ggrid to Lagrangian particle transmission stage and the Lagrangian particle updating stage; for each frame, the construction of the Ggrid module, the expansion of the Ggrid module, the construction of the rigid body cutting field module and the solving of the three-dimensional soft body model module are iterated n-1 times.
[0095] A particle cluster surface reconstruction module 76 is configured to reconstruct the surface triangular mesh mesh of the Lagrangian particle cluster in real time based on the Ggrid according to the position of the current Lagrangian particle at the last n-th iteration of each frame, and further smooth the mesh surface grid, so as to realize the simulation and interaction between the three-dimensional soft body model and the rigid body model.
[0096] A cuttable interactive soft body simulation device based on GPU accelerated material point method, comprising one or more electronic devices, wherein the one or more electronic devices are configured to implement a cuttable interactive soft body simulation method, system and device based on GPU accelerated material point method.
[0097] An electronic device, comprising: one or more processors; a memory configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are configured to implement a cuttable interactive soft body simulation method, system and device based on GPU accelerated material point method.
[0098] The above is only a specific embodiment of the present application, 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 can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application shall not be limited to these embodiments shown herein, but shall conform to the widest scope consistent with the principles and novel features applied herein.
Claims
1. A method for slicable interactive software simulation based on GPU-accelerated matter point method, characterized in that, include: Step S1: Obtain the 3D soft body model to be simulated, and the rigid body model to interact with it; Particle sampling is performed on the three-dimensional soft model to obtain Lagrange particles and initialize them, and rigid body particle sampling and initialization are performed 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 encode the grid using 4... 4 A size of 4 constitutes a secondary spatial block; a mapping table is constructed between the Lagrange particle and the grid and block respectively; the block containing the Lagrange particle is recorded as the core block and registered in the hash registry; Step S3: Obtain the neighbor blocks of the core block and add them 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. Step S4: Update the state of the rigid body model and construct a rigid body cutting field based on Ggrid; Step S5: Based on Ggrid and the rigid body cutting field, solve the physical explicit integral of the three-dimensional soft model to be simulated in parallel to obtain the position of the Lagrange particle at the next moment. The solution process is divided into four stages: Lagrange particle to Ggrid transfer stage, Ggrid update stage, Ggrid to Lagrange particle transfer stage, and Lagrange particle update stage; execute steps S2 to S5 n times for each frame; Step S6: During the last nth iteration of each frame, based on the current position of the Lagrange particles, the surface triangular mesh of the Lagrange particle cluster is reconstructed in real time using Ggrid, and the mesh surface is further smoothed, thereby realizing the simulation and interaction between the three-dimensional soft model and the rigid model.
2. The method for slicable interactive software simulation based on GPU-accelerated matter point method according to claim 1, characterized in that, Step S1: Obtain the 3D soft body model to be simulated, and the rigid body model to interact with; perform particle sampling on the 3D soft body model to obtain Lagrange particles and initialize them, and perform rigid body particle sampling and initialization on the rigid body model, specifically including: Step S11: Perform particle sampling on the three-dimensional soft model, discretize it into Lagrange particles using the matter point method, and initialize the positions of the Lagrange particles according to the sampling points and conditions. ,quality ,density ,volume ,speed velocity gradient and deformation gradient ; Step S12: Perform rigid body particle sampling on the rigid body model, and set the initial position of the rigid body particles according to the sampling points and conditions. The initial position, rotation matrix, and velocity of the rigid body in the virtual scene.
3. The method for slicable interactive software simulation based on GPU-accelerated matter point method according to claim 2, characterized in that, Step S2: Based on the virtual scene to be simulated, an Euler grid is constructed, the grid is encoded using Morton code, and the grid is further encoded using 4... 4 A size of 4 constitutes a secondary spatial block; a mapping table is constructed between the Lagrange particle and the grid and block respectively; the block containing the Lagrange particle is denoted as the core block and registered in the hash registry, specifically including: Step S21: Divide the computational domain of the virtual scene to be simulated into a Cartesian grid. The resulting Cartesian grid is used as the Eulerian grid for the matter point method. Encode the grid using Morton code, and further encode the grid using 4x4. 4 A size of 4 constitutes a secondary spatial block; Step S22: Sort the Lagrange particles according to their positions at each step using Morton codes. Generate mapping tables between the sorted Lagrange particles and grids and blocks respectively. Record the block containing the Lagrange particles as the core block and register the core block in the hash registry. Step S23: For each rigid particle, query the hash registry using its Morton code to obtain the offset of its block in video memory, and generate a mapping from the rigid particle number to the block's video memory offset; if the query fails, it means that the block where the current rigid particle is located has not been registered.
4. The method for slicable interactive software simulation based on GPU-accelerated matter point method according to claim 3, characterized in that, Step S3: Obtain the neighbor blocks of the core block and add them 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, which specifically includes: Step S31: Register the 7 adjacent neighbor blocks in the upper right corner of the core block to the hash registry, and establish a neighbor mapping table to record the offsets of the 7 neighbor blocks in video memory for each core block. Step S32: Register the remaining 19 neighbor blocks in the lower left corner of the core block to the hash registry; again, by querying the hash registry, append the neighbor mapping information of all neighbor blocks to the neighbor mapping table. If the neighbor block search fails, the mapping is -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 method for slicable interactive software simulation based on GPU-accelerated matter point method according to claim 4, characterized in that, Step S4: Update the state of the rigid body model and construct a rigid body cutting field based on Ggrid, specifically including: Step S41: In each frame, the position and velocity of the rigid body model will be updated according to the input information, and the position of the rigid body particles will be updated accordingly based on the current state of the rigid body model. ; Step S42: Construct a color distance field on the Ggrid based on the compatible particle mesh method: For each rigid particle, the mesh color information of the Ggrid mesh nodes within the influence range of its B-spline kernel function is calculated and stored and transferred in the corresponding channel of the corresponding Ggrid mesh node in the linear storage location in the video memory. The mesh color information includes proximity information. and tags and unsigned distance During calculation, the information transfer between each rigid particle and Ggrid is processed in parallel as a thread. Based on the mapping from the rigid particle index to the block memory offset, rigid particles mapped to -1 are removed during the calculation. Step S43: Based on the cutting field information of Ggrid, construct the cutting field information of the Lagrange particles through the information transfer from Ggrid to the Lagrange particles.
6. The method for slicable interactive software simulation based on GPU-accelerated matter point method according to claim 5, characterized in that, Step S5: Based on Ggrid and the rigid body cutting field, solve the physical explicit integral of the three-dimensional soft model to be simulated in parallel to obtain the position of the Lagrange particle at the next moment. The solution process is divided into 4 stages: Lagrange particle to Ggrid transfer stage, Ggrid update stage, Ggrid to Lagrange particle transfer stage and Lagrange particle update stage. For each frame, steps S2 to S5 are performed n iterations, specifically including: Step S51: Lagrange Particle to Ggrid Transfer Stage: The mass, momentum, and density of the Lagrange particles need to be transferred to the Ggrid grid nodes within their kernel function range using an affine particle mesh method. During the transfer, the physical information of the current Lagrange particle is determined to be transferred to the Ggrid by judging the cutting field compatibility relationship between the Lagrange particle and the Ggrid. The compatibility relationship is defined as follows: for all surfaces shared by the Lagrange particle and the Ggrid grid nodes, all labels are the same. and Lagrange particles They are compatible; otherwise, they are not. ; ; ; in, Represents grid nodes and Lagrange particles Compatible, incompatible is indicated as ; When it is the nth iteration The quality; For Lagrange particles quality For Lagrange particles density, When it is the nth iteration and Interpolation weights; When it is the nth iteration momentum; When it is the nth iteration The affine variation is a 3 A matrix of 3; When it is the nth iteration speed; Step S52: Ggrid Update Phase: Solve the force balance equations using the moving least squares material point method to update the Ggrid's grid velocity. ; in, For Lagrange particles The initial volume; When it is the nth iteration Location; When it is the nth iteration Location; When it is the nth iteration The amount of deformation gradient carried; For the secondary particle grid kernel is , Let be the energy density function; the energy density function is used to describe the relationship between deformation gradient and stress. To represent the heterogeneity of the software and the dynamic changes in material parameters, a generalized Kirchhoff stress tensor is introduced. By defining the bulk modulus on a Lagrange particle shear modulus and viscosity coefficient To simulate the aforementioned three-dimensional software model: ; in, , , ; for The determinant of; For is The gradient is 3 3 matrices; The calculation is based on the Cauchy tensor To achieve the desired crushing effect, according to The relationship between the Cauchy tensor and 1 divides it into expansions. With contraction Two parts, and according to The maximum eigenvalue, i.e., the breaking field value, is used to attenuate the contraction. Partially, thus achieving a breaking effect; among which Bulk modulus For shear modulus, The viscosity coefficient, It is a 3 A 3x3 matrix is used to measure the local variation of velocity. Indicates 3 3 matrix traces; Step S53: Ggrid to Lagrange Particle Transfer Stage: Update the Lagrange particle velocity according to the new Ggrid's grid velocity, and update the Lagrange particle position by performing particle advection based on the new Lagrange particle velocity. During transmission, the compatibility relationship between the Lagrange particle and the cutting field of the Ggrid is used to determine whether the current particle should collect the grid velocity. If they are incompatible, 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 its location; It is a projection function used to project... speed Project onto the appropriate value; It is a coefficient used to adjust the thrust magnitude; It is the unit time step; At the same time, a certain penetration penalty force is applied to the Lagrange particles that penetrate the cut surface: ; in, It is a coefficient used to adjust the magnitude of the penalty. For Lagrange particles The signed distance, which is the signed distance between the Lagrange particle and the surface of the rigid body; Step S54: Lagrange particle update stage: Update the velocity gradient and deformation gradient on the Lagrange particle: ; ; Step S55: Repeat steps S2 to S5 n times for each frame to iterate.
7. The method for slicable interactive software simulation based on GPU-accelerated matter point method according to claim 6, characterized in that, Step S6: During the last nth iteration of each frame, based on the current position of the Lagrange particles, the surface triangular mesh of the Lagrange particle cluster is reconstructed in real time using Ggrid, and the mesh surface is further smoothed, thereby realizing the simulation and interaction between the 3D soft model and the rigid model, specifically including: Step S61: In the last nth iteration of each frame, based on the Surface Net algorithm, the density field of Lagrange particles is used as a substitute for the directed symbolic 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 Ggrid mesh nodes during the transfer stage from Lagrange particles to Ggrid, thereby obtaining the surface triangular mesh of Ggrid. Step S62: Perform parallel deduplication of the mesh vertices and generate new vertex indices. Use the Laplacian method to smooth the mesh surface, thereby realizing the physical simulation and interaction of objects, and complete scene rendering at the end of each frame.
8. A cuttable interactive software simulation system based on GPU-accelerated matter dot method, characterized in that, Includes the following modules: An initialization module is used to acquire the three-dimensional soft body model to be simulated and the rigid body model to interact with it; to perform particle sampling on the three-dimensional soft body model to obtain Lagrange particles and initialize them, and to perform rigid body particle sampling and initialization on the rigid body model. The Ggrid module is constructed to build an Eulerian grid based on the virtual scene to be simulated. The grid is encoded using Morton codes and further encoded using 4x4. 4 A size of 4 constitutes a secondary spatial block; a mapping table is constructed between the Lagrange particle and the grid and block respectively; the block containing the Lagrange particle is denoted as coreblock and registered in the hash registry; The Ggrid module is expanded to obtain the neighbor blocks of the core block and add them 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. Construct a rigid body cutting field module to update the state of the rigid body model and construct a rigid body cutting field based on Ggrid; The 3D soft model solving module is used to solve the physical explicit integral of the 3D soft model to be simulated in parallel based on Ggrid and the rigid body cutting field, to obtain the position of the Lagrange particle at the next moment. The solving process is divided into four stages: Lagrange particle to Ggrid transfer stage, Ggrid update stage, Ggrid to Lagrange particle transfer stage, and Lagrange particle update stage. For each frame, the Ggrid module construction, Ggrid module expansion, rigid body cutting field construction, and 3D soft model solving module are executed for n iterations. The particle cluster surface reconstruction module is used to reconstruct the surface triangular mesh of the Lagrange particle cluster in real time based on the position of the current Lagrange particles during the last nth iteration of each frame, and further smooth the mesh surface to realize the simulation and interaction between the three-dimensional soft model and the rigid model.
9. A cuttable interactive software simulation device based on GPU-accelerated matter dot method, characterized in that, It includes one or more electronic devices, wherein the one or more electronic devices are used to implement the method of 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 cause the one or more processors to implement the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Fluid simulation method based on Eulerian-Lagrangian coupling method
CN104268943A
Multiphase flow interactive simulation algorithm based on MPM and phase field model
CN115238604A