Rendering method of three-dimensional terrain model, electronic equipment, medium and program product
By thinning the terrain data horizontally and vertically to generate multiple sub-units, and utilizing the efficient parallel computing capabilities of WebGPU to construct a 3D terrain model, the problem that traditional rendering engines cannot handle the large-scale terrain rendering needs is solved, thus improving rendering effects and performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-03-31
AI Technical Summary
Traditional 3D terrain rendering engines cannot effectively handle large-scale terrain rendering demands, resulting in poor rendering quality.
By performing horizontal and vertical thinning on the terrain data, multiple sub-units are generated. Based on the efficient parallel computing capabilities of WebGPU, a 3D terrain model is constructed and rendered using the high-performance rendering capabilities of WebGPU.
It improves the rendering effect of 3D terrain models, reduces memory alarms caused by full loading of massive terrain data partitions, and improves rendering performance and user experience.
Smart Images

Figure CN121767526A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of terrain rendering technology, specifically relating to a rendering method, electronic device, medium, and program product for a three-dimensional terrain model. Background Technology
[0002] In the current field of 3D terrain rendering, mainstream development tools such as Unreal Engine (UE) and Cesium dominate. UE, in particular, boasts powerful graphics rendering capabilities and a rich and extensive set of functional components, providing excellent support for large-scale models and scenes. However, with the rapid development of sensors, the server-side computing power and hardware requirements for real-time rendering of large-scale, high-resolution terrain data by UE are also increasing. Cesium, as a web-based Geographic Information System (GIS) engine, can support highly customizable geographic data visualization, but it relies on a Web Graphics Library (WebGL) for rendering. Traditional rendering engines suffer from insufficient utilization of computer resources and data, making them unable to handle large-scale terrain rendering demands, resulting in poor 3D terrain rendering effects. Summary of the Invention
[0003] This application provides a rendering method, electronic device, medium, and program product for a three-dimensional terrain model, which can solve the problem that traditional rendering engines cannot cope with a large number of terrain rendering needs, resulting in poor three-dimensional terrain rendering effects.
[0004] In a first aspect, embodiments of this application provide a method for rendering a three-dimensional terrain model, the method comprising: performing horizontal and vertical thinning on first terrain data to obtain second terrain data; determining multiple sub-units of the second terrain data; generating a three-dimensional terrain model based on the multiple sub-units; and rendering the three-dimensional terrain model.
[0005] Secondly, embodiments of this application provide a rendering apparatus for a three-dimensional terrain model. The apparatus includes: a thinning module for performing horizontal and vertical thinning on first terrain data to obtain second terrain data; a generation module for determining multiple sub-units of the second terrain data and generating a three-dimensional terrain model based on the multiple sub-units; and a rendering module for rendering the three-dimensional terrain model.
[0006] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0007] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0008] Fifthly, embodiments of this application provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the steps of the method described in the first aspect.
[0009] In this embodiment, second terrain data is obtained by horizontally and vertically thinning the first terrain data; multiple sub-units of the second terrain data are determined, and a three-dimensional terrain model is generated based on the multiple sub-units; the three-dimensional terrain model is rendered, which can make full use of the multiple sub-units of the first and second terrain data, providing strong data support for rendering the three-dimensional terrain model and improving the rendering effect of the three-dimensional terrain model. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating a rendering method for a three-dimensional terrain model provided in an embodiment of this application; Figure 2 This is a schematic diagram of a data acquisition process provided in an embodiment of this application; Figure 3 This is a schematic diagram illustrating the construction of a terrain triangulation network according to an embodiment of this application; Figure 4 This is a schematic diagram illustrating the calculation of the maximum elevation difference provided in an embodiment of this application; Figure 5 This is a schematic diagram of thinning provided in an embodiment of this application; Figure 6 This is a schematic diagram of a thinning structure merging provided in an embodiment of this application; Figure 7 This is a schematic diagram of a fifth terrain data construction process provided in an embodiment of this application; Figure 8 This is a schematic diagram illustrating the construction of a triangulated cell according to an embodiment of this application; Figure 9This is a schematic diagram illustrating the construction of another terrain triangulation network provided in an embodiment of this application; Figure 10 This is a schematic diagram of a terrain triangulation provided in an embodiment of this application; Figure 11 This is a schematic diagram illustrating the construction of a three-dimensional terrain model provided in an embodiment of this application; Figure 12 This is a schematic diagram of a level-of-detail model provided in an embodiment of this application; Figure 13 This is a schematic diagram of a three-dimensional terrain model rendering provided in an embodiment of this application; Figure 14 This is a schematic diagram of the overall process of rendering a three-dimensional terrain model provided in an embodiment of this application; Figure 15 This is a schematic diagram of the structure of a rendering device for a three-dimensional terrain model provided in an embodiment of this application; Figure 16 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0014] The rendering method, electronic device, medium, and program product of the three-dimensional terrain model provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0015] Figure 1 This application illustrates an embodiment of a rendering method for a three-dimensional terrain model, such as... Figure 1 As shown, the method includes the following steps: Step S101: Perform horizontal and vertical thinning on the first terrain data to obtain the second terrain data.
[0016] In this embodiment, the geographic information of the user's currently viewed area can be obtained in real time through a terrain data provider (DEM Provider) and an image provider (ImageProvider). Based on the actual geographic coordinates of the upper left corner of the user's view, the screen coordinates within the current view area can be converted into geographic coordinates and tile coordinates. Then, according to the tile range, the first terrain data and remote sensing image data corresponding to the geographic range are obtained from and returned to the spatial data storage server, achieving secure and complete acquisition of the first terrain data and image data.
[0017] Specifically, such as Figure 2 As shown, the method for obtaining the first terrain data and image data is as follows: the geographic coordinate range of the spatial data is obtained based on the screen pixel coordinates of the user's current window, and then the first terrain data and image data of the corresponding tile are obtained from the spatial data storage server using the terrain data feeder and image feeder.
[0018] As an example, if the actual geographic coordinates of the top left corner of the user's current view are... The actual geographical length of the current level tile The screen pixel size of a single tile is Then the geographic coordinates after the screen pixel coordinates are transformed for:
[0019]
[0020] If the geographic coordinates of the origin of the tiling map are The current location's geographic coordinates are The actual length represented by a unit pixel is Then the geographic coordinates are the converted tile coordinates. for:
[0021]
[0022] The first terrain and image data in the spatial data storage server can then be accessed and returned in the form of a Uniform Resource Locator (URL) based on the transformation results.
[0023] In this embodiment, different data acquisition methods can also be selected, such as using locally stored first terrain data and image data. This approach not only reduces reliance on real-time data acquisition mechanisms but also improves data access speed to some extent.
[0024] In this embodiment, after obtaining the first terrain data, the efficient parallel computing capabilities of the WebGPU (Web Graphics Processing Unit) can be leveraged to perform parallel vertical and horizontal thinning on the first terrain data using a cross-linear thinning algorithm, resulting in second terrain data. Horizontal thinning and vertical thinning are two different data simplification techniques in the field of data processing, differing in the direction of thinning. Horizontal thinning reduces data density along a horizontal direction (e.g., the x-axis or y-axis). Vertical thinning reduces data density along a vertical direction (e.g., the z-axis). Both are specific applications of "thinning" techniques, aiming to reduce data volume and computational complexity while preserving core data. WebGPU provides access to the graphics and computing power of hardware on the network, exposing the capabilities of GPUs to the Web.
[0025] Specifically, the first terrain data is thinned horizontally and vertically to obtain the second terrain data, including: calculating the first distance between each elevation point in the target row of the first terrain data and the elevation points at the beginning and end of the target row; calculating the second distance between each elevation point in the target column of the first terrain data and the elevation points at the beginning and end of the target column; and performing horizontal and vertical thinning on the first terrain data in parallel based on the first and second distances to obtain the second terrain data.
[0026] Figure 3 The illustration shows a schematic diagram of the construction of a terrain triangulation network provided in an embodiment of this application. Specifically, the first terrain data is subjected to vertical thinning and horizontal scanning. By comparing the distance from the elevation point to the line connecting the first and last elevation points with the distance threshold, elevation points with a distance less than the distance threshold are removed from the first terrain data to obtain the thinned second terrain data.
[0027] Specifically, the coordinates of feature points can first be obtained based on the data boundaries of the first terrain data, such as... Figure 4 As shown, the feature point coordinates can be the coordinates of the four vertices of the quadrilateral region. The elevation values of the four vertices are then arranged, and the maximum elevation difference is calculated using the following formula:
[0028] The elevation values of the coordinates of the four vertices.
[0029] Then the distance threshold can be determined based on the maximum elevation difference. :
[0030] in, These are the preset weights.
[0031] After determining the distance threshold, the first terrain data can be thinned vertically and horizontally using WebGPU. For each target row and column in the first terrain data, a first distance is calculated between each elevation point in the target row and the lines connecting its first and last elevation points. A second distance is calculated between each elevation point in the target column and the lines connecting its first and last elevation points. Then, the first terrain data can be thinned horizontally and vertically in parallel using a network graphics processor based on the first and second distances to obtain the second terrain data.
[0032] In this embodiment, based on the efficient parallel computing capabilities of WebGPU, the distance from the elevation point to the first and last elevation points in the first terrain data is obtained, and the first terrain data is thinned in both the vertical and horizontal dimensions. This effectively preserves the second terrain data with significant terrain features, reduces the memory alarm problem caused by the full loading of massive terrain data partitions, provides strong data support for rendering the 3D terrain model, and improves the rendering effect of the 3D terrain model.
[0033] In one implementation, the first terrain data is thinned laterally and vertically in parallel based on the first distance and the second distance to obtain the second terrain data. This includes: removing elevation points in the target row of the first terrain data whose first distance is less than a distance threshold to obtain the third terrain data; removing elevation points in the target column of the first terrain data whose second distance is less than a distance threshold to obtain the fourth terrain data; and generating the second terrain data based on the third terrain data and the fourth terrain data.
[0034] Specifically, after obtaining the first distance between the lines connecting each elevation point in the target row of the first terrain data to its first and last elevation points, and the second distance between the lines connecting each elevation point in the target column of the first terrain data to its first and last elevation points, as follows: Figure 5 As shown, WebGPU can be used to compare the first distance, the second distance, and a distance threshold. Elevation points in the target row of the first terrain data whose first distance is less than the distance threshold are removed, resulting in the third terrain data. Similarly, WebGPU can be used to remove elevation points in the target column of the first terrain data whose second distance is less than the distance threshold, resulting in the fourth terrain data. Thus, as... Figure 6 As shown, based on the parallel computing capabilities of WebGPU, the first terrain data can be thinned into multiple parallel tasks. The horizontal and vertical thinning results of each parallel processing are superimposed, and duplicate data is removed to obtain the complete second terrain data after thinning.
[0035] This embodiment leverages the efficient parallel computing capabilities of WebGPU. By obtaining the distances from elevation points in the first terrain data to the lines connecting the first and last elevation points, the first terrain data is thinned both vertically and horizontally. Elevation points in the first terrain data with a first or second distance less than a distance threshold are removed, effectively preserving second terrain data with significant terrain features. This reduces memory alarms caused by loading massive terrain data partitions in full, improving terrain rendering performance. Horizontal and vertical thinning of the first terrain data allows for the selection of terrain feature points from massive terrain data, significantly improving the real-time response capability of rendering massive terrain data, resulting in a smoother and more detailed user experience when browsing and manipulating terrain data on the web.
[0036] Step S102: Determine multiple sub-units of the second terrain data, and generate a three-dimensional terrain model based on the multiple sub-units.
[0037] After obtaining the second terrain data, multiple sub-units of the second terrain data can be determined, and a three-dimensional terrain model can be generated based on these sub-units. The three-dimensional terrain model is generated on a GPU based on the second terrain data. In one implementation, the second terrain data includes the density of elevation points. Determining multiple sub-units of the second terrain data and generating a three-dimensional terrain model based on these sub-units includes: segmenting the second terrain data into a tree-structured fifth terrain data based on the density of elevation points in the second terrain data, wherein the fifth terrain data includes multiple sub-units, and the elevation point density of each sub-unit meets a density condition; generating a triangulated mesh corresponding to each sub-unit; and generating a three-dimensional terrain model based on the triangulated meshes.
[0038] In this embodiment, a multidimensional kd-tree can be constructed from the thinned second terrain data to divide the second terrain data into multiple basic units with evenly distributed elevation points, and a triangular mesh of these units can be constructed. Then, a three-dimensional terrain model can be generated using the triangular mesh. Figure 7 The following is an illustration of the construction process for the fifth terrain data provided in this application embodiment: 1. To segment and merge the second terrain data, the number distribution of horizontal elevation points in the second terrain data can be used as the first dimension for data segmentation, and the number of elevation points in each row can be counted sequentially.
[0039] 2. Obtain the median of the total number of elevation points, and divide the horizontal hyperplane by the median. The lower space contains all elevation points less than the median, and the upper space contains all elevation points greater than or equal to the median.
[0040] 3. Using the distribution of vertical elevation points in the second terrain data as the second dimension of data segmentation, a second vertical segmentation is performed on the results of the first segmentation. The left space contains all elevation points less than the median, and the right space contains all elevation points greater than or equal to the median.
[0041] 4. If the elevation point density of each unit is still too high and does not meet the preset density conditions, repeat steps 1 to 3 to perform quadtree kd-tree partitioning on each unit to obtain a sixteen-tree kd-tree structure.
[0042] By following the steps 1-4 above, we can obtain the fifth terrain data in a kd tree structure. The fifth terrain data includes multiple sub-units, and the elevation point density of each sub-unit meets the density condition.
[0043] After obtaining the fifth terrain data, WebGPU can be used to generate a triangulated mesh for each sub-unit based on the data in each sub-unit of the fifth terrain data. Then, a 3D terrain model is generated based on each triangulated mesh. In this way, a multi-dimensional kd-tree data structure is constructed based on the second terrain data, and the triangulation generation is divided into multiple parallel processing tasks. Each sub-unit of the fifth terrain data is used to generate a triangulated mesh, and then a 3D terrain model is generated based on each triangulated mesh. This reduces the distortion or deformation problems caused by slow terrain generation.
[0044] In one implementation, generating the triangulation network corresponding to each sub-unit includes: generating the bounding box of each sub-unit based on the elevation points of each sub-unit; and triangulating the bounding box of each sub-unit to generate the triangulation network corresponding to each sub-unit.
[0045] In the embodiments of this application, such as Figure 8 As shown, the WebGPU can be used to apply the rotating caliper algorithm to the data of each sub-unit in the fifth terrain data, and at the same time generate the bounding box of each sub-unit. Then, the bounding box of each sub-unit is triangulated to obtain the unit triangulation network corresponding to each sub-unit.
[0046] In one implementation, a three-dimensional terrain model is generated based on each unit triangulation, including: connecting each unit triangulation based on the first vertex of each unit triangulation to generate a terrain triangulation; and stretching the terrain triangulation to a reference plane to generate a three-dimensional terrain model.
[0047] In the embodiments of this application, such as Figure 9 As shown, the first vertex of the bounding box of the cell triangulation of each sub-unit can be traversed sequentially, and adjacent cell triangulations can be connected based on the information of the first vertex. Based on this step, the cell triangulations of each sub-unit under the kd-tree structure are connected, finally generating the following... Figure 10The terrain triangulation shown is an example. After obtaining the terrain triangulation, it can be stretched towards the reference plane to generate a model such as... Figure 11 The three-dimensional terrain model shown.
[0048] In this embodiment, a multi-dimensional kd-tree data structure is constructed for the second terrain data, and the generation of the triangulation network is divided into multiple parallel processing tasks. By triangulating the data of each sub-unit to generate a triangulation network, a large-scale terrain triangulation network is quickly constructed using an interleaved connection method. Then, a three-dimensional terrain model is generated based on the terrain triangulation network. This reduces the distortion or deformation problems caused by the slow generation of the three-dimensional terrain model, and enables the rapid construction of large-scale terrain triangulation networks. It also reduces rendering delays or discontinuous terrain loading caused by slow terrain generation when users quickly browse the terrain model, thus improving the rendering effect.
[0049] In this embodiment of the application, after obtaining the three-dimensional terrain model, the image coordinates of the image data can be matched with the grid vertex coordinates of the three-dimensional terrain model to generate a brightness blending texture for the image data of the mapping range and cover it onto the surface of the three-dimensional terrain model.
[0050] This application embodiment can construct a Level of Detail (LOD) model based on image data overlaid on the surface of a 3D terrain model. Data can be sampled from the surface of the 3D terrain model, and the level of detail of the 3D model can be dynamically adjusted according to the distance between the observed object and the observer or other standards. Different image elements or data can be saved to different layers. For example... Figure 12 As shown, this application stores rendering data of different rendering layers such as color, brightness, and shadow based on the LOD layered rendering method, and combines and splices different rendering layers according to the screen display range to form the final rendering effect, while optimizing rendering performance and maintaining visual fidelity.
[0051] In the embodiments of this application, different level of detail selection algorithms can also be used, such as dynamic detail adjustment algorithm based on frustum culling, or adaptive detail rendering technology based on machine learning to generate a level of detail model.
[0052] In this embodiment of the application, the 3D terrain model can also be locally segmented according to the browsing range of the 3D terrain model to remove redundant terrain parts outside the ROI.
[0053] Step S103: Render the 3D terrain model.
[0054] Specifically, in the embodiments of this application, the high-performance rendering capabilities of WebGPU and spatial coordinate information in the field of geographic information can be combined to render 3D terrain models with high performance through the WebGPU rendering pipeline.
[0055] Specifically, rendering a 3D terrain model includes: obtaining rendering data of the 3D terrain model from the level-of-detail model; obtaining the second vertex of the target mesh fragment of the 3D terrain model; obtaining the target rendering data corresponding to the target mesh fragment from the rendering data based on the second vertex; and rendering the target mesh fragment based on the target rendering data.
[0056] Figure 13 This illustration shows a schematic diagram of a three-dimensional terrain model rendering provided in an embodiment of this application, such as... Figure 13 As shown, the second vertex of the target mesh fragment of the 3D terrain model can be obtained by controlling the rendering pipeline through WebGPU. Then, based on the second vertex, the target rendering data corresponding to the target mesh fragment can be obtained from the level of detail model. The target mesh fragment can be rendered according to the target rendering data by controlling the rendering pipeline through WebGPU.
[0057] In one implementation, the target rendering data includes color rendering data and brightness rendering data. Rendering a target mesh fragment based on the target rendering data includes: rendering the color of the target mesh fragment based on the color rendering data; and rendering the brightness of the target mesh fragment based on the brightness rendering data.
[0058] Specifically, the target rendering data includes color rendering data and brightness rendering data. Therefore, the WebGPU control rendering pipeline can be used to obtain the rendering data of the target mesh fragment based on the second vertex, calculate the color of the target mesh fragment, and then render the color of the target mesh fragment. Similarly, the WebGPU control rendering pipeline can also be used to obtain the rendering data of the target mesh fragment based on the second vertex, calculate the brightness of the target mesh fragment, and then render the brightness of the target mesh fragment.
[0059] The WebGPU can render and display the entire 3D terrain model within the viewport on the screen. In this embodiment, the rendered 3D terrain model can be cached in the cache area of the network graphics processor.
[0060] To optimize rendering performance, this application employs an off-screen rendering cache method. This involves allocating an additional cache area on the GPU that is not directly displayed on the screen. This cache temporarily stores terrain data that has been viewed during the rendering process, as well as terrain data of the surrounding area (e.g., secondary terrain data). It can also cache the rendered 3D terrain model. When the user revisits the same area or swipes to browse the surrounding area, the cached data can be reused or further processed, or the rendered 3D terrain model can be used directly. This addresses the issue that rendering directly on the current screen buffer may not achieve the expected visual effects or performance requirements when the computer is handling complex graphics effects and rendering tasks.
[0061] In this embodiment of the application, WebGPU can also be used to render mountains, vegetation, water bodies, etc. of the three-dimensional terrain model in real time, and dynamically calculate the direct light source, ambient light and indirect lighting received by objects in the scene to simulate real-time lighting effects.
[0062] This application provides a method for rendering 3D terrain models. Compared to traditional UE and Cesium graphics APIs, this method considers the characteristics of the WebGPU graphics protocol in modern graphics processing, which can fully utilize the underlying hardware performance. It introduces geospatial coordinate information and combines it with 3D terrain rendering to achieve more efficient processing and rendering of massive 3D terrain models. This greatly reduces the dependence of 3D terrain module rendering on server computing power, provides strong support for real-time processing and rendering of large-scale terrain data, and improves the rendering effect of 3D terrain models.
[0063] Figure 14 This paper illustrates a schematic diagram of the overall process of rendering a three-dimensional terrain model provided in an embodiment of this application, as shown below. Figure 14 As shown, the overall workflow for rendering a 3D terrain model includes a spatial data storage server, spatial data processing, 3D terrain model construction, 3D terrain model texturing, level-of-detail model construction, 3D terrain model clipping, and WebGPU 3D terrain model rendering. The spatial data storage server includes various types of spatial data resources such as terrain data and image data; spatial data processing performs corresponding data operations based on the data type.
[0064] To improve the rendering performance of massive 3D terrain data, this application designs a spatial data processing method that includes cross-polyline thinning and merging / segmentation algorithms for DEM data. Compared to traditional UE and Cesium graphics APIs, the high-performance massive 3D terrain model rendering technology framework in this application, considering the characteristics of the WebGPU graphics protocol in modern graphics processing that can fully utilize the underlying hardware performance, introduces geospatial coordinate information and combines it with 3D terrain model rendering to achieve more efficient processing and rendering of massive 3D terrain models, greatly reducing the dependence of 3D terrain model rendering on server-side computing power. Based on the efficient parallel computing capabilities of WebGPU, this application thins the first terrain data in both vertical and horizontal dimensions by obtaining the distance from data points to the lines connecting the first and last endpoints. This effectively preserves DEM data with significant terrain features, reduces memory alarms caused by full loading of massive terrain data partitions, and improves terrain rendering performance. This application is based on a merging / segmentation triangulation construction method. This invention constructs a fifth terrain data with a multi-dimensional kd-tree data structure from the second terrain data, dividing the triangulation generation into multiple parallel processing tasks. By triangulating the data of each sub-unit to generate a triangular network, a large-scale terrain triangular network can be quickly constructed by interleaving and connecting lines, reducing the distortion or deformation problems caused by slow terrain generation.
[0065] It should be noted that the rendering method for the three-dimensional terrain model provided in this application embodiment can be executed by a three-dimensional terrain rendering device, or a control module within the three-dimensional terrain rendering device for executing the rendering method for the three-dimensional terrain model. This application embodiment uses the execution of the three-dimensional terrain rendering method by a three-dimensional terrain rendering device as an example to illustrate the three-dimensional terrain rendering device provided in this application embodiment.
[0066] Figure 15 This is a schematic diagram of the structure of a three-dimensional terrain rendering apparatus according to an embodiment of this application. Figure 15 As shown, the three-dimensional terrain rendering device 1500 includes: a thinning module 1510, a generation module 1520, and a rendering module 1530.
[0067] The thinning module 1510 is used to perform horizontal and vertical thinning on the first terrain data to obtain the second terrain data; the generation module 1520 is used to determine multiple sub-units of the second terrain data and generate a three-dimensional terrain model based on the multiple sub-units; the rendering module 1530 is used to render the three-dimensional terrain model.
[0068] In one implementation, the thinning module 1510 is used to calculate a first distance between each elevation point in the target row of the first terrain data and the elevation points at the beginning and end of the target row; calculate a second distance between each elevation point in the target column of the first terrain data and the elevation points at the beginning and end of the target column; and perform horizontal thinning and vertical thinning on the first terrain data in parallel based on the first distance and the second distance to obtain the second terrain data.
[0069] In one implementation, the thinning module 1510 is used to remove elevation points in the target row of the first terrain data whose first distance is less than a distance threshold to obtain third terrain data; remove elevation points in the target column of the first terrain data whose second distance is less than the distance threshold to obtain fourth terrain data; and generate second terrain data based on the third terrain data and the fourth terrain data.
[0070] In one implementation, the second terrain data includes the density of elevation points. The generation module 1520 is used to segment the second terrain data into a tree-structured fifth terrain data according to the density of elevation points in the second terrain data. The fifth terrain data includes the plurality of sub-units, and the density of elevation points in each sub-unit meets a density condition. A triangulation network corresponding to each sub-unit is generated. The three-dimensional terrain model is generated based on each triangulation network.
[0071] In one implementation, the generation module 1520 is used to generate the bounding box of each sub-unit based on the elevation point of each sub-unit; and to triangulate the bounding box of each sub-unit to generate the unit triangulation network corresponding to each sub-unit.
[0072] In one implementation, the generation module 1520 is used to connect each of the unit triangulations according to the first vertex of each of the unit triangulations to generate a terrain triangulation; and to stretch the terrain triangulation to a reference plane to generate the three-dimensional terrain model.
[0073] In one implementation, the rendering module 1530 is configured to: obtain rendering data of the three-dimensional terrain model from the level of detail model; obtain the second vertex of the target mesh fragment of the three-dimensional terrain model; obtain target rendering data corresponding to the target mesh fragment from the rendering data based on the second vertex; and render the target mesh fragment based on the target rendering data.
[0074] In one implementation, the target rendering data includes color rendering data and brightness rendering data. The rendering module 1530 is used to render the color of the target mesh segment according to the color rendering data and to render the brightness of the target mesh segment according to the brightness rendering data.
[0075] In one implementation, the rendering module 1530 is further configured to cache the second terrain data and the rendered three-dimensional terrain model in a cache area.
[0076] The rendering device for the 3D model in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0077] The rendering device for the 3D model in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit the specific operating system used.
[0078] The rendering device for the three-dimensional model provided in this application embodiment can achieve... Figures 1 to 14 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0079] like Figure 16 As shown in the figure, this application embodiment also provides an electronic device 1600, including a processor 1601 and a memory 1602. The memory 1602 stores a program or instructions that can run on the processor 1601. When the program or instructions are executed by the processor 1601, they perform the following: horizontally thinning and vertically thinning of first terrain data to obtain second terrain data; determining multiple sub-units of the second terrain data; generating a three-dimensional terrain model based on the multiple sub-units; and rendering the three-dimensional terrain model.
[0080] In one implementation, a first distance is calculated between each elevation point in the target row of the first terrain data and the elevation points at the beginning and end of the target row; a second distance is calculated between each elevation point in the target column of the first terrain data and the elevation points at the beginning and end of the target column; and the first terrain data is subjected to horizontal thinning and vertical thinning in parallel based on the first distance and the second distance to obtain the second terrain data.
[0081] In one implementation, elevation points in the target row of the first terrain data whose first distance is less than a distance threshold are removed to obtain third terrain data; elevation points in the target column of the first terrain data whose second distance is less than the distance threshold are removed to obtain fourth terrain data; and second terrain data is generated based on the third terrain data and the fourth terrain data.
[0082] In one implementation, the second terrain data includes the density of elevation points. Based on the density of elevation points in the second terrain data, the second terrain data is segmented into a tree-structured fifth terrain data, wherein the fifth terrain data includes the plurality of sub-units, and the density of elevation points in each sub-unit meets a density condition; a triangulation network corresponding to each sub-unit is generated; and the three-dimensional terrain model is generated based on each triangulation network.
[0083] In one implementation, a bounding box for each sub-unit is generated based on the elevation point of each sub-unit; the bounding box of each sub-unit is triangulated to generate the unit triangulation network corresponding to each sub-unit.
[0084] In one implementation, each of the unit triangulations is connected based on its first vertex to generate a terrain triangulation; the terrain triangulation is then stretched toward a reference plane to generate the three-dimensional terrain model.
[0085] In one implementation, rendering data of the 3D terrain model is obtained from the level-of-detail model; a second vertex of a target mesh fragment of the 3D terrain model is obtained; target rendering data corresponding to the target mesh fragment is obtained from the rendering data based on the second vertex; and the target mesh fragment is rendered based on the target rendering data.
[0086] In one implementation, the target rendering data includes color rendering data and brightness rendering data. The color of the target mesh segment is rendered according to the color rendering data, and the brightness of the target mesh segment is rendered according to the brightness rendering data.
[0087] In one implementation, after rendering the 3D terrain model, the second terrain data and the rendered 3D terrain model are cached in a cache area.
[0088] The specific execution steps can be found in the various steps of the above-described three-dimensional terrain model rendering method embodiment, and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0089] It should be noted that the electronic devices in the embodiments of this application include: servers, terminals, or other devices besides terminals.
[0090] The above electronic device structure does not constitute a limitation on the electronic device. An electronic device may include more or fewer components than illustrated, or combine certain components, or arrange them differently. For example, an input unit may include a network graphics processing unit (GPU) and a microphone, and a display unit may use a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar display panels. User input units include at least one of a touch panel and other input devices. A touch panel is also called a touchscreen. Other input devices may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be elaborated further here.
[0091] Memory can be used to store software programs and various data. Memory can primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area can store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, memory can include volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (Synchlink DRAM, SLDRAM), and direct memory bus RAM (DRRAM).
[0092] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly handles operations related to the operating system, user interface, and applications, while the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor.
[0093] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described three-dimensional terrain model rendering method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0094] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as ROM, RAM, magnetic disk, or optical disk.
[0095] This application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, which, when executed by a computer, cause the computer to perform various processes of the above-described embodiments of the rendering method for the three-dimensional terrain model, and achieve the same technical effect. To avoid repetition, these will not be described again here.
[0096] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0097] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0098] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method of rendering a three-dimensional terrain model, characterized by, The method comprises the following steps: transversely and longitudinally thinning the first terrain data to obtain second terrain data; determining a plurality of sub-units of the second terrain data, and generating a three-dimensional terrain model according to the plurality of sub-units; rendering the three-dimensional terrain model.
2. The method of claim 1, wherein, The transversely and longitudinally thinning the first terrain data to obtain second terrain data comprises the following steps: calculating a first distance between each elevation point in a target row of the first terrain data and the elevation points at the beginning and end positions of the target row; calculating a second distance between each elevation point in a target column of the first terrain data and the elevation points at the beginning and end positions of the target column; transversely and longitudinally thinning the first terrain data according to the first distance and the second distance in parallel to obtain the second terrain data.
3. The method of claim 2, wherein, The transversely and longitudinally thinning the first terrain data according to the first distance and the second distance in parallel to obtain the second terrain data comprises the following steps: eliminating the elevation points in the target row of the first terrain data whose first distance is less than a distance threshold to obtain third terrain data; eliminating the elevation points in the target column of the first terrain data whose second distance is less than the distance threshold to obtain fourth terrain data; generating the second terrain data according to the third terrain data and the fourth terrain data.
4. The method of claim 1, wherein, The second terrain data comprises the density of elevation points, and the determining a plurality of sub-units of the second terrain data and generating a three-dimensional terrain model according to the plurality of sub-units comprises the following steps: dividing the second terrain data into fifth terrain data in a tree structure according to the density of the elevation points of the second terrain data, wherein the fifth terrain data comprises the plurality of sub-units, and the density of the elevation points of each sub-unit meets a density condition; generating a unit triangular mesh corresponding to each sub-unit; generating the three-dimensional terrain model according to the unit triangular meshes.
5. The method of claim 4, wherein, The generating a unit triangular mesh corresponding to each sub-unit comprises the following steps: generating an outer bounding box of each sub-unit according to the elevation points of each sub-unit; triangulating the outer bounding box of each sub-unit to generate the unit triangular mesh corresponding to each sub-unit.
6. The method of claim 4, wherein, The generating the three-dimensional terrain model according to the unit triangular meshes comprises the following steps: connecting the unit triangular meshes according to the first vertices of the unit triangular meshes to generate a terrain triangular mesh; stretching the terrain triangular mesh to a reference surface to generate the three-dimensional terrain model.
7. The method of claim 1, wherein, The rendering the three-dimensional terrain model comprises the following steps: obtaining rendering data of the three-dimensional terrain model from a level of detail model; obtaining second vertices of a target mesh segment of the three-dimensional terrain model; obtaining target rendering data corresponding to the target mesh segment from the rendering data according to the second vertices; rendering the target mesh segment according to the target rendering data.
8. The method of claim 7, wherein, The target rendering data comprises color rendering data and brightness rendering data, and the rendering the target mesh segment according to the target rendering data comprises the following steps: rendering the color of the target mesh segment according to the color rendering data; rendering the brightness of the target mesh segment according to the brightness rendering data.
9. The method of claim 1, wherein, after the rendering of the three-dimensional terrain model, further comprising: caching the second terrain data and the rendered three-dimensional terrain model to a cache.
10. An electronic device, comprising: a processor, a memory, and a program or instructions stored on the memory and executable on the processor, the program or instructions, when executed by the processor, implement the steps of the method for rendering a three-dimensional terrain model according to any one of claims 1-9.
11. A readable storage medium, characterized by, a program or instructions stored on the readable storage medium, the program or instructions, when executed by a processor, implement the steps of the method for rendering a three-dimensional terrain model according to any one of claims 1-9.
12. A computer program product, characterised in that, the computer program product comprises a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform the steps of the method for rendering a three-dimensional terrain model according to any one of claims 1-9.