Real-time realistic ground object interaction methods, systems and media
By using the advection method of calculating the height map of the velocity field through the penetration depth map, the material landslide and horizontal distortion of the terrain during the interaction between the terrain and objects are simulated. This solves the problem of achieving real-time realistic terrain interaction effects that are difficult to achieve in existing technologies, and realizes stable and realistic simulation of terrain interaction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies struggle to simulate material landslides and horizontal distortion effects of terrain when interacting with objects in real-time environments, especially the horizontal deformation of slopes after edge bulges and depressions.
The compression, deposition, and edge uplift effects of terrain are simulated by using penetration depth map calculation, displacement, and erosion algorithms. The advection method based on height map generated velocity field is used to simulate material landslides and horizontal deformation of terrain.
It achieves realistic simulation of material landslides when the terrain is subjected to forces and the horizontal twisting deformation effect when the terrain is pushed by objects, solving the problem of real-time effect display that is difficult to achieve in existing technologies.
Smart Images

Figure CN115775305B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual animation processing technology, specifically to a real-time realistic ground object interaction system and medium. Background Technology
[0002] Procedural terrain deformation is an open problem in computer games and virtual reality environments, primarily focusing on the interaction between dynamic objects such as characters, animals, and explosive debris and terrain (e.g., snow, mud, sand). In real life, pedestrians or vehicles typically interact with terrain, and this interaction causes terrain deformation. However, in real-time environments, when terrain is modeled and rendered, these interactions often fail to reflect realistic dynamic deformation effects, such as the compression, accumulation, and edge bulging of snow under stress.
[0003] After years of continuous research, a dynamic deformable terrain algorithm has emerged in the field of computer graphics. This method proposes a general model of deformable ground materials and uses displacement and compression algorithms to simulate the deformation effect produced when a rigid geometric object impacts the ground material using a height map running on the CPU. Now, using GPU parallel computing programming languages such as CUDA and Compute Shader, this dynamic deformable terrain algorithm can be implemented on modern GPUs, demonstrating impressive visual effects while maintaining real-time performance.
[0004] However, in reality, the interaction between terrain and rigid bodies involves more than just the compression, accumulation, and edge bulging effects described by this method. It also includes landslides caused by slopes formed from edge bulges, and horizontal deformation effects caused by forces acting on depressions. Existing methods cannot simulate real-world landslides and horizontal deformation effects in real time. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the purpose of this invention is to provide a real-time, realistic ground object interaction method, system, and medium.
[0006] A real-time, realistic ground object interaction method provided by the present invention includes:
[0007] Penetration depth map calculation steps: Detect collisions between interactive objects and terrain, and calculate the penetration depth map;
[0008] First simulation step: Based on the penetration depth map, use displacement and erosion algorithms to simulate the compression, accumulation, and edge bulging effects of the terrain, and obtain the first simulation result;
[0009] The second simulation step: Based on the first simulation results, the advection method based on the height map of the generated velocity field is used to simulate the material landslide phenomenon and the horizontal deformation phenomenon of the terrain, and the interaction results of the ground features are obtained.
[0010] Preferably, the penetration depth map calculation step includes:
[0011] Place an orthogonal camera directly beneath the interactive terrain to capture depth maps of the interactive objects;
[0012] A penetration depth map is calculated by comparing the difference between the terrain's height map and the depth map captured by an orthographic camera at the same pixel location using a compute shader.
[0013] Preferably, the first simulation step includes:
[0014] The coordinates of the nearest non-penetrating pixel of the penetrating pixel are calculated based on the penetration depth map;
[0015] The height offset of the penetrating pixel is replaced using a permutation algorithm;
[0016] An erosion algorithm is used to smooth the height values of pixels whose height increases beyond a preset value with those of their neighboring pixels.
[0017] Preferably, the method of using a permutation algorithm to permutate the height offset of the penetrating pixel includes:
[0018] Δh up =α*Δh dowwn
[0019] Where Δh up Δh represents the height that the target pixel should rise after the displacement. down This represents the height offset of the penetrating pixel before replacement, and α represents the compression coefficient specified by the user.
[0020] Preferably, the method of smoothing the height value of a pixel whose height increases beyond a preset value with the height values of its neighboring pixels using an erosion algorithm includes:
[0021]
[0022] Where Δh e h represents the change in height of that pixel. ij Let be the height value at pixel {i,j}, and n be the number of neighborhoods searched.
[0023] Preferably, the second simulation step includes:
[0024] Calculate the force source map based on the height offset of the erosion algorithm;
[0025] Calculate the coordinates of the nearest force source pixel for the non-force source pixel based on the force source map;
[0026] The generated velocity field is calculated based on the coordinates of the nearest force source pixel and the force source map;
[0027] The height map is subjected to advection processing based on the generated velocity field.
[0028] Preferably, the method for calculating the force source map based on the height offset of the erosion algorithm includes:
[0029]
[0030] Where f ij Let h be the force value at pixel {i,j}. ij The height value at pixel {i,j} is px. ij Let px be the position of pixel {i,j}. ij =float2(i,j), where n is the number of neighborhoods to search and σ is a user-specified score constant.
[0031] Preferably, the method for calculating the generated velocity field based on the coordinates of the nearest force source pixel and the force source map includes:
[0032] distDamp = length(px) ij -ForceJFA ij ) / maxdist
[0033] velocity out =normalize(f ForceJF ij )*(1-distDamp)
[0034] Among them, ForceJFA ij Let f be the pixel coordinates of the nearest force source at pixel {i,j}. ForceJFAij The force vector at the pixel coordinates of the nearest force source at pixel {i,j}, px ij Let {i,j} be the position of pixel, and velocity be... out The output is the generated velocity field, maxdist is the maximum influence distance of the force, and distDamp is the distance attenuation multiplier.
[0035] A real-time, realistic ground object interaction system provided by the present invention includes:
[0036] Penetration depth map calculation module: Detects collisions between interactive objects and terrain, and calculates the penetration depth map;
[0037] First simulation module: Based on the penetration depth map, the compression, accumulation, and edge bulging effects of the terrain are simulated using displacement and erosion algorithms to obtain the first simulation result;
[0038] The second simulation module: Based on the first simulation results, the advection method based on the height map of the generated velocity field is used to simulate the material landslide phenomenon and the horizontal deformation phenomenon of the terrain, and the interaction results of the ground features are obtained.
[0039] According to the present invention, a computer-readable storage medium storing a computer program is provided, wherein when the computer program is executed by a processor, the steps of the real-time realistic ground object interaction method are implemented.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] This invention provides a velocity field advection scheme that can easily represent the phenomenon of material landslides when the terrain is subjected to force and the slope with raised edges, as well as the effect of horizontal distortion and deformation of the terrain when it is pushed by an object. This effectively solves the technical problems of real-time material landslides and real-time horizontal distortion and deformation of terrain that are difficult to simulate in the prior art. Attached Figure Description
[0042] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0043] Figure 1 This is a schematic diagram of the overall process of the real-time realistic ground object interaction method in one embodiment of this application;
[0044] Figure 2 This is a schematic diagram illustrating the implementation principle of the real-time realistic ground object interaction method in one embodiment of this application;
[0045] Figure 3 This is a schematic diagram of depth map acquisition in a real-time realistic ground feature interaction method according to an embodiment of this application;
[0046] Figure 4 This is a schematic diagram of the initial state in the permutation algorithm of the real-time realistic ground object interaction method in one embodiment of this application;
[0047] Figure 5 This is a schematic diagram of the height map compression result in the permutation algorithm of the real-time realistic ground object interaction method in one embodiment of this application;
[0048] Figure 6 This is a schematic diagram of the height map permutation result in the permutation algorithm of the real-time realistic ground feature interaction method in one embodiment of this application;
[0049] Figure 7 To generate a velocity field effect map in a real-time realistic ground object interaction method in one embodiment of this application;
[0050] Figure 8 This is a schematic diagram of the velocity field generated in a real-time realistic ground object interaction method in one embodiment of this application;
[0051] Figure 9 The image shows the effect of not using the heightmap advection method based on the generated velocity field;
[0052] Figure 10 The image shows the effect of using the height map advection method based on the generated velocity field;
[0053] Figure 11a , 11b 11c and 11d are horizontal distortion effect diagrams in a real-time realistic ground object interaction method in one embodiment of this application;
[0054] Figure 12a , 12b 12c and 12d are effect diagrams of landslide phenomena in a real-time realistic ground object interaction method in one embodiment of this application. Detailed Implementation
[0055] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0056] The purpose of this embodiment is to provide a real-time realistic ground object interaction method to represent the phenomenon of material landslides when the terrain is subjected to force and the slope with raised edges, as well as the effect of horizontal distortion and deformation of the terrain when the terrain is pushed by an object. At the same time, it simulates effects such as compression, accumulation, and edge bulging, so as to effectively solve the technical problems of material landslides and real-time horizontal distortion and deformation of terrain that are difficult to simulate in real time in the prior art.
[0057] This embodiment provides a real-time, realistic terrain interaction method that simulates terrain compression, accumulation, edge bulging, landslide phenomena, and horizontal distortion effects during terrain interaction. This invention can be integrated into various real-time interactive applications to provide stable, realistic terrain interaction simulations and deliver rich and vivid real-time terrain interaction effects.
[0058] Example
[0059] Specifically, such as Figure 1 As shown, this embodiment provides a real-time realistic ground feature interaction method, which includes:
[0060] Step S100: Detect collisions between interactive objects and terrain, and calculate the penetration depth map;
[0061] Step S200: Based on the penetration depth map, use displacement and erosion algorithms to simulate the compression, accumulation, and edge bulging effects of the terrain;
[0062] Step S300: Based on the results output by the erosion algorithm, the advection method based on the height map of the generated velocity field is used to simulate the material landslide phenomenon and the horizontal deformation phenomenon of the terrain.
[0063] The following will combine Figure 2 The steps S100 to S300 of the real-time realistic ground object interaction method of this embodiment will be described in detail:
[0064] Step S100: Detect collisions between interactive objects and terrain, and calculate the penetration depth map.
[0065] In this embodiment, an orthogonal depth camera is placed underground, with the height of the near-plane of the camera recorded as 0. The depth map of the interactive object is then acquired through this camera. Figure 3 As shown. Then, the terrain height map is compared with the depth map captured by the depth camera. The difference between the two at the same pixel position is compared using a compute shader to calculate the penetration depth map.
[0066] Specifically, in this embodiment, one way to calculate the penetration depth map by comparing the differences between the two at the same pixel position using a computation shader is as follows:
[0067] penetration = height - depth
[0068] Where penetration is the penetration depth value, height is the height value, and depth is the depth value. If the penetration value is greater than 0, the object in that frame has penetrated the terrain and a collision has occurred. If the penetration value is equal to 0, the object is attached to the terrain surface and exists as a terrain obstacle. If the penetration value is less than 0, the object is located above the terrain. In the specific implementation, to prevent floating-point errors and to prevent clipping caused by terrain penetrating obstacles, when the penetration value is greater than h... solid At that time, h solid <0 (equivalent to the interactive object being above the height map -h) solid If the surface is below a certain depth (cm), it is determined that there is a terrain obstacle at that location.
[0069] Specifically, step S100 includes the following steps:
[0070] 1) Place an orthogonal depth camera under the ground, record the height of the near plane of the camera as 0, and obtain the depth map of the interactive object through the camera;
[0071] 2) Use a compute shader to compare the differences between the two at the same pixel location to calculate the penetration depth map:
[0072] penetration = height - depth
[0073] Where penetration is the penetration depth value, height is the height value, and depth is the depth value.
[0074] Step S200: Based on the penetration depth map, use displacement and erosion algorithms to simulate the compression, accumulation, and edge bulging effects of the terrain.
[0075] In this embodiment, the impact of the penetration depth map on the terrain is calculated to simulate the compression, accumulation, and edge bulging effects of the terrain.
[0076] In this embodiment, the step of simulating the compression, accumulation, and edge bulging effects of the terrain using permutation and erosion algorithms based on the penetration depth map includes: calculating the coordinates of the nearest non-penetrating pixel of the penetrating pixel based on the penetration depth map; permuting the height offset of the penetrating pixel using a permutation algorithm; and smoothing the height value of a pixel with a steep increase in height from the height value of its neighboring pixels using an erosion algorithm.
[0077] Specifically, step S200 includes the following steps:
[0078] 1) Calculate the coordinates of the nearest non-penetrating pixel to the penetrating pixel based on the penetration depth map;
[0079] 2) The height offset of the penetrating pixel is replaced using a replacement algorithm. The replacement effect is as follows: Figure 4 , 5 As shown in Figure 6:
[0080] Δh up =α*Δh down
[0081] Where Δh up Δh represents the height that the target pixel should rise after the displacement. down This represents the height offset of the penetrating pixel before replacement, and α represents the compression coefficient, which is specified by the user.
[0082] 3) Use an erosion algorithm to smooth the height values of pixels with steep increases in height relative to their neighboring pixels:
[0083]
[0084] Where Δh e h represents the change in height of that pixel. ij Let be the height value at pixel {i,j}, and n be the number of neighborhoods searched.
[0085] The method in this embodiment is an effective way to simulate the compression, accumulation, and edge bulging effects of terrain.
[0086] Step S300: Based on the results output by the erosion algorithm, the advection method based on the height map of the generated velocity field is used to simulate the material landslide phenomenon and the horizontal deformation phenomenon of the terrain.
[0087] This embodiment processes the intermediate results of the erosion algorithm and uses the height map advection method based on the generated velocity field to simulate the material landslide phenomenon and the horizontal deformation phenomenon of the terrain.
[0088] In this embodiment, the step of simulating the material landslide phenomenon and the horizontal deformation phenomenon of the terrain using the height map advection method based on the generated velocity field according to the output of the erosion algorithm includes: calculating the force source map according to the height offset of the erosion algorithm; calculating the coordinates of the nearest force source pixel of the non-force source pixel according to the force source map; calculating the generated velocity field according to the coordinates of the nearest force source pixel and the force source map; and performing advection processing on the height map according to the generated velocity field.
[0089] Specifically, step S300 includes the following steps:
[0090] 1) Calculate the force source map based on the height offset of the erosion algorithm. The force source map is calculated using the following formula:
[0091]
[0092] Where f ij Let h be the force value at pixel {i,j}. ij The height value at pixel {i,j} is px. ij The position of pixel {i,j}, i.e., px ij =float2(i,j), where n is the number of neighborhoods to search and σ is a user-specified score constant.
[0093] 2) Calculate the coordinates of the nearest force source pixel to the non-force source pixel based on the force source map;
[0094] 3) Calculate the generated velocity field based on the coordinates of the nearest force source pixel and the force source map. Figure 7 The image shows a scenario illustrating a method for interacting with ground features in 3D space. Figure 8 This diagram illustrates a simplified 2D spatial velocity field generated in the scene from a top-down perspective. The velocity field is calculated using the following formula:
[0095] distDamp = length(px) ij -ForeJFA ij ) / maxdist
[0096] velocity out =normalize(f ForceJFAij )*(1-disDamp)
[0097] Among them, ForceJFA ij Let f be the pixel coordinates of the nearest force source at pixel {i,j}. ForceJFAij The force vector at the pixel coordinates of the nearest force source at pixel {i,j}, px ij Let {i,j} be the position of pixel, and velocity be... out The output is the generated velocity field, maxdist is the maximum influence distance of the force, and disDamp is the distance decay multiplier.
[0098] 4) Perform advection processing on the height map based on the generated velocity field:
[0099] px target =px ij -velocity out *velocityMul
[0100] Where velocityMul is a user-defined velocity multiplier, velocity out For the generated velocity field of the output, px ij Let {i,j} be the position of pixel {i,j}. Figure 10 The image shows the integrated application effect of the height map advection method based on the generated velocity field in game development software. Figure 9 The comparison chart shows the integration application without using this method. The comparison reveals that by using the technology proposed in this invention, it is possible to achieve efficient and realistic simulation of landslides and horizontal deformation of terrain, which was previously impossible.
[0101] Therefore, the method in this embodiment is a simulation scheme for realistic landslide and horizontal deformation phenomena in terrain. Existing methods lack consideration for simulating landslide and horizontal deformation phenomena in terrain, making it difficult to simulate their effects in real time. The method in this embodiment proposes a height map advection method based on generating a velocity field. By generating a velocity field based on a force field, advection is performed on each height map, which can efficiently achieve real-time and stable simulation of landslide and horizontal deformation phenomena in terrain. Figure 11a , 11b Images 11c and 11d illustrate the horizontal distortion effect in a real-time realistic ground object interaction method according to an embodiment of this application. Figure 12a , 12b Images 12c and 12d illustrate the effect of a landslide phenomenon in a real-time realistic ground object interaction method according to an embodiment of this application.
[0102] In summary, this invention, through a height map advection method based on the generated velocity field, can easily achieve real-time realistic ground object interaction simulation, effectively solving the problems of material landslides and horizontal terrain deformation that are difficult to simulate in existing technologies. Therefore, this invention effectively overcomes the various shortcomings of existing technologies and has high industrial application value.
[0103] The present invention also provides a real-time realistic ground feature interaction system, which can be implemented by executing the process steps of the real-time realistic ground feature interaction method. That is, those skilled in the art can understand the real-time realistic ground feature interaction method as a preferred embodiment of the real-time realistic ground feature interaction system.
[0104] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the real-time realistic ground object interaction method.
[0105] Those skilled in the art will understand that, besides implementing the system and its various devices, modules, and units provided by this invention in the form of purely computer-readable program code, the same functions can be achieved entirely through logical programming of the method steps, enabling the system and its various devices, modules, and units to function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices, modules, and units provided by this invention can be considered a hardware component, and the devices, modules, and units included therein for implementing various functions can also be considered structures within the hardware component; alternatively, the devices, modules, and units for implementing various functions can be considered both software modules implementing the method and structures within the hardware component.
[0106] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
Claims
1. A method for real-time realistic physical object interaction, characterized by, The method comprises: a penetration depth map calculation step of detecting a collision between the interactive object and the terrain and calculating a penetration depth map; a first simulation step of simulating a compression, accumulation, and edge bulging effect of the terrain according to the penetration depth map using a displacement and erosion algorithm to obtain a first simulation result; a second simulation step of simulating a mass landslide phenomenon and a terrain horizontal deformation phenomenon of the terrain according to the first simulation result using a height map advection method based on a generated velocity field to obtain a geo-object interaction result. The first simulation step comprises: calculating a nearest non-penetration pixel coordinate of a penetration pixel according to the penetration depth map; displacing a height offset of the penetration pixel using a displacement algorithm; performing a smoothing processing between a height value of a pixel with a height increase exceeding a preset value and height values of neighbor pixels using an erosion algorithm; the manner of displacing the height offset of the penetration pixel using the displacement algorithm comprises: wherein represents a height value by which the target pixel should be raised after the replacement, represents a height offset of the penetrating pixel before the replacement, represents a compression coefficient specified by the user; The second simulation step comprises: calculating a force source map according to a height offset of the erosion algorithm; calculating a nearest force source pixel coordinate of a non-force source pixel according to the force source map; calculating a generated velocity field according to the nearest force source pixel coordinate and the force source map; performing an advection processing on a height map according to the generated velocity field; the manner of calculating the force source map according to the height offset of the erosion algorithm comprises: wherein is the force value at pixel {i,j}, is the height value at pixel {i,j}, is the position of pixel {i,j}, is the number of neighbors searched, is a score constant specified by the user.
2. The real-time realistic real object interaction method of claim 1, wherein, The penetration depth map calculation step comprises: placing an orthographic camera directly below the interactive terrain to capture a depth map of the interactive object; calculating a penetration depth map by comparing a difference between a height map of the terrain and the depth map captured by the orthographic camera at a same pixel position using a calculation shader.
3. The real-time photorealistic object interaction method of claim 1, wherein, The manner of performing a smoothing processing between a height value of a pixel with a height increase exceeding a preset value and height values of neighbor pixels using an erosion algorithm comprises: wherein represents the amount of height change of the pixel, is the height value at pixel {i,j}, is the number of searched neighbors.
4. The real-time photorealistic object interaction method of claim 1, wherein, The manner of calculating a generated velocity field according to the nearest force source pixel coordinate and the force source map comprises: where is the pixel coordinate of the nearest force source at pixel {i,j}, is the force vector at the pixel coordinate of the nearest force source at pixel {i,j}, is the position of pixel {i,j}, is the generated velocity field of the output, is the maximum influence distance of the force, is the distance decay multiplier.
5. A real-time realistic object interaction system for performing the real-time realistic object interaction method according to any one of claims 1 to 4, characterized in that The real-time realistic geo-object interaction system comprises: a penetration depth map calculation module of detecting a collision between the interactive object and the terrain and calculating a penetration depth map; a first simulation module of simulating a compression, accumulation, and edge bulging effect of the terrain according to the penetration depth map using a displacement and erosion algorithm to obtain a first simulation result; a second simulation module of simulating a mass landslide phenomenon and a terrain horizontal deformation phenomenon of the terrain according to the first simulation result using a height map advection method based on a generated velocity field to obtain a geo-object interaction result.
6. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by a processor to implement the steps of the real-time realistic geo-object interaction method in any one of claims 1 to 4.
Citation Information
Patent Citations
Depth image partitioning and agent geometry based virtual and real collision interaction method and apparatus
CN105046710A
Ripple simulation method and device in virtual scene
CN112221150A