A method for constructing a three-dimensional terrain of a region
Patent Information
- Application Number
- CN202611052607.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-15
- Publication Date
- 2026-10-13
AI Technical Summary
一种是通过随机噪声算法生成模拟地形数据,这种方式虽然实现简单、运行速度快,但只能生成无实际地理意义的虚拟地形,无法还原真实区域的地形起伏特征与细节信息,难以满足地理勘探、应急指挥等对地形真实性要求较高的应用场景;另一种是直接导入真实数字高程模型数据,但缺乏针对这类数据的专业化预处理与适配流程,数据解析过程中易出现格式错误与数值偏差,渲染时易产生地形拉伸、边缘失真、细节丢失等问题,且在加载大规模地形数据时,未对加载策略与渲染逻辑进行针对性优化,容易导致页面卡顿、帧率下降,无法兼顾渲染精度与运行流畅度
通过获取真实数字高程模型地形数据并进行专业化预处理,将其转换为三维渲染引擎可识别的高程纹理数据,建立纹理像素与实际高程的对应关系,再利用图形处理器的并行计算能力对平面几何体顶点进行高程偏移计算,能够准确还原真实地形的起伏特征与细节信息;同时通过分块加载与增量渲染机制优化数据加载与渲染流程,在保证地形渲染精度的前提下,降低资源占用,使大规模地形数据也能够在Web端稳定运行。
Smart Images

Figure CN122906280A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Web 3D geographic information technology, specifically a method for constructing regional geographic 3D terrain. Background Technology
[0002] With the rapid development of computer graphics and web front-end technologies, 3D terrain scenes are widely used in fields such as digital twins, geographic information systems, emergency command, and science popularization. Lightweight 3D graphics libraries based on WebGL have become the mainstream technology choice for web-based 3D terrain construction due to their advantages such as not relying on complex plugins, being able to run directly in the browser, and having low development costs. These technologies typically construct terrain geometry through procedural generation or heightmap parsing, and combine materials and lighting systems to achieve visualization, significantly reducing the development threshold for web-based 3D terrain.
[0003] In the process of terrain data processing and rendering, existing technologies mainly adopt two implementation paths: One approach is to generate simulated terrain data using random noise algorithms. While this method is simple to implement and fast, it can only generate virtual terrain without any real geographical significance. It cannot reproduce the terrain undulations and details of real areas, making it difficult to meet the needs of applications such as geographical exploration and emergency command, which require high terrain realism. Another approach is to directly import real digital elevation model data. However, this method lacks specialized preprocessing and adaptation processes for this type of data. Formatting errors and numerical deviations are prone to occur during data parsing, and problems such as terrain stretching, edge distortion, and loss of details are likely to occur during rendering. Furthermore, when loading large-scale terrain data, the loading strategy and rendering logic are not specifically optimized, which can easily lead to page lag and frame rate drops, making it impossible to balance rendering accuracy and smooth operation.
[0004] Secondly, the core functions of the 3D terrain scene are directly written based on the native API of the graphics library without modular encapsulation and unified management. For example, functions such as camera view control, entity drawing, and interactive editing are implemented by independent code snippets, resulting in poor code reusability and logical conflicts between different functional modules. Subsequent maintenance and function expansion require modification of multiple core code sections, which does not meet the requirements of engineering development standards and is difficult to integrate quickly and stably with other business systems. Therefore, we provide a method for constructing regional geographic 3D terrain. Summary of the Invention
[0005] To achieve the above objectives, the present invention provides the following technical solution: A method for constructing three-dimensional terrain in regional geography, comprising the following steps: Acquire real digital elevation model terrain data and preprocess the digital elevation model terrain data; The preprocessed terrain elevation data is converted into elevation texture data that can be recognized by the 3D rendering engine. Establish a mapping relationship between texture pixel values and actual elevation values. Based on elevation texture data, generate a 3D terrain model through parallel computing and rendering, and optimize the loading and rendering logic of terrain data. An object-oriented modular architecture is adopted to encapsulate the core functions of the 3D terrain scene into multiple independent functional modules; Define standardized data interaction interfaces between various functional modules, and then manage the 3D terrain scene through the collaborative operation of these modules.
[0006] Furthermore, the steps for rendering and generating a 3D terrain model are as follows: Create a planar geometry that matches the geographic extent of the digital elevation model terrain data, and configure the number of segments of the planar geometry to match the resolution of the digital elevation model terrain data; The elevation texture data is fed into the preset vertex shader program, and the elevation offset of each vertex of the planar geometry is calculated to generate a three-dimensional terrain surface.
[0007] Furthermore, the specific steps for optimizing the terrain data loading and rendering logic are as follows: A block loading mechanism is used to load the terrain data of the digital elevation model; An incremental rendering mechanism is used to render 3D terrain.
[0008] Furthermore, the functional module includes a camera manager, wherein the camera manager encapsulates multiple switchable camera modes; Through its built-in view control logic, it performs view translation, rotation, scaling and reset operations, and inputs view parameters.
[0009] Furthermore, the functional module also includes a data manager, which uses a unified data format to store the geographic coordinates, attribute information, and style parameters of terrain-related entities. The terrain-related entities include three categories: points, lines, and polygons. The data manager provides standardized CRUD interfaces. Through the standardized interface, operations such as adding, deleting, modifying, and querying terrain-related entities are performed respectively.
[0010] Furthermore, the functional module also includes a drawing manager, which uniformly encapsulates the drawing logic of three types of entities: points, lines, and surfaces, establishes a unified drawing entry point, configures the style parameters of entities, and updates the style parameters in real time. An incremental rendering mechanism is used to redraw the modified terrain-related entities.
[0011] Furthermore, the functional module also includes an editing manager, which is bound to desktop interaction events and adapted to mobile interaction events; The terrain-related entities to be edited are identified using ray detection.
[0012] Furthermore, the functional module also includes a pop-up manager, which encapsulates a floating information box component based on CSS rendering technology; Establish a mapping relationship between terrain-related entity identifiers and information box content. When a click event is detected on a terrain key point or terrain-related entity, the target object is located using ray detection technology, and the information box position and the screen coordinates of the terrain key point or terrain-related entity are updated synchronously.
[0013] Furthermore, the functional module also includes an effects manager, which uniformly encapsulates the rendering logic of various natural weather effects; Establish a standardized special effects control interface and generate particles based on a particle system to simulate natural weather phenomena; The motion parameters of the particles are controlled by the vertex shader, the particle effect parameters are configured to create a fog effect, and the fog parameters are adjusted. Texture animation of the water surface area is performed based on terrain elevation texture and fragment shader to simulate the undulation and diffusion of water waves, and water wave parameters are adjusted.
[0014] Furthermore, the construction method also includes the following steps: Decouple the internal business logic of each functional module from the external calling interface, and interconnect externally through standardized data interaction interfaces.
[0015] This invention provides a method for constructing three-dimensional terrain in a region, which has the following advantages: By acquiring real digital elevation model terrain data and performing professional preprocessing, it is converted into elevation texture data that can be recognized by a 3D rendering engine. The correspondence between texture pixels and actual elevation is established, and then the parallel computing power of the graphics processor is used to calculate the elevation offset of the vertices of the planar geometry. This can accurately restore the undulation features and details of the real terrain. At the same time, the data loading and rendering process is optimized through block loading and incremental rendering mechanisms. While ensuring the accuracy of terrain rendering, resource consumption is reduced, so that large-scale terrain data can also run stably on the Web.
[0016] Secondly, by adopting an object-oriented modular architecture, the core functions of the 3D terrain scene are encapsulated into independent functional modules, and a unified standardized data interaction interface is defined. The internal business logic of each module is completely isolated from the external calling interface. This not only makes the system code structure clearer, reduces code redundancy and logical conflicts, and lowers the difficulty and cost of subsequent maintenance, but also allows new functions to be implemented simply by extending the internal methods of the corresponding module without modifying the core system code. At the same time, the standardized interface facilitates rapid integration with various external business systems, improving the reusability of the technology and its engineering application value.
[0017] In addition, the camera manager allows for seamless switching between various camera modes and customization of viewpoint parameters to adapt to different usage needs such as global overview and local detail observation. The data manager and drawing manager are used for unified management and drawing of terrain-related entities, and the editing manager allows for real-time cross-terminal editing of entities to meet users' personalized adjustment needs for terrain scenes. For dynamic display and the representation of natural weather, the pop-up manager and special effects manager are used for unified management. Attached Figure Description
[0018] Figure 1 This is a three-dimensional terrain rendering of the region in this invention; Figure 2 This is a rendering of the natural effects of the three-dimensional terrain in the region in this invention; Figure 3 This is a flowchart of the regional three-dimensional terrain construction process in this invention; Figure 4 This is a diagram of the terrain manager architecture in this invention; Figure 5 This is a diagram showing the interaction relationships of the terrain manager in this invention. Detailed Implementation
[0019] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0020] This invention discloses a method for constructing 3D regional geographic terrain, developed using the TypeScript language and relying on the Three.js 3D graphics library to complete the rendering and scene management of 3D terrain. The specific details are as follows: I. Accurate rendering of real DEM terrain data: We acquire realistic Digital Elevation Model (DEM) terrain data in raster format, where each raster cell stores the elevation value of the corresponding geographic coordinate point. This data forms the foundational data source for constructing realistic 3D terrain. We then perform specialized preprocessing on the DEM terrain data. A median filtering algorithm is used to remove isolated noise points caused by sensor errors and data transmission interference. Missing and outlier values are identified and filled using inverse distance weighted interpolation. Simultaneously, the minimum and maximum elevation values are statistically analyzed, mapping the elevation values to a range suitable for GPU rendering, thus eliminating errors and interference in the original data.
[0021] The preprocessed terrain elevation data is converted into floating-point elevation texture data recognizable by Three.js. The floating-point texture uses 32-bit single-precision floating-point storage, which can accurately represent elevation values over a large range. During the conversion process, a one-to-one linear mapping relationship is established between texture pixel values and actual elevation values. The elevation value of each raster unit is used as the R channel value of the corresponding texture pixel. The width and height of the texture are completely consistent with the number of raster rows and columns in the DEM data, ensuring that each texture pixel accurately corresponds to the elevation information of a geographic coordinate point. Based on this elevation texture data, combined with Three.js's planar geometry and vertex shaders, a 3D terrain model consistent with the real terrain is rendered, achieving accurate restoration of terrain details. At the same time, the data loading logic is optimized to balance the needs of loading large-scale DEM data and real-time rendering.
[0022] The specific steps for 3D terrain rendering are as follows: Create a PlaneGeometry that matches the geographic extent of the DEM data. This planar geometry serves as the base mesh structure for generating the 3D terrain. Set the number of geometry segments to match the resolution of the DEM data. The formula for calculating the number of segments is: number of segments = data width / resolution × data height / resolution. A sufficient number of segments can ensure the complete representation of terrain details and avoid terrain smoothing distortion caused by insufficient segments, while also preventing unnecessary performance waste caused by an excessive number of segments.
[0023] Write a GLSL vertex shader program that passes elevation texture data as a uniform variable to the shader. Perform parallel elevation offset calculations on each vertex of the planar geometry on the GPU. The formula for calculating the vertex Y-axis coordinate is: Vertex Y-axis coordinate = Elevation texture pixel value × Elevation scaling factor. The elevation scaling factor is used to adjust the vertical undulation of the terrain and can be configured according to the actual application scenario. With the parallel computing capability of the GPU, the elevation offset operation of tens of thousands of vertices can be processed simultaneously, which greatly improves the rendering efficiency compared to the serial calculation of the CPU. It can generate a 3D terrain surface that is completely consistent with the undulation of the real terrain in real time.
[0024] Simultaneously, the loading and rendering logic of DEM terrain data is optimized. A block loading mechanism is adopted to divide large-scale DEM terrain data into multiple square terrain blocks of equal size. Each terrain block independently stores the corresponding elevation texture data and geometric information. The system dynamically loads visible terrain blocks located within the view frustum according to the current field of view and viewing distance of the camera, while unloading invisible terrain blocks that are outside the viewing distance, which greatly reduces memory usage and GPU rendering pressure. An incremental rendering mechanism is adopted to establish a dirty marking system for terrain and entities. The corresponding area is only redrawn when the terrain data or terrain-related entities are modified, avoiding the full scene redraw operation every frame. Under the domestic GPU with 4G video memory and the Galaxy Kylin V10 operating system, the real-time rendering frame rate of large-scale DEM terrain data can be stably maintained at more than 30 frames per second, which solves the pain point of difficulty in balancing rendering quality and real-time performance in existing technologies.
[0025] II. Encapsulation and Implementation of the Six Core Functional Modules: Based on the TypeScript language, the system encapsulates six core functional modules using the Class class. Each module runs independently and interacts with other data through a standardized JSON data format and function interfaces, enabling systematic management of 3D terrain scenes. Each module implements specific functions based on relevant APIs of Three.js, adopting a design principle of high cohesion and low coupling to completely isolate the internal business logic of the module from the external calling interfaces, avoiding code redundancy and functional conflicts.
[0026] The camera manager encapsulates Three.js's PerspectiveCamera and OrthographicCamera. The PerspectiveCamera simulates human vision and is suitable for immersive scene navigation, while the OrthographicCamera eliminates perspective distortion and is suitable for global terrain overviews and engineering surveys. It enables seamless switching between multiple camera modes, smoothly transitioning camera positions and angles during switching through interpolation algorithms to avoid dizziness caused by sudden changes in perspective. It has built-in view control logic to perform view translation, rotation, scaling, and reset operations. View range, near and far clipping planes, movement speed, and rotation sensitivity parameters can be customized to achieve smooth switching and precise control of the view, adapting to different view observation needs in various scenarios such as global overviews, local detail observation, and path navigation.
[0027] The data manager is responsible for the full lifecycle data management of terrain-related entities, which include three categories: points, lines, and polygons. These are used to mark key terrain points, draw terrain boundaries and roads, and label terrain areas, respectively. The geographic coordinates, attribute information, and style parameters of terrain-related entities are uniformly stored in JSON format. Because JSON format has a clear structure, is easy to parse, and is cross-platform compatible, it facilitates data transmission and storage. Four standardized interfaces—addEntity(), deleteEntity(), updateEntity(), and queryEntity()—are encapsulated and provided to implement the addition, deletion, modification, and query operations of terrain-related entities, respectively, enabling unified management of entity data. Batch import and export of terrain-related entity data are also possible, facilitating data exchange with other systems.
[0028] The drawing manager is based on Three.js's BufferGeometry, LineBasicMaterial, and MeshBasicMaterial APIs, uniformly encapsulating the drawing logic for points, lines, and meshes. BufferGeometry stores vertex data in a GPU buffer, offering higher drawing performance compared to traditional Geometry and making it suitable for drawing large-scale entities. It establishes a single, unified drawing entry point, avoiding the duplication of drawing code within business logic. It provides style configuration objects, allowing customization of entity RGB color, hexadecimal color, point size, line width, transparency, fill style, and stroke style, with all style parameter modifications taking effect in real time. It employs Three.js's incremental rendering mechanism, re-rendering only modified terrain-related entities instead of redrawing the entire dataset, ensuring real-time performance when drawing large-scale entities.
[0029] The editing manager binds to three types of desktop interaction events: mouse click, mouse drag, and mouse double-click, while also adapting to three types of mobile interaction events: touchstart, touchmove, and touchend, enabling multi-terminal operation. It utilizes Three.js's Raycaster raycasting technology to accurately identify terrain-related entities to be edited. Raycasting emits a ray from the camera position towards the screen coordinates of the mouse click, detecting the intersection of the ray with entities in the scene; the first intersecting entity is the selected target. During entity dragging, a mapping algorithm between screen coordinates and terrain surface geographic coordinates converts the 2D screen coordinates into 3D terrain surface geographic coordinates. First, the screen coordinates are converted to clipping space coordinates, then the ray direction in world space is obtained through the inverse transformation of the camera's projection matrix and view matrix. Finally, the intersection of the ray and the terrain surface is calculated, which is the target position of the entity. This enables precise movement of terrain-related entities along the terrain surface, with real-time updates to the entity's geographic coordinate information during movement.
[0030] The pop-up manager is responsible for displaying and managing information boxes in the terrain scene. Based on the CSS2DRenderer and CSS3DRenderer renderers of Three.js, it encapsulates a standardized floating information box component. CSS2DRenderer renders HTML elements as two-dimensional plane elements, always facing the camera and its size is not affected by distance, making it suitable for most information display scenarios. CSS3DRenderer renders HTML elements as plane elements in three-dimensional space, which will produce perspective distortion as the camera's viewpoint changes, making it suitable for information display that needs to be deeply integrated with the three-dimensional scene. It establishes a one-to-one mapping relationship between terrain-related entity IDs and information box content. Information box content can be in various formats such as plain text, images, and tables. When the user clicks on terrain key points or terrain-related entities, the target object is located through Raycaster ray detection technology, automatically triggering the display of the information box. The position of the information box is updated in real time synchronously with the screen coordinates of the terrain key points or terrain-related entities. At the same time, the style and display duration of the information box can be customized.
[0031] The effects manager encapsulates the rendering logic for four common natural weather effects: rain, snow, fog, and water ripples. It provides three standardized control interfaces: effect loading, effect switching, and effect disabling. It allows for the overlay display of multiple natural weather effects, enhancing the immersiveness and visualization of 3D terrain scenes. The rain and snow effects utilize Three.js's Points particle system to generate a massive number of particles to simulate raindrops or snowflakes. Each particle has an independent position, velocity, and lifespan. The falling speed, direction, and lifespan of the particles are controlled through GLSL vertex shaders, and the number of particles, falling speed, area of effect, and particle color can be customized. It achieves rain and snow effects of varying intensities; the fog effect encapsulates the Fog and FogExp2 fog effects from Three.js. Fog is linear fog, with concentration increasing linearly with distance, suitable for simulating fog over long distances. FogExp2 is exponential fog, with concentration increasing exponentially with distance, suitable for simulating dense fog. The color and concentration of the fog can be customized; the water wave effect is based on terrain elevation textures and uses the GLSL fragment shader to implement texture animation of the water surface area. First, the water surface area in the terrain is identified based on the elevation value. Then, the undulation and diffusion of water waves are simulated in the fragment shader using a sine function. The frequency, amplitude, and propagation speed of the water waves can be customized.
[0032] The six core functional modules work together seamlessly. Modifications and expansions to one module will not affect the normal operation of the other. When new system functions are needed, only the class methods of the corresponding functional module need to be extended, without modifying the core system code. The standardized module interfaces can be seamlessly integrated with various external systems such as Geographic Information Systems (GIS), data acquisition systems, and digital twin platforms. Geographic and business data from external systems can be directly imported, and topographic and entity data from this system can be exported to external systems, achieving data sharing and functional linkage, thus improving the reusability and engineering application value of the technology.
[0033] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.
[0034] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0035] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for constructing three-dimensional terrain in regional geography, characterized in that, The construction method involves the following steps: Acquire real digital elevation model terrain data and preprocess the digital elevation model terrain data; The preprocessed terrain elevation data is converted into elevation texture data that can be recognized by the 3D rendering engine. Establish a mapping relationship between texture pixel values and actual elevation values. Based on elevation texture data, generate a 3D terrain model through parallel computing and rendering, and optimize the loading and rendering logic of terrain data. An object-oriented modular architecture is adopted to encapsulate the core functions of the 3D terrain scene into multiple independent functional modules; Define standardized data interaction interfaces between various functional modules, and then manage the 3D terrain scene through the collaborative operation of these modules.
2. The method for constructing three-dimensional regional geographic terrain according to claim 1, characterized in that, The steps for rendering and generating a 3D terrain model are as follows: Create a planar geometry that matches the geographic extent of the digital elevation model terrain data, and configure the number of segments of the planar geometry to match the resolution of the digital elevation model terrain data; The elevation texture data is fed into the preset vertex shader program, and the elevation offset of each vertex of the planar geometry is calculated to generate a three-dimensional terrain surface.
3. The method for constructing three-dimensional regional geographic terrain according to claim 1, characterized in that, The specific steps for optimizing the terrain data loading and rendering logic are as follows: A block loading mechanism is used to load the terrain data of the digital elevation model; An incremental rendering mechanism is used to render 3D terrain.
4. The method for constructing three-dimensional regional geographic terrain according to claim 1, characterized in that, The functional module includes a camera manager, which encapsulates multiple switchable camera modes; Through its built-in view control logic, it performs view translation, rotation, scaling and reset operations, and inputs view parameters.
5. The method for constructing three-dimensional regional geographic terrain according to claim 4, characterized in that, The functional module also includes a data manager, which uses a unified data format to store the geographic coordinates, attribute information, and style parameters of terrain-related entities. The terrain-related entities include three categories: points, lines, and polygons. The data manager provides standardized CRUD interfaces. Through the standardized interface, operations such as adding, deleting, modifying, and querying terrain-related entities are performed respectively.
6. The method for constructing three-dimensional regional geographic terrain according to claim 5, characterized in that, The functional module also includes a drawing manager, which uniformly encapsulates the drawing logic of three types of entities: points, lines, and surfaces, establishes a unified drawing entry point, configures the style parameters of entities, and updates the style parameters in real time. An incremental rendering mechanism is used to redraw the modified terrain-related entities.
7. The method for constructing three-dimensional regional geographic terrain according to claim 6, characterized in that, The functional module also includes an editing manager, which is bound to desktop interaction events and adapted to mobile interaction events; The terrain-related entities to be edited are identified using ray detection.
8. The method for constructing three-dimensional regional geographic terrain according to claim 1, characterized in that, The functional module also includes a pop-up manager, which encapsulates a floating information box component based on CSS rendering technology; Establish a mapping relationship between terrain-related entity identifiers and information box content. When a click event is detected on a terrain key point or terrain-related entity, the target object is located using ray detection technology, and the information box position and the screen coordinates of the terrain key point or terrain-related entity are updated synchronously.
9. A method for constructing three-dimensional regional geographic terrain according to claim 8, characterized in that, The functional module also includes an effects manager, which uniformly encapsulates the rendering logic of various natural weather effects; Establish a standardized special effects control interface and generate particles based on a particle system to simulate natural weather phenomena; The motion parameters of the particles are controlled by the vertex shader, the particle effect parameters are configured to create a fog effect, and the fog parameters are adjusted. Texture animation of the water surface area is performed based on terrain elevation texture and fragment shader to simulate the undulation and diffusion of water waves, and water wave parameters are adjusted.
10. A method for constructing three-dimensional regional geographic terrain according to claim 9, characterized in that, The construction method also includes the following steps: Decouple the internal business logic of each functional module from the external calling interface, and interconnect externally through standardized data interaction interfaces.