Terrain rendering method and device, computer equipment, readable storage medium and program product
Through the quad-tree algorithm blocking and preset display condition filtering, combined with the rendering processing method of the positional relationship between the terrain block and the target flattening plane, the real-time and matching effect problems of terrain data flattening in traditional technology are solved, and efficient and non-existent The rendering effect of jagged.
Patent Information
- Application Number
- CN202510013754.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2045-01-06
AI Technical Summary
Traditional terrain data flattening technology has problems such as inability to process in real time when the data volume is large, edge jagging problems, and poor matching effects with the model.
The quad-tree algorithm is used to block the terrain data, determine the terrain block data to be rendered based on the preset display conditions, and build the rendering grid based on the positional relationship between the terrain block data and the target plane, and determine the target vertex of the rendering grid Height rendering.
Real-time and efficient flattening rendering of massive terrain data is achieved, avoiding edge jagging and ensuring accurate matching with the model.
Smart Images

Figure CN119418016A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a terrain rendering method, apparatus, computer equipment, readable storage medium and program product. Background Art
[0002] With the development of 3D visualization technology, the data that can be accessed in 3D geographic information systems is becoming more and more abundant, and the fusion and matching of various data is also receiving more and more attention. By flattening the terrain data, it is possible to match the artificial design model (such as BIM models of roads, bridges, buildings, etc.) with the real terrain, and the model can be displayed more clearly and intuitively in the 3D scene report for easy understanding.
[0003] In traditional technologies, the flattening methods for terrain data generally include geometric algorithms based on CPU (Central Processing Unit) and flattening algorithms based on GPU (Graphics Processing Unit). However, the geometric algorithms based on CPU only support the processing of two-dimensional data with small data volume, and when the data volume is large, the data needs to be pre-processed, so real-time processing cannot be achieved. The flattening algorithm based on GPU has edge jaggedness, which leads to poor matching effect with the model. Summary of the invention
[0004] Based on this, it is necessary to provide a terrain rendering method, device, computer equipment, computer-readable storage medium and computer program product that can ensure data quality and implement processing in response to the above technical problems.
[0005] In a first aspect, the present application provides a terrain rendering method, comprising:
[0006] The quadtree algorithm is used to divide the terrain data to be processed into blocks to obtain multiple terrain block data at multiple levels;
[0007] Determining terrain block data to be rendered from a plurality of 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, wherein the rendering grid has an initial vertex height;
[0009] Determining a target vertex height of the rendering grid according to a positional relationship between the rendering grid and a target pressure plane;
[0010] Rendering is performed according to the target vertex height of the rendering grid to obtain a rendered terrain.
[0011] In one of the embodiments, determining the target vertex height of the rendering mesh according to the positional relationship between the rendering mesh and the target pressure plane includes: obtaining the positional relationship between the rendering mesh and the target pressure plane; and when it is determined that the rendering mesh intersects with the target pressure plane according to the positional relationship and the rendering mesh is located within the target pressure plane, determining the target vertex height of the rendering mesh to be the height of the target pressure plane.
[0012] In one of the embodiments, the method further includes: in a case where the intersection between the rendering grid and the target pressure plane is determined according to the positional relationship, determining a first area and a second area where the rendering grid and the target pressure plane intersect, the first area being an area where the rendering grid is located within the target pressure plane, and the second area being an area where the rendering grid is located outside the target pressure plane; using the height of the target pressure plane as the target vertex height of the first area of the rendering grid; and using the initial vertex height of the second area of the rendering grid as the target vertex height.
[0013] In one of the embodiments, the method further includes: when it is determined according to the positional relationship that the rendering mesh and the target pressure plane do not intersect, using the initial vertex height of the rendering mesh as the target vertex height.
[0014] In one of the embodiments, the terrain block data to be rendered includes multiple terrain data points and corresponding heights; before the rendering processing is performed according to the target vertex height of the rendering grid to obtain the rendered terrain, the method also 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 located 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 located outside the target pressure plane, maintaining 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 of the embodiments, 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 screen occupied by the terrain block data 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, the device comprising:
[0017] A block module is used to block the terrain data to be processed using a quadtree algorithm to obtain multiple terrain block data at multiple levels;
[0018] A module for determining a block to be rendered, used for determining terrain block data to be rendered from a plurality of terrain block 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 terrain block data to be rendered, 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, wherein the rendering mesh has an initial vertex height;
[0020] A target height determination module, used to determine a target vertex height of the rendering grid according to a positional relationship between the rendering grid and a target pressure plane;
[0021] The rendering module is used to perform rendering processing according to the target vertex height of the rendering grid to obtain a rendered terrain.
[0022] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in the first aspect when executing the computer program.
[0023] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the first aspect above.
[0024] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method described in the first aspect above.
[0025] In the terrain rendering method, device, computer equipment, computer-readable storage medium and computer program product, the terminal divides the terrain data to be processed into blocks by using a quadtree algorithm to obtain multiple terrain block data of multiple layers, and determines the terrain block data to be rendered from the multiple terrain block data of multiple layers 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 the 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 pressure plane, and then the rendering process is performed according to the target vertex height of the rendering grid to obtain the rendered terrain. It can realize fast traversal of terrain blocks through quadtree division, screen terrain blocks to be rendered through display conditions of visibility and occupied pixel size, determine the flattening processing method through a preset distance threshold, and finally render the processed data, so as to support real-time and efficient flattening rendering of massive terrain data, and the flattened edge has no jagged edges and can accurately match the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 A schematic diagram of a flow chart of a terrain rendering method in one embodiment;
[0028] Figure 2 A schematic diagram of a process of a fine flattening step in one embodiment;
[0029] Figure 3A A schematic diagram of the intersection of a rendering grid and a target pressure plane in one embodiment;
[0030] Figure 3B A schematic diagram of the intersection of a rendering grid and a target pressure plane in another embodiment;
[0031] Figure 3C A schematic diagram of a rendering grid not intersecting with a target pressure plane in one embodiment;
[0032] Figure 4 A schematic diagram of a simplified flattening step in one embodiment;
[0033] Figure 5 is a structural block diagram of a terrain rendering device in one embodiment;
[0034] Figure 6FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0036] Because the traditional CPU-based geometric algorithm only supports the processing of two-dimensional data with a small amount of data, it cannot be displayed correctly in the spherical coordinate system, which limits the use of scenarios; when the amount of data is large, the data needs to be preprocessed, and it cannot be changed after loading, and the excavation surface cannot be set in real time. The GPU-based flattening algorithm flattens the terrain data. Before rendering the scene, it draws the depth of the flattened plane to a texture by orthogonal projection, and saves the camera's posture parameters. Then, when drawing the scene, the depth of each fragment and the corresponding texture coordinates are inversely calculated according to the saved camera parameters. The texture value obtained through the texture coordinates is the depth of the flattened plane. When the fragment depth is less than the flattened plane depth, the fragment depth is changed to the flattened plane depth and the corresponding scene coordinates are calculated. Otherwise, it is not processed. As a result, obvious jagged edges will be generated on the flattened plane, which cannot accurately match the model edge.
[0037] Based on this, the present application provides a terrain rendering method, which realizes fast traversal of terrain through quadtree partitioning, selects tiles to be rendered by visibility and pixel size, 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 on the flattened edges, which can accurately match the model.
[0038] In one embodiment, Figure 1 As shown, a terrain rendering method is provided. This embodiment takes the method applied to a terminal as an example for illustration. 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 implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0039] Step 102: Use a quadtree algorithm to divide the terrain data to be processed into blocks to obtain a plurality of 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, and terrain data is an important data type used to describe the surface morphology in the Geographic Information System (GIS). It is a type of data that can represent the ups and downs of the earth's surface, that is, it contains the elevation information of the surface and can be used for a variety of applications and analyses.
[0041] A quadtree is a tree data structure that divides a two-dimensional space into four quadrants or sub-regions, with each node representing a rectangular region. In computer vision and image processing, quadtrees are often used for image segmentation, compression, and acceleration. In a quadtree, each node represents a region and can be further divided into four child nodes, each representing a quadrant of the original region. This process is performed recursively until a specific stopping condition is met, such as the region is small enough or the pixel values within the region are consistent enough. Each node of a quadtree can be a leaf node or an internal node (also known as a parent node). A leaf node represents an area that cannot be divided any further, while an internal node represents an area that can be further divided. In image processing, leaf nodes usually represent an image region with similar features.
[0042] In this embodiment, after the terminal obtains the terrain data that needs to be rendered, it can use the quadtree algorithm to divide the terrain data to be processed into blocks to obtain multiple layers of terrain block data. 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, and 32 terrain block data can be obtained at level 2. By analogy, multiple layers of terrain block data of the terrain data to be processed can be obtained, that is, multiple levels of detailed terrain can be obtained. The terrain block data of the next level is the child node of the terrain block data of the previous level, and the terrain block data of the previous level is the parent node of the terrain block data of the next level.
[0043] Step 104 : determining terrain block data to be rendered from a plurality of terrain block data at multiple levels based on a preset display condition.
[0044] The terrain block data to be rendered refers to the terrain block data that needs to be rendered. The display condition may be a pre-set relevant condition for screening the terrain block data to be rendered. Specifically, the preset display condition may include a condition on whether the terrain block data is visible and a pixel threshold condition on the screen pixel size occupied by the terrain block data.
[0045] In this embodiment, the terminal can traverse the multi-level terrain block data of the terrain quadtree structure obtained in the above steps, and determine whether the terrain block data is visible according to the posture parameters of the camera. If the parent node is invisible, the corresponding child node is also invisible, so there is no need to traverse again. That is, the visible terrain block data is determined based on whether the terrain block data is visible as the termination condition of the traversal.
[0046] Then, the pixel size of each visible terrain block data on the screen can be calculated based on the camera parameters and the bounding sphere of the visible terrain block data. When the pixel size of a 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, that is, it is determined to be the terrain block data to be rendered. When a certain terrain block data is not visible, or the pixel size of 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 may be a preset pixel threshold. When the terminal determines that the pixel size of a visible terrain block data on the screen is less than the preset pixel threshold, it means that the set condition is met. Therefore, the terrain block data meeting the condition may be determined as the terrain block data to be rendered. It is understood that the specific size of the preset pixel threshold may be set to different values based on the needs of the actual scene, which 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 a preset distance threshold, construct a rendering grid according to the terrain block data to be rendered.
[0049] The target may be a camera for shooting. The rendering mesh may be a triangular patch constructed when rendering terrain data. A triangular patch 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 a face is usually a triangle formed by three vertices connected. Specifically, each vertex of the rendering mesh has an initial vertex height, which comes from the elevation information at the corresponding position in the terrain data.
[0050] The preset distance threshold may be a pre-set condition for selecting a method for flattening the terrain block data to be rendered. The flattening method may include a simplified flattening method and a refined flattening method. Since the refined and simplified flattening methods do not produce visual differences when the distance is far, and the refined and simplified flattening methods produce visual differences when the distance is close, the preset distance threshold may be a dividing point between those that produce visual differences and those that do not, that is, the portion greater than the dividing point will not produce visual differences regardless of the processing method, while the portion less than or equal to the dividing point will produce visual differences 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 a preset distance threshold, a simplified flattening method can be used to flatten the terrain block data to be rendered to improve the processing speed; and 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 to improve 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, the terminal can use a fine flattening method to flatten the terrain block data to be rendered. In this flattening method, the terminal can first construct a rendering grid according to the terrain block data to be rendered, and flatten and render it through subsequent steps.
[0053] Step 108: Determine the target vertex height of the rendering mesh according to the positional relationship between the rendering mesh and the target compression plane.
[0054] 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 in the area looks flat. The preset flattening plane can be pre-defined by the user to ensure that the flattened terrain is visually and functionally correct.
[0055] Specifically, after determining the terrain block data to be rendered based on the above steps, the terminal can also calculate the bounding sphere of the preset compression plane, as well as 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 compression plane. If the two intersect, the preset compression plane is used as the target compression plane of the corresponding intersecting terrain block data to be rendered. The target compression plane is used to flatten the intersecting terrain block data to be rendered. Among them, the bounding sphere is a concept for dynamic positioning of local areas in a three-dimensional scene. It is a sphere, which is defined according to the position and size of the corresponding area. The purpose is to make the bounding sphere tightly contain the corresponding area, while minimizing the radius of the sphere as much as possible.
[0056] Then, the terminal can determine the target vertex height of the rendering grid according to the positional relationship between the rendering grid corresponding to the terrain block data to be rendered and the target pressure plane. The target vertex height is the final height of each vertex of the rendering grid when rendering. The positional relationship can characterize the relative position between the two (i.e., the rendering grid and the target pressure plane), and can determine whether the two positions intersect or do not intersect.
[0057] Step 110 , performing rendering processing according to the target vertex height of the rendering mesh to obtain a rendered terrain.
[0058] Specifically, after determining the target vertex height of the rendering grid based on the above steps, the terminal can perform rendering processing according to the target vertex height of the rendering grid to obtain a rendered terrain.
[0059] In the above terrain rendering method, the terminal can use a quadtree algorithm to divide the terrain data to be processed into blocks, obtain multiple terrain block data of multiple layers, and determine the terrain block data to be rendered from the multiple terrain block data of multiple layers 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 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 pressure plane, and then the rendering process is performed according to the target vertex height of the rendering grid to obtain the rendered terrain. It can realize fast traversal of terrain blocks through quadtree division, screen the terrain blocks to be rendered through the display conditions of visibility and the pixel size occupied, determine the flattening processing method through the preset distance threshold, and finally render the processed data, so as to support real-time and efficient flattening rendering of massive terrain data, and the flattened edge has no jagged edges and can accurately match the model.
[0060] In an exemplary embodiment, Figure 2 As shown, a fine flattening method is used to flatten the terrain block data to be rendered, which may specifically 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 the preset distance threshold, the terrain block data to be rendered can be flattened in a fine flattening manner. In this processing process, a rendering grid is first constructed, which can be specifically constructed based on the terrain data to be processed. 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 compression plane.
[0064] Specifically, the positional relationship may represent the relative position between the rendering grid and the target pressure plane. In this embodiment, the terminal may traverse the rendering grid corresponding to the terrain block data to be rendered, thereby obtaining the positional relationship between the rendering grid and the target pressure plane, that is, obtaining the relative position between the two.
[0065] Step 206: determine whether the rendering grid intersects with the target compression 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 and the target pressure plane intersect according to the above positional relationship, and execute step 208 when it is determined that the rendering grid and the target pressure plane intersect, and execute step 216 when it is determined that the rendering grid and the target pressure plane do not intersect.
[0067] Step 208: determine whether the rendering grid is located within the target compression plane.
[0068] Specifically, when the terminal determines that the rendering grid intersects with the target pressure plane based on the above steps, the terminal further determines the intersection type between the rendering grid and the target pressure plane, such as whether it is an inclusive intersection or a partial intersection. That is, it determines whether the rendering grid is located within the target pressure plane, and when it is determined that the rendering grid is within the target pressure plane, step 210 is executed, and when it is determined that the rendering grid is not within the target pressure plane, step 212 is executed.
[0069] Step 210 , determining the target vertex height of the rendering mesh as the height of the target compression plane.
[0070] Specifically, Figure 3AAs shown, when the terminal determines that the rendering grid intersects with the target compression plane based on the above steps, and determines that the rendering grid is located within the target compression plane, the target vertex height of the rendering grid is determined to be the height of the target compression plane, that is, the height of the target compression plane is assigned to each vertex of the rendering grid inside it as the target vertex height of the rendering grid, thereby achieving flattening of the corresponding rendering grid data.
[0071] Step 212: determine a first region and a second region where the rendering grid intersects with the target compression plane.
[0072] Specifically, when the terminal determines that the rendering grid intersects with the target pressure plane based on the above steps, and determines that the rendering grid is not located within the target pressure plane, it means that the two partially intersect. Therefore, the first area and the second area where the rendering grid intersects with the target pressure plane can be further determined. Figure 3B As shown, the first area is the area where the rendering grid is located within the target pressure plane, that is, the inner area of the intersection, indicating the overlapping area between the rendering grid and the target pressure plane. The second area is the area where the rendering grid is located outside the target pressure plane, that is, the outer area of the intersection, indicating other areas in the rendering grid except the overlapping area with the target pressure plane.
[0073] Step 214, determining the target vertex heights corresponding to the first area and the second area.
[0074] Specifically, for the intersecting internal area, i.e., the first area, the terminal can assign the height of the target flattening plane to the vertex in the area in the rendering grid as the target vertex height of the corresponding vertex. For the intersecting external area, i.e., the second area, the height of the vertex in the corresponding area can be kept unchanged, that is, the initial vertex height of the vertex in the corresponding area is used as the target vertex height. In this way, flexible flattening processing of the corresponding rendering grid data is achieved to improve the display effect.
[0075] Step 216: Using the initial vertex height of the rendered mesh as the target vertex height.
[0076] Specifically, Figure 3C As shown, when the terminal determines that the rendering grid and the target flattening plane do not intersect according to the positional relationship, the height of each vertex in the rendering grid can be kept unchanged, that is, the initial vertex height of the rendering grid is used as the target vertex height, thereby achieving fine flattening processing of the rendering grid that meets the conditions.
[0077] Since the target vertex height of the rendering mesh is determined in different ways based on the different positional relationships between the rendering mesh and the target flattening plane during the fine flattening process of the rendering mesh in this embodiment, the problem of edge jaggedness can be avoided, and the edge effect after flattening can be improved, so that the flattened data can match the model perfectly.
[0078] In an exemplary embodiment, the terrain block data to be rendered includes a plurality of terrain data points and corresponding heights; Figure 4 As 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 pressure plane.
[0080] Specifically, when the terminal determines that the distance between the terrain block data to be rendered and the target is greater than a preset distance threshold, a simplified flattening method can be used to flatten the terrain block data to be rendered. In this processing process, the positional relationship between each terrain data point in the terrain block data to be rendered and the target flattening plane can be first obtained. The positional relationship can represent the relative position between the two.
[0081] Step 404 , determining whether the terrain data points of the terrain block data to be rendered are located within the target compression plane.
[0082] Specifically, after obtaining the positional relationship between the terrain block data to be rendered and the target pressure plane based on the above steps, the terminal can further determine whether the terrain data point of the terrain block data to be rendered is located within the target pressure plane. If it is determined that the terrain data point of the terrain block data to be rendered is within the target pressure plane, step 406 is executed, and if it is determined that the terrain data point of the terrain block data to be rendered is outside the target pressure plane, step 408 is executed.
[0083] Step 406: Update the height of the terrain data point to the height of the target pressure plane.
[0084] Specifically, when the terminal determines that the distance between the terrain block data to be rendered and the target is greater than a preset distance threshold, and determines that the terrain data point of the terrain block data to be rendered is located within the target pressure plane, the height of the corresponding terrain data point can be updated to the height of the target pressure plane, that is, the height of the target pressure plane is assigned to the terrain data point located inside it.
[0085] Step 408, maintaining the height of the terrain data point unchanged.
[0086] Specifically, when the terminal determines that the terrain data point of the terrain block data to be rendered is outside the target pressure plane, the height of the terrain data point is maintained unchanged.
[0087] Step 410 , constructing a rendering grid according to the heights of the terrain data points.
[0088] Specifically, based on the above steps, the terminal can determine the height of the terrain data point of the terrain block data to be rendered that meets the conditions, and then can construct a rendering grid according to the height of the terrain data point. 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 this embodiment performs unified processing based on the positional relationship between the terrain data points of the terrain block data to be rendered and the target flattening plane during the simplified flattening processing of the terrain block data to be rendered, the processing efficiency can be improved.
[0090] In one scenario, both the simplified flattening process and the refined flattening process can be implemented based on multithreading. For example, in the refined flattening process, each rendering mesh can be processed in parallel using one thread; in the simplified flattening process, each terrain block data to be rendered can also be processed in parallel using one thread, thereby further improving the processing efficiency and achieving 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 compression plane, as well as 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 compression plane. If the two intersect, the preset compression plane is used as the target compression plane corresponding to the intersecting terrain block data to be rendered. The above-mentioned method of the present application is used to flatten the intersecting terrain block data to be rendered based on the target compression plane, and for the terrain block data to be rendered that does not intersect with each target compression plane, a rendering grid is directly constructed based on the height of the terrain data point 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, unified rendering processing is performed according to the target vertex height of each rendering grid to obtain a rendered terrain.
[0092] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0093] Based on the same inventive concept, the embodiment of the present application also provides a terrain rendering device for implementing the terrain rendering method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more terrain rendering device embodiments provided below can refer to the limitations on the terrain rendering method above, and will not be repeated here.
[0094] In an exemplary embodiment, Figure 5 As shown, a terrain rendering device is provided, including: a block division module 502, a to-be-rendered block determination module 504, a rendering grid construction module 506, a target height determination module 508 and a rendering module 510, wherein:
[0095] A block division module 502 is used to divide the terrain data to be processed into blocks using a quadtree algorithm to obtain a plurality of terrain block data at multiple levels;
[0096] The to-be-rendered block determination module 504 is used to determine the to-be-rendered terrain block data from a plurality of terrain block data at multiple levels based on a preset display condition;
[0097] A rendering mesh construction module 506 is used to construct a rendering mesh according to the terrain block data to be rendered 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, wherein the rendering mesh has an initial vertex height;
[0098] A target height determination module 508, configured to determine a target vertex height of the rendering mesh according to a positional relationship between the rendering mesh and a target pressure plane;
[0099] The rendering module 510 is used 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 used to: obtain a positional relationship between the rendering grid and the target pressure plane; and when it is determined that the rendering grid intersects with the target pressure plane according to the positional relationship and the rendering grid is located within the target pressure plane, determine the target vertex height of the rendering grid as the height of the target pressure plane.
[0101] In an exemplary embodiment, the target height determination module is further used to: determine a first area and a second area of the intersection between the rendering grid and the target pressure plane when the intersection between the rendering grid and the target pressure plane is determined according to the positional relationship, the first area being an area where the rendering grid is located within the target pressure plane, and the second area being an area where the rendering grid is located outside the target pressure plane; using the height of the target pressure plane as the target vertex height of the first area of the rendering grid; and using the initial vertex height of the second area 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 and the target pressure plane do not intersect, 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 multiple terrain data points and corresponding heights; the target height determination module is also used 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 point of the terrain block data to be rendered is located 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 terrain block data to be rendered is located outside the target pressure plane, maintain the height of the terrain data point unchanged; construct 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.
[0104] In an exemplary embodiment, the module for determining blocks to be rendered is further configured to: if 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 terrain block data to be rendered.
[0105] Each module in the terrain rendering device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0106] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. 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. 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 an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a terrain rendering method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0107] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure 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 certain components, or have a different arrangement of components.
[0108] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0109] In one 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-mentioned method embodiments are implemented.
[0110] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[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 used 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 must comply with relevant regulations.
[0112] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and 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-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present 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), magnetic 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0113] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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, they should be considered to be within the scope of this application.
[0114] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A terrain rendering method, characterized in that: The method comprises: The quadtree algorithm is used to divide the terrain data to be processed into blocks to obtain multiple terrain block data at multiple levels; Determining terrain block data to be rendered from a plurality of 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, constructing a rendering grid according to the terrain block data to be rendered, wherein the rendering grid has an initial vertex height; Determining a target vertex height of the rendering grid according to a positional relationship between the rendering grid and a target pressure plane; Rendering is performed according to the target vertex height of the rendering grid to obtain a rendered terrain.
2. The method according to claim 1, characterized in that The step of determining a target vertex height of the rendering mesh according to a positional relationship between the rendering mesh and a target pressure plane includes: Acquire a positional relationship between the rendering grid and a target pressing 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 located within the target pressure plane, a target vertex height of the rendering grid is determined to be a height of the target pressure plane.
3. The method according to claim 2, characterized in that The method further comprises: In a case where it is determined according to the positional relationship that the rendering grid intersects with the target pressure plane, determining a first area and a second area where the rendering grid intersects with the target pressure plane, the first area being an area where the rendering grid is located within the target pressure plane, and the second area being an area where the rendering grid is located outside the target pressure plane; Using the height of the target pressure plane as the target vertex height of the first area of the rendering grid; The initial vertex height of the second region of the rendering mesh is used as the target vertex height.
4. The method according to claim 2, characterized in that: The method further comprises: When it is determined according to the positional relationship that the rendering mesh and the target pressure plane do not intersect, the initial vertex height of the rendering mesh is used as the target vertex height.
5. The method according to any one of claims 1 to 4, characterized in that: 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 the 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 located within the target pressure plane, updating the height of the terrain data point to be 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, maintaining the height of the terrain data point unchanged; A rendering grid is constructed according to the height of the terrain data point, and the height of the target vertex of the rendering grid is the height of the corresponding terrain data point.
6. The method according to any one of claims 1 to 4, characterized in that: The determining of the terrain block data to be rendered from the multiple terrain block data at multiple levels based on the preset display conditions includes: 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 smaller than a preset pixel threshold, the terrain block data is determined as terrain block data to be rendered.
7. A terrain rendering device, characterized in that: The device comprises: A block module is used to block the terrain data to be processed using a quadtree algorithm to obtain multiple terrain block data at multiple levels; A module for determining a block to be rendered, used for determining terrain block data to be rendered from a plurality of terrain block data at multiple levels based on a preset display condition; A rendering mesh construction module, configured to construct a rendering mesh according to the terrain block data to be rendered, 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, wherein the rendering mesh has an initial vertex height; A target height determination module, used to determine a target vertex height of the rendering grid according to a positional relationship between the rendering grid and a target pressure plane; The rendering module is used to perform rendering processing according to the target vertex height of the rendering grid to obtain a rendered terrain.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
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
Model rendering method and device, terminal equipment and readable storage medium
CN119169165A
Cited By
Topographic map visualization method and device, equipment and medium
CN121236318A