Terrain Rendering Method, Apparatus, Computer Device, Readable Storage Medium, and Program Product

The quadtree algorithm uses chunking and preset distance thresholds to filter the terrain block data, build a rendering grid and determine the target vertex height, solving the real-time and jagging problems of traditional algorithms when dealing with large data volumes, and achieving efficient, jagging-free terrain data rendering and model matching.

CN119418016BActive Publication Date: 2025-07-22SUZHOU ZHONGKE TUXIN NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510013754.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-07-22
Estimated Expiration
2045-01-06

AI Technical Summary

Technical Problem

In the prior art, the CPU-based geometric algorithm can only process small amounts of terrain data and cannot realize real-time processing. The GPU-based flattening algorithm has edge serrations, resulting in poor model matching effect.

Method used

The quad-tree algorithm is used to block the terrain data, filter the terrain block data to be rendered based on preset display conditions, and determine the flattening processing method through the preset distance threshold, build a rendering grid and determine the target vertex height according to the position relationship for rendering.

Benefits of technology

Real-time and efficient flattening rendering of massive terrain data, with no jagged edges, and can accurately match the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119418016B_ABST
    Figure CN119418016B_ABST
Patent Text Reader

Abstract

The present application relates to a terrain rendering method, apparatus, computer device, readable storage medium, and program product. By using a quadtree algorithm to divide the terrain data to be processed into blocks, multiple terrain block data at multiple levels are obtained to achieve fast traversal of the terrain blocks; and based on preset display conditions, the terrain block data to be rendered is determined from the multiple terrain block data at multiple levels. If the distance between the terrain block data to be rendered and the target is less than or equal to a preset distance threshold, a rendering grid is constructed according to the terrain block data to be rendered, and according to the positional relationship between the rendering grid and the target flattening plane, the target vertex height of the rendering grid is determined, and then rendering processing is performed according to the target vertex height of the rendering grid to obtain a rendered terrain. It determines the flattening processing method through a preset distance threshold, and finally processes the rendered data, so as to be able to support real-time and efficient flattening rendering of massive terrain data, and there are no jagged edges in the flattened area, and it can be accurately matched with the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technologies, and particularly to a terrain rendering method, apparatus, computer device, readable storage medium, and program product. Background Art

[0002] With the development of three-dimensional visualization technology, the data that can be accessed in a three-dimensional geographic information system is becoming increasingly rich, and the fusion and matching of various data have also received increasing attention. By flattening terrain data, the matching of artificial design models (such as BIM models of roads, bridges, buildings, etc.) and real terrain can be achieved, and the model can be more clearly and intuitively displayed during three-dimensional scene reporting for better understanding.

[0003] In traditional technologies, the methods for flattening terrain data generally include geometric algorithms based on the CPU (Central Processing Unit) and flattening algorithms based on the GPU (Graphics Processing Unit). However, the geometric algorithm based on the CPU only supports processing two-dimensional data with a small data volume, and data preprocessing is required when the data volume is large, thus real-time processing cannot be achieved. And the flattening algorithm based on the GPU has the problem of edge jaggedness, resulting in a poor matching effect with the model. Summary of the Invention

[0004] Based on this, it is necessary to provide a terrain rendering method, apparatus, computer device, computer-readable storage medium, and computer program product that can ensure data quality and achieve processing for the above technical problems.

[0005] In a first aspect, the present application provides a terrain rendering method, including:

[0006] Using a quadtree algorithm to divide the terrain data to be processed into blocks, obtaining multiple terrain block data at multiple levels;

[0007] Determining the terrain block data to be rendered from the multiple terrain block data at multiple levels based on a preset display condition;

[0008] When it is determined that the distance between the terrain block data to be rendered and the target is less than or equal to a preset distance threshold, constructing a rendering grid according to the terrain block data to be rendered, where the rendering grid has an initial vertex height;

[0009] Determining the target vertex height of the rendering grid according to the positional relationship between the rendering grid and the target flattening plane;

[0010] Performing rendering processing according to the target vertex height of the rendering grid to obtain a rendered terrain.

[0011] In one embodiment, determining the target vertex height of the rendering grid according to the positional relationship between the rendering grid and the target pressing plane includes: obtaining the positional relationship between the rendering grid and the target pressing plane; when it is determined according to the positional relationship that the rendering grid intersects with the target pressing plane and the rendering grid is within the target pressing plane, determining the target vertex height of the rendering grid as the height of the target pressing plane.

[0012] In one embodiment, the method further includes: when it is determined according to the positional relationship that the rendering grid intersects with the target pressing plane, determining a first region and a second region where the rendering grid intersects with the target pressing plane, where the first region is the region where the rendering grid is within the target pressing plane, and the second region is the region where the rendering grid is outside the target pressing plane; taking the height of the target pressing plane as the target vertex height of the first region of the rendering grid; taking the initial vertex height of the second region of the rendering grid as the target vertex height.

[0013] In one embodiment, the method further includes: when it is determined according to the positional relationship that the rendering grid does not intersect with the target pressing plane, taking the initial vertex height of the rendering grid as the target vertex height.

[0014] In one embodiment, the terrain block data to be rendered includes a plurality of terrain data points and corresponding heights; before performing rendering processing according to the target vertex height of the rendering grid to obtain a rendered terrain, the method further includes: when it is determined that the distance between the terrain block data to be rendered and the target is greater than a preset distance threshold, if the terrain data point of the terrain block data to be rendered is within the target pressing plane, updating the height of the terrain data point to the height of the target pressing plane; if the terrain data point of the terrain block data to be rendered is outside the target pressing plane, keeping the height of the terrain data point unchanged; constructing a rendering grid according to the height of the terrain data point, and the target vertex height of the rendering grid is the height of the corresponding terrain data point.

[0015] In one embodiment, determining the terrain block data to be rendered from multiple terrain block data at multiple levels based on preset display conditions includes: when it is determined that the terrain block data is visible and the pixel size of the terrain block data occupying the screen is less than a preset pixel threshold, determining the terrain block data as the terrain block data to be rendered.

[0016] In a second aspect, the present application provides a terrain rendering device, and the device includes:

[0017] A chunking module, configured to chunk the terrain data to be processed using a quadtree algorithm to obtain multiple terrain chunk data at multiple levels;

[0018] A to-be-rendered chunk determination module, configured to determine to-be-rendered terrain chunk data from the multiple terrain chunk data at multiple levels based on a preset display condition;

[0019] A rendering mesh construction module, configured to construct a rendering mesh according to the to-be-rendered terrain chunk data when it is determined that the distance between the to-be-rendered terrain chunk data and the target is less than or equal to a preset distance threshold, and the rendering mesh has an initial vertex height;

[0020] A target height determination module, configured to determine the target vertex height of the rendering mesh according to the positional relationship between the rendering mesh and the target pressure plane;

[0021] A rendering module, configured to perform rendering processing according to the target vertex height of the rendering mesh to obtain a rendered terrain.

[0022] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in the first aspect above are implemented.

[0023] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in the first aspect above are implemented.

[0024] In a fifth aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect above are implemented.

[0025] The above terrain rendering method, device, computer device, computer-readable storage medium, and computer program product. The terminal divides the terrain data to be processed into blocks by using the quadtree algorithm, obtains multiple terrain block data at multiple levels, and determines the terrain block data to be rendered from the multiple terrain block data at multiple levels based on a preset display condition. When it is determined that the distance between the terrain block data to be rendered and the target is less than or equal to a preset distance threshold, a rendering grid is constructed according to the terrain block data to be rendered, and the target vertex height of the rendering grid is determined according to the positional relationship between the rendering grid and the target flattening plane. Then, rendering processing is performed according to the target vertex height of the rendering grid to obtain a rendered terrain. Through quadtree division, it can achieve fast traversal of terrain blocks. Through the display conditions of visibility and the pixel size occupied, the terrain blocks that need to be rendered can be filtered. The flattening processing method is determined by a preset distance threshold, and finally the processed data is rendered, so that it can support real-time and efficient flattening rendering of massive terrain data, and there are no jagged edges in the flattening, and it can be accurately matched with the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] To more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for the description in the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0027] Figure 1 It is a schematic flowchart of a terrain rendering method in an embodiment;

[0028] Figure 2 It is a schematic flowchart of a fine flattening step in an embodiment;

[0029] Figure 3A It is a schematic diagram of the intersection of a rendering grid and a target flattening plane in an embodiment;

[0030] Figure 3B It is a schematic diagram of the intersection of a rendering grid and a target flattening plane in another embodiment;

[0031] Figure 3C It is a schematic diagram of the non-intersection of a rendering grid and a target flattening plane in an embodiment;

[0032] Figure 4 It is a schematic flowchart of a simplified flattening step in an embodiment;

[0033] Figure 5 It is a structural block diagram of a terrain rendering device in an embodiment;

[0034] Figure 6Internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0035] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0036] Due to the flattening of terrain data by traditional CPU-based geometric algorithms, which only support the processing of two-dimensional data with a small amount of data, cannot be correctly displayed in the spherical coordinate system, resulting in limited usage scenarios; and when the amount of data is large, the data needs to be preprocessed, and cannot be changed after loading, and the excavation surface cannot be set for excavation in real time. The flattening algorithm based on GPU flattens the terrain data. Before rendering the scene, it draws the depth of the flattening plane onto a texture through orthogonal projection and saves the pose parameters of the camera. Then, when rendering the scene, it calculates the depth of each fragment and the corresponding texture coordinates according to the saved camera parameters. The texture value obtained through the texture coordinates is the depth at this point on the flattening plane. When the fragment depth is less than the flattening plane depth, the fragment depth is changed to the flattening plane depth and the corresponding scene coordinates are calculated, otherwise it is not processed. As a result, obvious jagged edges will appear at the edge of the flattening plane, making it impossible to accurately match the model edge.

[0037] Based on this, the present application provides a terrain rendering method, which realizes fast traversal of the terrain through quadtree partitioning, screens the tiles to be rendered through visibility and the pixel size occupied, determines the flattening processing method by setting a distance threshold, and finally renders the processed data. It can not only support real-time and efficient flattening rendering of massive terrain data, but also has no jagged edges at the flattening edge and can accurately match the model.

[0038] In one embodiment, as Figure 1 shown, a terrain rendering method is provided. In this embodiment, an example is given where the method is applied to a terminal. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is realized through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0039] Step 102, use the quadtree algorithm to partition the terrain data to be processed to obtain multiple terrain block data at multiple levels.

[0040] Among them, the terrain data to be processed refers to the terrain data that needs to be rendered. Terrain data is an important data type used to describe the surface morphology in a Geographic Information System (GIS for short). It is data that can represent the undulating state of the Earth's surface, that is, it contains elevation information of the surface and can be used for various applications and analyses.

[0041] A quadtree is a tree - shaped data structure that divides a two - dimensional space into four quadrants or sub - regions, and each node represents a rectangular region. In computer vision and image processing, quadtrees are often used for image segmentation, compression, and accelerating the processing process. In a quadtree, each node represents a region and can be further divided into four child nodes, with each child node representing a quadrant of the original region. This process is recursive until a specific stopping condition is met, such as the region being small enough or the pixel values within the region being consistent enough. Each node in a quadtree can be a leaf node or an internal node (i.e., a parent node). A leaf node represents a region that cannot be divided further, while an internal node represents a region that can be further divided. In image processing, leaf nodes usually represent an image region with similar characteristics.

[0042] In this embodiment, after the terminal obtains the terrain data to be processed that needs to be rendered, it can use the quadtree algorithm to divide the terrain data to be processed into blocks to obtain multiple terrain block data at multiple levels. Among them, each terrain block data is a node in the quadtree, and the level is the level of the node formed based on the recursive process of the quadtree. For example, the terrain data to be processed can be divided into two terrain block data at level 0. Based on the quadtree algorithm, eight terrain block data can be obtained at level 1, 32 terrain block data can be obtained at level 2, and so on. Multiple terrain block data at multiple levels of the terrain data to be processed can be obtained, that is, multi - level detailed terrain is obtained. And the terrain block data at the subsequent level is the child node of the terrain block data at the previous level, and the terrain block data at the previous level is the parent node of the terrain block data at the subsequent level.

[0043] Step 104, determine the terrain block data to be rendered from the multiple terrain block data at multiple levels based on a preset display condition.

[0044] Among them, the terrain block data to be rendered refers to the terrain block data that needs to be rendered. The display condition can be a related condition preset for screening the terrain block data to be rendered. Specifically, the preset display condition can include the condition of whether the terrain block data is visible and the pixel threshold condition of the pixel size occupied by the terrain block data on the screen.

[0045] In this embodiment, the terminal can traverse multiple terrain block data at multiple levels of the terrain quadtree structure obtained through the above steps, and determine whether the terrain block data is visible according to the pose parameters of the camera. If the parent node is invisible, the corresponding child nodes are also invisible, so there is no need to traverse further. That is, based on whether the terrain block data is visible as the termination condition of traversal, the visible terrain block data is determined.

[0046] Furthermore, according to the camera parameters and the bounding spheres of the visible terrain block data, the pixel size occupied by each visible terrain block data on the screen can be calculated. When the pixel size occupied by a certain visible terrain block data on the screen meets the set conditions, it means that this terrain block data is the terrain block data that needs to be rendered currently, that is, it is determined as the terrain block data to be rendered. When a certain terrain block data is invisible, or the pixel size occupied by a certain visible terrain block data on the screen does not meet the set conditions, it means that this terrain block data does not need to be rendered.

[0047] Specifically, the set condition can be a preset pixel threshold. Then, when the terminal determines that the pixel size occupied by a certain visible terrain block data on the screen is less than the preset pixel threshold, it means that it meets the set conditions. Therefore, the terrain block data that meets the conditions can be determined as the terrain block data to be rendered. It can be understood that the specific size of the preset pixel threshold can be set to different values based on the requirements of the actual scenario, and this is not limited in this embodiment.

[0048] Step 106, when it is determined that the distance between the terrain block data to be rendered and the target is less than or equal to the preset distance threshold, a rendering mesh is constructed according to the terrain block data to be rendered.

[0049] Among them, the target can be the camera for shooting. The rendering mesh can be the triangular patches constructed when rendering terrain data. The triangular mesh is a basic data structure used in computer graphics to represent the surface of a three-dimensional object. It consists of a set of vertices, edges, and faces, where the faces are usually triangles formed by connecting three vertices. Specifically, each vertex of the rendering mesh has an initial vertex height, and this initial vertex height comes from the elevation information at the corresponding position in the terrain data.

[0050] The preset distance threshold can be a condition pre-set for selecting the method of flattening the terrain block data to be rendered. Among them, the method of flattening can include a simplified flattening method and a fine flattening method. Since there is no visual difference between the fine and simplified flattening processes when the distance is far, while there is a visual difference between the fine and simplified flattening processes when the distance is near, therefore, the preset distance threshold can be the demarcation point between where there is a visual difference and where there is no visual difference, that is, for the part greater than this demarcation point, no visual difference will be produced regardless of the processing method used, while for the part less than or equal to this demarcation point, visual differences will be produced under different processing methods.

[0051] In this embodiment, when the distance between the terrain block data to be rendered and the target is greater than the preset distance threshold, a simplified flattening method can be used to flatten the terrain block data to be rendered to improve the processing speed; while when the distance between the terrain block data to be rendered and the target is less than or equal to the preset distance threshold, a fine flattening method can be used to flatten the terrain block data to be rendered, thereby improving the visual effect.

[0052] Specifically, when the terminal determines that the distance between the terrain block data to be rendered and the target is less than or equal to the preset distance threshold, a fine flattening method can be used to flatten the terrain block data to be rendered. In this flattening method, the terminal can first construct a rendering mesh based on the terrain block data to be rendered and perform flattening and rendering through subsequent steps.

[0053] Step 108: Determine the height of the target vertex of the rendering mesh according to the positional relationship between the rendering mesh and the target flattening plane.

[0054] Among them, the target flattening plane can be determined based on the relationship between the preset flattening plane and the terrain block data to be rendered. Specifically, the flattening plane is a specific area in the terrain data, and its height is uniformly set to a specified value so that the terrain within this area appears flat. The preset flattening plane can be predefined by the user to ensure that the flattened terrain is correct both visually and functionally.

[0055] Specifically, after the terminal determines the terrain block data to be rendered based on the above steps, it can also calculate the bounding sphere of the preset flattening plane, calculate the bounding sphere of the terrain block data to be rendered, and determine whether the bounding sphere of the terrain block data to be rendered intersects with the bounding sphere of the preset flattening plane. If the two intersect, the preset flattening plane is used as the target flattening plane for the corresponding intersecting terrain block data to be rendered. And the target flattening plane is used to flatten the intersecting terrain block data to be rendered. Among them, the bounding sphere is a concept for local area dynamic positioning in a three-dimensional scene. It is a sphere, and its definition is based on the position and size of the corresponding area, aiming to closely contain the corresponding area with the bounding sphere while minimizing the radius of the sphere as much as possible.

[0056] Furthermore, the terminal can determine the target vertex height of the rendering mesh based on the positional relationship between the rendering mesh corresponding to the terrain block data to be rendered and the target flattening plane. Among them, the target vertex height is the final height of each vertex of the rendering mesh during rendering. The positional relationship can represent the relative position between the two (i.e., the rendering mesh and the target flattening plane), and can determine the intersection or non-intersection, etc. in terms of their positions.

[0057] Step 110, perform rendering processing according to the target vertex height of the rendering mesh to obtain the rendered terrain.

[0058] Specifically, after the terminal determines the target vertex height of the rendering mesh based on the above steps, it can perform rendering processing according to the target vertex height of the rendering mesh to obtain the rendered terrain.

[0059] In the above terrain rendering method, the terminal can use the quadtree algorithm to divide the terrain data to be processed into multiple terrain block data at multiple levels, and determine the terrain block data to be rendered from the multiple terrain block data at multiple levels based on the preset display conditions. When it is determined that the distance between the terrain block data to be rendered and the target is less than or equal to the preset distance threshold, a rendering mesh is constructed according to the terrain block data to be rendered, and the target vertex height of the rendering mesh is determined based on the positional relationship between the rendering mesh and the target flattening plane. Furthermore, rendering processing is performed according to the target vertex height of the rendering mesh to obtain the rendered terrain. Through quadtree partitioning, it can achieve fast traversal of terrain blocks. Through the display conditions of visibility and the pixel size occupied, the terrain blocks that need to be rendered can be filtered. Through the preset distance threshold, the flattening processing method can be determined, and finally the rendered data, so as to support real-time and efficient flattening rendering of massive terrain data, and there are no jagged edges in the flattened area, and it can be accurately matched with the model.

[0060] In an exemplary embodiment, as Figure 2 shown, a fine flattening method is used to flatten the terrain block data to be rendered. Specifically, it may include:

[0061] Step 202, construct a rendering grid.

[0062] Specifically, when the terminal determines that the distance between the terrain block data to be rendered and the target is less than or equal to a preset distance threshold, a fine flattening method can be used to flatten the terrain block data to be rendered. During this process, first, a rendering grid is constructed. Specifically, it can be based on the terrain data to be processed to construct the rendering grid. It can be understood that since the terrain data to be processed includes the terrain block data to be rendered, the rendering grid corresponding to each terrain block data to be rendered can be determined.

[0063] Step 204, traverse the rendering grid to obtain the positional relationship between the rendering grid and the target flattening plane.

[0064] Specifically, the positional relationship can represent the relative position between the rendering grid and the target flattening plane. In this embodiment, the terminal can traverse the rendering grid corresponding to the terrain block data to be rendered, so as to obtain the positional relationship between the rendering grid and the target flattening plane, that is, obtain the relative position between the two.

[0065] Step 206, determine whether the rendering grid intersects with the target flattening plane.

[0066] Among them, intersection means that there is a common intersection area (that is, an overlapping area) between the two, and non-intersection means that there is no common intersection area between the two, that is, the two do not overlap at all. Specifically, the terminal can determine whether the rendering grid intersects with the target flattening plane according to the above positional relationship. In the case of determining that the rendering grid intersects with the target flattening plane, step 208 is executed; in the case of determining that the rendering grid does not intersect with the target flattening plane, step 216 is executed.

[0067] Step 208, determine whether the rendering grid is within the target flattening plane.

[0068] Specifically, when the terminal determines that the rendering grid intersects with the target flattening plane based on the above steps, it further determines the intersection category between the rendering grid and the target flattening plane, that is, whether it is an inclusive intersection or a partial intersection. That is, it determines whether the rendering grid is within the target flattening plane. In the case of determining that the rendering grid is within the target flattening plane, step 210 is executed; in the case of determining that the rendering grid is not within the target flattening plane, step 212 is executed.

[0069] Step 210, determine that the target vertex height of the rendering grid is the height of the target flattening plane.

[0070] Specifically, as Figure 3AAs shown, when the terminal determines that the rendering grid intersects with the target flattening plane based on the above steps and determines that the rendering grid is within the target flattening plane, it determines that the target vertex height of the rendering grid is the height of the target flattening plane, that is, assigns the height of the target flattening plane to each vertex of the rendering grid inside it as the target vertex height of the rendering grid. Thus, the flattening of the corresponding rendering grid data is achieved.

[0071] Step 212, determine the first region and the second region where the rendering grid intersects with the target flattening plane.

[0072] Specifically, when the terminal determines that the rendering grid intersects with the target flattening plane based on the above steps and determines that the rendering grid is not within the target flattening plane, it means that they partially intersect. Therefore, the first region and the second region where the rendering grid intersects with the target flattening plane can be further determined. As Figure 3B shown, where the first region is the region where the rendering grid is within the target flattening plane, that is, the internal intersecting region, representing the overlapping region between the rendering grid and the target flattening plane. The second region is the region where the rendering grid is outside the target flattening plane, that is, the external intersecting region, representing the other regions of the rendering grid except the overlapping region with the target flattening plane.

[0073] Step 214, determine the target vertex heights corresponding to the first region and the second region.

[0074] Specifically, for the internal intersecting region, that is, the first region, the terminal can assign the height of the target flattening plane to the vertices of this region in the rendering grid as the target vertex height of the corresponding vertices. For the external intersecting region, that is, the second region, the heights of the vertices in the corresponding region can be kept unchanged, that is, the initial vertex heights of the vertices in the corresponding region are used as the target vertex heights. Thus, the flexible flattening process of the corresponding rendering grid data is achieved, improving the display effect.

[0075] Step 216, use the initial vertex height of the rendering grid as the target vertex height.

[0076] Specifically, as Figure 3C shown, when the terminal determines that the rendering grid does not intersect with the target flattening plane according to the positional relationship, it can keep the heights of the vertices in the rendering grid unchanged, that is, use the initial vertex height of the rendering grid as the target vertex height. Thus, the fine flattening process of the rendering grid that meets the conditions is achieved.

[0077] Since in this embodiment, during the process of flattening the rendering mesh in detail, different methods are used to determine the height of the target vertices of the rendering mesh based on the different positional relationships between the rendering mesh and the target flattening plane, the problem of edge jagging can be avoided, the edge effect after flattening can be improved, and the data after flattening can be seamlessly matched with the model.

[0078] In an exemplary embodiment, the terrain block data to be rendered includes a plurality of terrain data points and corresponding heights; then as Figure 4 shown, a simplified flattening method is used to flatten the terrain block data to be rendered, which may specifically include:

[0079] Step 402, obtain the positional relationship between the terrain block data to be rendered and the target flattening plane.

[0080] Specifically, when the terminal determines that the distance between the terrain block data to be rendered and the target is greater than the preset distance threshold, a simplified flattening method can be used to flatten the terrain block data to be rendered. During this process, first, the positional relationship between each terrain data point in the terrain block data to be rendered and the target flattening plane can be obtained. Among them, the positional relationship can represent the relative position between the two.

[0081] Step 404, determine whether the terrain data points of the terrain block data to be rendered are within the target flattening plane.

[0082] Specifically, after the terminal obtains the positional relationship between the terrain block data to be rendered and the target flattening plane based on the above steps, it can further determine whether the terrain data points of the terrain block data to be rendered are within the target flattening plane. And when it is determined that the terrain data points of the terrain block data to be rendered are within the target flattening plane, step 406 is executed; when it is determined that the terrain data points of the terrain block data to be rendered are outside the target flattening plane, step 408 is executed.

[0083] Step 406, update the height of the terrain data point to the height of the target flattening plane.

[0084] Specifically, when the terminal determines that the distance between the terrain block data to be rendered and the target is greater than the preset distance threshold and determines that the terrain data points of the terrain block data to be rendered are within the target flattening plane, the height of the corresponding terrain data point can be updated to the height of the target flattening plane, that is, the height of the target flattening plane is assigned to the terrain data points located inside it.

[0085] Step 408, keep the height of the terrain data point unchanged.

[0086] Specifically, when the terminal determines that the terrain data points of the terrain block data to be rendered are outside the target flattening plane, the height of the terrain data point remains unchanged.

[0087] Step 410, construct a rendering grid based on the heights of the terrain data points.

[0088] Specifically, based on the above steps, the terminal can determine the heights of the terrain data points of the terrain block data to be rendered that meet the conditions, and then can construct a rendering grid based on the heights of the terrain data points. In this embodiment, the target vertex height of the rendering grid is the height of the corresponding terrain data point, that is, the height determined in the above steps.

[0089] Since in this embodiment, during the flattening process of simplifying the terrain block data to be rendered, unified processing is performed based on the positional relationship between the terrain data points of the terrain block data to be rendered and the target flattening plane, the processing efficiency can be improved.

[0090] In one scenario, during the flattening process of simplifying the rendering grid and during the flattening process of refining the rendering grid, both can be implemented based on multiple threads. For example, during the flattening process of refinement, for the processing of each rendering grid, a thread can be used for parallel processing respectively; during the flattening process of simplification, for the processing of each terrain block data to be rendered, a thread can also be used for parallel processing respectively, thereby further improving the processing efficiency to achieve real-time flattening.

[0091] In one scenario, it can be understood that after the terminal determines the terrain block data to be rendered based on step 104, it can also calculate the bounding sphere of the preset flattening plane, and calculate the bounding sphere of the terrain block data to be rendered, and determine whether the bounding sphere of the terrain block data to be rendered intersects with the bounding sphere of the preset flattening plane. If the two intersect, then use this preset flattening plane as the target flattening plane for the corresponding intersecting terrain block data to be rendered. And perform flattening processing on the intersecting terrain block data to be rendered based on the above method of the present application. For the terrain block data to be rendered that does not intersect with each target flattening plane, directly construct a rendering grid based on the height of the terrain data points corresponding to the terrain block data to be rendered, that is, the target vertex height of the rendering grid is determined by the height of the corresponding terrain data point. Then perform unified rendering processing according to the target vertex heights of each rendering grid to obtain the rendered terrain.

[0092] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this document, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0093] Based on the same inventive concept, an embodiment of the present application also provides a terrain rendering device for implementing the terrain rendering method described above. The solution provided by this device for solving problems is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the terrain rendering device provided below can refer to the limitations on the terrain rendering method in the above text, and will not be repeated here.

[0094] In an exemplary embodiment, as Figure 5 shown, a terrain rendering device is provided, including: a chunking module 502, a to-be-rendered chunk determination module 504, a rendering grid construction module 506, a target height determination module 508, and a rendering module 510, where:

[0095] The chunking module 502 is configured to chunk the to-be-processed terrain data using a quadtree algorithm to obtain multiple terrain chunk data at multiple levels;

[0096] The to-be-rendered chunk determination module 504 is configured to determine the to-be-rendered terrain chunk data from the multiple terrain chunk data at multiple levels based on a preset display condition;

[0097] The rendering grid construction module 506 is configured to construct a rendering grid according to the to-be-rendered terrain chunk data when it is determined that the distance between the to-be-rendered terrain chunk data and the target is less than or equal to a preset distance threshold, and the rendering grid has an initial vertex height;

[0098] The target height determination module 508 is configured to determine the target vertex height of the rendering grid according to the positional relationship between the rendering grid and the target pressure plane;

[0099] The rendering module 510 is configured to perform rendering processing according to the target vertex height of the rendering grid to obtain a rendered terrain.

[0100] In an exemplary embodiment, the target height determination module is further configured to: obtain the positional relationship between the rendering grid and the target pressure plane; when it is determined according to the positional relationship that the rendering grid intersects with the target pressure plane and the rendering grid is within the target pressure plane, determine that the target vertex height of the rendering grid is the height of the target pressure plane.

[0101] In an exemplary embodiment, the target height determination module is further configured to: when it is determined according to the positional relationship that the rendering grid intersects with the target pressure plane, determine a first region and a second region where the rendering grid intersects with the target pressure plane, where the first region is the region where the rendering grid is within the target pressure plane, and the second region is the region where the rendering grid is outside the target pressure plane; use the height of the target pressure plane as the target vertex height of the first region of the rendering grid; use the initial vertex height of the second region of the rendering grid as the target vertex height.

[0102] In an exemplary embodiment, the target height determination module is further configured to: when it is determined according to the positional relationship that the rendering grid does not intersect with the target pressure plane, use the initial vertex height of the rendering grid as the target vertex height.

[0103] In an exemplary embodiment, the terrain block data to be rendered includes a plurality of terrain data points and corresponding heights; the target height determination module is further configured to: when it is determined that the distance between the terrain block data to be rendered and the target is greater than a preset distance threshold, if the terrain data points of the terrain block data to be rendered are within the target pressure plane, update the height of the terrain data points to the height of the target pressure plane; if the terrain data points of the terrain block data to be rendered are outside the target pressure plane, keep the height of the terrain data points unchanged; construct a rendering grid according to the heights of the terrain data points, and the target vertex height of the rendering grid is the height of the corresponding terrain data point.

[0104] In an exemplary embodiment, the terrain block to be rendered determination module is further configured to: when it is determined that the terrain block data is visible and the pixel size of the screen occupied by the terrain block data is less than a preset pixel threshold, determine the terrain block data as the terrain block data to be rendered.

[0105] Each module in the above terrain rendering device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above respective modules.

[0106] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structural diagram may be as shown in Figure 6 . The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC), or other technologies. The computer program, when executed by the processor, implements a terrain rendering method. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen may be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device may be a touch layer covered on the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0107] Those skilled in the art can understand that Figure 6 the structure shown in is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.

[0108] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0109] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0110] In an embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0111] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0112] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., and are not limited thereto.

[0113] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as within the scope recorded in this application.

[0114] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application should be subject to the appended claims.

Claims

1. A terrain rendering method, characterized in that, The method includes: Using a quadtree algorithm to divide the terrain data to be processed into blocks, obtaining multiple terrain block data at multiple levels; Determining the terrain block data to be rendered from the multiple terrain block data at multiple levels based on preset display conditions; When it is determined that the distance between the terrain block data to be rendered and the target is less than or equal to a preset distance threshold, constructing a rendering grid according to the terrain block data to be rendered, the rendering grid having an initial vertex height; determining the target vertex height of the rendering grid according to the positional relationship between the rendering grid and the target pressure plane; When it is determined that the distance between the terrain block data to be rendered and the target is greater than the preset distance threshold, if the terrain data point of the terrain block data to be rendered is within the target pressure plane, updating the height of the terrain data point to the height of the target pressure plane; if the terrain data point of the terrain block data to be rendered is outside the target pressure plane, keeping the height of the terrain data point unchanged, and constructing a rendering grid according to the height of the terrain data point, the target vertex height of the rendering grid being the height of the corresponding terrain data point; Performing rendering processing according to the target vertex height of the rendering grid to obtain a rendered terrain; The determining the terrain block data to be rendered from the multiple terrain block data at multiple levels based on preset display conditions includes: traversing the multiple terrain block data at multiple levels, judging whether the terrain block data is visible according to the pose parameters of the camera, and determining the visible terrain block data based on the terrain block data being invisible as the termination condition of the traversal; calculating the pixel size of each visible terrain block data occupied on the screen, and determining the visible terrain block data with the pixel size occupied on the screen less than a preset pixel threshold as the terrain block data to be rendered.

2. The method according to claim 1, wherein The determining the target vertex height of the rendering grid according to the positional relationship between the rendering grid and the target pressure plane includes: Obtaining the positional relationship between the rendering grid and the target pressure plane; When it is determined according to the positional relationship that the rendering grid intersects with the target pressure plane and the rendering grid is within the target pressure plane, determining the target vertex height of the rendering grid as the height of the target pressure plane.

3. The method according to claim 2, wherein The method further includes: When it is determined according to the positional relationship that the rendering grid intersects with the target pressure plane, determining a first region and a second region where the rendering grid intersects with the target pressure plane, the first region being the region where the rendering grid is within the target pressure plane, and the second region being the region where the rendering grid is outside the target pressure plane; Taking the height of the target pressure plane as the target vertex height of the first region of the rendering grid; Taking the initial vertex height of the second region of the rendering grid as the target vertex height.

4. The method according to claim 2, characterized in that, The method further includes: When it is determined according to the positional relationship that the rendering grid does not intersect with the target pressure plane, taking the initial vertex height of the rendering grid as the target vertex height.

5. A terrain rendering device, characterized in that, The device includes: A chunking module for using a quadtree algorithm to divide the terrain data to be processed into blocks, obtaining multiple terrain block data at multiple levels; A to-be-rendered block determination module, configured to determine to-be-rendered terrain block data from multiple terrain block data at multiple levels based on preset display conditions; A rendering mesh construction module, configured to, when it is determined that the distance between the to-be-rendered terrain block data and the target is less than or equal to a preset distance threshold, construct a rendering mesh according to the to-be-rendered terrain block data, where the rendering mesh has an initial vertex height; determine the target vertex height of the rendering mesh according to the positional relationship between the rendering mesh and the target pressure plane; and, when it is determined that the distance between the to-be-rendered terrain block data and the target is greater than the preset distance threshold, if the terrain data point of the to-be-rendered terrain block data is within the target pressure plane, update the height of the terrain data point to the height of the target pressure plane; if the terrain data point of the to-be-rendered terrain block data is outside the target pressure plane, keep the height of the terrain data point unchanged, and construct a rendering mesh according to the height of the terrain data point, where the target vertex height of the rendering mesh is the height of the corresponding terrain data point; A rendering module, configured to perform rendering processing according to the target vertex height of the rendering mesh to obtain a rendered terrain; The to-be-rendered block determination module is specifically configured to: traverse multiple terrain block data at multiple levels, determine whether the terrain block data is visible according to the pose parameters of the camera, and determine the visible terrain block data based on the invisibility of the terrain block data as the termination condition of the traversal; calculate the pixel size of each visible terrain block data occupying the screen, and determine the visible terrain block data with a pixel size less than a preset pixel threshold as the to-be-rendered terrain block data.

6. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 4.

8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • LOD-based terrain rendering method and device

    CN114494623A

  • Methods, apparatus, equipment, and storage media for flattening and editing quantized grid terrain.

    CN114937126A