High-fidelity geospatial hybrid rendering method and device, equipment and medium
By combining GIS and Unreal Rendering Engine, adopting LOD and data streaming mechanisms, and combining the situational mapping processing of ray collision detection, the problem of high realistic, dynamic generation and efficient expression of large-scale geospatial data in digital twin simulation environments is solved. Efficient rendering performance and resource savings are achieved.
Patent Information
- Application Number
- CN202410929786.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-12
AI Technical Summary
When processing large-scale geospatial solid model data, it is difficult to achieve high realistic, dynamic free generation and efficient expression, especially when large-scale data processing is insufficient loading optimization, which cannot meet the needs of the digital twin simulation environment.
Using a fusion method based on GIS engine and Unreal rendering engine, combined with LOD dynamic scheduling technology and data streaming mechanism, terrain slices are dynamically selected and rendered, and the situation free drawing process of ray collision detection is achieved to achieve high realistic geospatial environment. Visualization.
It realizes high realistic, dynamic generation and efficient expression of large-scale geospatial data, improves visual analysis capabilities in digital twin simulation environments, saves resources and improves rendering performance.
Smart Images

Figure CN118941725A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of geospatial information technology, and in particular to a highly realistic geospatial hybrid rendering method, device, equipment and medium. Background Art
[0002] With the accelerated development of the integration of new-generation information technology and industry, digital twin technology has gradually become a key means to achieve a high degree of integration between the physical world and the virtual world. Digital twin technology captures the data of physical entities through sensors and other intelligent devices, and uses advanced artificial intelligence technology to integrate these data into virtual digital models, thereby simulating, optimizing and controlling physical systems.
[0003] In the implementation of digital twin technology, the construction of the simulation environment is a crucial link. The simulation environment not only needs to accurately simulate the physical characteristics and behaviors of the real world, but also needs to provide efficient and realistic visualization effects so that users can intuitively understand and analyze the virtual model.
[0004] In order to achieve this goal, the three-dimensional space environment visualization technology means in the relevant technology are mainly a single rendering engine or a fusion of similar rendering engines, such as using Cesium.js alone or using Cesium.js and Three.js to enhance the external expression ability of three-dimensional GIS, which can better display geographic spatial data. This kind of GIS engine is stable in the expression of three-dimensional data, but it is slightly lacking in realism. The game engine, with its powerful rendering capabilities, brings users better visualization visual effects. However, the introduced game engine has the problem of insufficient loading optimization when processing massive data, and it is difficult to meet the needs of high realism, dynamic free generation, and efficient expression of large-scale geographic spatial entity model data. Summary of the invention
[0005] The present invention provides a highly realistic geospatial hybrid rendering method, device, equipment and medium, which solves the problems in related technologies of insufficient fidelity, dynamic free generation and efficient expression of large-scale geospatial entity model data.
[0006] In order to achieve the above objectives, this application adopts the following technical solutions:
[0007] In a first aspect, a highly realistic geospatial hybrid rendering method is provided, comprising:
[0008] Based on the GIS engine, terrain data is processed in real time, and the geospatial environment model grid is dynamically constructed in real time by integrating the GIS rendering engine and the Unreal rendering engine;
[0009] Based on LOD dynamic scheduling technology, the terrain slices required for loading and rendering are dynamically selected according to the observer's position and distance. Low-resolution slices are used in distant areas, and high-resolution slices are used in close areas.
[0010] Based on the data streaming mechanism, data is dynamically scheduled and terrain data is rendered in real time according to the demand for display content in the current observer's view area;
[0011] For the dynamic environment situation information of geographic space, the situation free plotting method based on ray collision detection is used to plot the dynamic situation information, including:
[0012] Draw spline virtual planes and fold surface virtual planes based on mouse interaction;
[0013] According to the 2D coordinate range of the virtual plane, 2D line markers are drawn, and the two-dimensional graphics are dynamically converted and constructed into graphic elements in the three-dimensional space.
[0014] In a first possible implementation manner of the first aspect, the dynamic gridding construction includes:
[0015] Based on the terrain data, analyzing geometric characteristics and structural information, including identification of terrain boundaries, measurement of side lengths, calculation of normals, and analysis of angles and curvatures;
[0016] Recursively calculating the loss metric of each edge according to the length, normal direction, angle, and curvature of the edge of the terrain data;
[0017] Select the edge with the smallest loss metric as the collapse candidate;
[0018] Perform a collapse operation based on the collapse candidate to obtain an irregular triangular grid body;
[0019] For different areas, the grid density is dynamically adjusted according to visual needs;
[0020] After each collapse operation, the loss metrics of the surrounding edges are recalculated, and the step of selecting the edge with the minimum loss metric as the collapse candidate is iterated.
[0021] Based on the first possible implementation of the first aspect, in a second possible implementation of the first aspect, drawing a spline surface virtual plane based on mouse interaction includes:
[0022] Define the predetermined vertical distance from the terrain surface to the line mark height, i.e. the plotting height h;
[0023] Capture mouse click events, determine the mouse click position P and the normal N of the click position through collision detection, and obtain the actual positioning point of the plotted line in three-dimensional space through vector calculation;
[0024] When there are at least three positioning points after adding the current positioning point PN, calculate the forward direction and right direction of the previous positioning point PL of the current positioning point PN;
[0025] According to the normal angle between the positioning point PN and the positioning point PL, determine whether the two positioning points are in an approximate plane. If so, the positioning point PL performs an in-plane turn; if not, the positioning point PL performs a vertical turn;
[0026] Extend the data of the positioning point PL to the positioning point PN to obtain a spline curve that conforms to the terrain;
[0027] The spline surface virtual plane is constructed based on the spline curve.
[0028] Based on the first possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, drawing the folding surface virtual plane based on mouse interaction includes:
[0029] Define the predetermined vertical distance from the terrain surface to the line mark height, i.e. the plotting height h;
[0030] Capture mouse click events, determine the mouse click position T and the normal line N of the click position through collision detection, and obtain the actual positioning point of the plotted line in three-dimensional space through vector calculation;
[0031] When adding the current positioning point PN, try to connect the current positioning point PN with its previous positioning point PL. The connection methods include step connection and path finding connection.
[0032] The folded surface virtual plane is constructed based on the successfully connected point groups.
[0033] Based on the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the step connection includes:
[0034] A ray is emitted from the anchor point PL to the anchor point PN. If the ray collision detection finds a collision, the current attempt is abandoned, and the intermediate vertex is generated and the ray collision detection is performed:
[0035] The average value of the normal line in the opposite direction from the positioning point PN to the positioning point PL is taken as the downward direction D, n intermediate vertices are evenly divided between the positioning point PL and the positioning point PN, and ray collision detection is performed on each intermediate vertex.
[0036] If the following conditions are met: the difference between the hit distances detected between two adjacent intermediate vertices is less than the set value, the step connection is successful, and the positioning point PL is directly connected to the positioning point PN.
[0037] Based on the third possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, the pathfinding connection includes:
[0038] Step a, based on the projection of the positioning point PL to the positioning point PN in the plane corresponding to the normal line of the positioning point PL, recorded as the forward direction F;
[0039] Step b, defining a height value m=h / 10, where h is the plotting height;
[0040] Step c, emitting rays forward from the positioning point PL after it touches the ground to perform ray collision detection;
[0041] Step d, if the ray collision detection has a collision, the hit point is recorded as A, the point is recorded as TA, and the normal is recorded as NA;
[0042] The projection of the reverse direction -F based on the forward direction in the plane corresponding to the normal line NA is recorded as the return direction R;
[0043] Step e, emitting rays from the hit point A along the return direction R to perform ray collision detection. If the ray collision detection shows a collision, the hit point is recorded as B, the point is recorded as TB, and the normal is recorded as NB;
[0044] Step f, determining whether the normal line NB of the hit point B is similar to the normal line NL of the positioning point PL;
[0045] Step g, if similar, calculate the point C and the normal NC of the two face corners according to the hit point A and the hit point B, obtain the positioning point PC, and update the point C to the positioning point PL; that is, there is a suitable path;
[0046] Step h, if there is no suitable path, emitting rays forward from the locating point PL after burying it in the ground to perform ray collision detection, and repeating steps d to g;
[0047] In step i, if there is still no suitable path, it is recorded as a movement failure and the loop is exited.
[0048] Based on the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner of the first aspect, if the engine does not support ray collision detection by hitting the reverse plane, rays are emitted from the same starting point in opposite directions to perform ray collision detection.
[0049] In a second aspect, a highly realistic geospatial hybrid rendering device is provided, comprising:
[0050] Dynamic gridding construction module, which is used to process terrain data in real time based on GIS engine, and to dynamically build the geospatial environment model grid in real time by integrating GIS rendering engine and Unreal rendering engine;
[0051] Dynamic loading module, which is used to dynamically select the terrain slices required for loading and rendering based on the LOD dynamic scheduling technology according to the observer's position and distance. Low-resolution slices are used for distant areas, and high-resolution slices are used for close areas.
[0052] Dynamic rendering module, used to dynamically schedule data and render terrain data in real time based on the data streaming mechanism and the demand for display content in the current observer's view area;
[0053] The free situation plotting processing module is used for geospatial dynamic environment situation information. It plots dynamic situation information based on the situation free plotting method of ray collision detection, including:
[0054] Draw spline virtual planes and fold surface virtual planes based on mouse interaction;
[0055] According to the 2D coordinate range of the virtual plane, 2D line markers are drawn, and the two-dimensional graphics are dynamically converted and constructed into graphic elements in the three-dimensional space.
[0056] According to a third aspect, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the highly realistic geospatial hybrid rendering method as described in the first aspect are implemented.
[0057] In a fourth aspect, a readable storage medium is provided, wherein the readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the high-fidelity geospatial hybrid rendering method as described in the first aspect are implemented.
[0058] This application aims at the characteristics of different types of 3D graphics rendering engines, integrates different types of 3D graphics rendering engines, forms a hybrid rendering engine, and can freely switch the actual rendering engine according to the actual scene requirements; on the basis of the hybrid rendering engine, through the irregular terrain gridding and dynamic loading display processing based on the geographic space environment and the ground situation mapping processing technology based on ray collision detection, a high-fidelity visualization analysis method for the geographic space environment for digital twins that includes multiple rendering engines is realized, which can meet the requirements of high-fidelity, dynamic generation, and efficient expression of real-world geographic space terrain data information and dynamic situation information in the digital twin simulation environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 A schematic flow chart of a highly realistic geospatial hybrid rendering method provided in an embodiment of the present application;
[0060] Figure 2 A schematic flow chart of a dynamic gridding construction step provided in an embodiment of the present application;
[0061] Figure 3 A schematic flow chart of a dynamic gridding rendering of terrain data provided in an embodiment of the present application;
[0062] Figure 4 A schematic flowchart of drawing a spline virtual plane based on mouse interaction provided in an embodiment of the present application;
[0063] Figure 5 A schematic flowchart of drawing a folded virtual plane based on mouse interaction provided in an embodiment of the present application;
[0064] Figure 6 A schematic diagram of path finding (uphill surface) of a folded virtual plane provided in an embodiment of the present application;
[0065] Figure 7 A schematic diagram of path finding (downhill surface) of a folded virtual plane provided in an embodiment of the present application;
[0066] Figure 8 A spline expansion surface effect diagram provided in an embodiment of the present application;
[0067] Fig. 9 A fold line expansion surface effect diagram provided in an embodiment of the present application;
[0068] Fig.10 A structural block diagram of a highly realistic geospatial hybrid rendering device provided in an embodiment of the present application;
[0069] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose, the technical solutions in the embodiments of the present application are clearly described. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present application.
[0071] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0072] The description of the method flow in the specification of the present application and the steps of the flowchart in the drawings of the present specification do not have to be strictly executed according to the step numbers, and the method steps can be executed in a different order. Moreover, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0073] The following is a detailed description of the highly realistic geospatial hybrid rendering method, device, equipment and medium provided by the embodiments of the present application in conjunction with the accompanying drawings and preferred embodiments.
[0074] First, the application scenarios of the highly realistic geospatial hybrid rendering method and device of the embodiments of the present application are described in detail.
[0075] Creating a virtual world by simulating the spatial environment in the real world mainly includes three steps: first, by collecting and collecting data, processing and processing it to form a data set, some test applications are run on this data set to evaluate functions and performance and give feedback; second, a prototype system is established for the digital twin, which includes a user interface, data warehouse, computing resources and simulation environment; third, the digital twin model is combined with the data to build a digital model of the real world.
[0076] Among them, in the establishment of the digital twin prototype system, the most important thing is to build a simulation environment, which is mainly achieved through various 3D graphics and image visualization technologies. At present, the main 3D engines are OSG, Three.js, Cesium.js, Babylon.js, Scene.js, Unreal Engine, Unity3D, etc., which are used to create and render 3D graphics, and usually provide graphics processing, physical simulation, lighting, collision detection and other functions. According to the purpose, the 3D engine mainly includes game engines and traditional GIS engines, among which the game engine can bring users better visualization visual effects through its powerful rendering capabilities. However, the game engine also has its own defects. For example, the optimization of massive data loading in the game engine is insufficient, and it cannot meet the growing demand for the expression of geographic spatial entity model data.
[0077] In order to solve the practical problems such as the insufficient ability of existing 3D engines in visual analysis and expression of spatial environment, and the inability to meet the high-fidelity and high-efficiency of the world in the digital twin simulation environment, and the high reusability in specific fields, the present invention aims at the digital twin expression needs of entities in the geographic space environment, and proposes a multi-graphics rendering engine that integrates the traditional GIS engine and the game engine to form an efficient and realistic hybrid 3D graphics rendering engine. In addition, the present invention focuses on the ability requirements of high-fidelity, dynamic generation and efficient expression of geographic space terrain data information and dynamic situation information in the digital twin simulation environment, and adopts the technical means of gridding and dynamic loading display processing of irregular terrain in the geographic space environment and ground situation mapping processing based on ray collision detection to realize a high-fidelity visualization analysis device for the geographic space environment oriented to digital twins that includes multiple rendering engines.
[0078] Specifically, in response to the requirements of high fidelity, dynamic generation, and efficient expression of real-world geospatial terrain data information and dynamic situation information in the digital twin simulation environment, the rendering method of the embodiment of the present application is based on a multi-graphics rendering engine integrated with GIS+UE, shielding the differences in graphics interfaces such as WebGL, OpenGL, DirectX12, and Vulkan, forming a hybrid free rendering engine that can freely switch the rendering engine interface called by the scene, adopting a modular layered design, separating the front and back ends, lightweight micro-front-end warning integration framework, cloud rendering WASM and other technologies, and making full use of the capabilities and model assets of the UE Unreal Engine to build an open hybrid free rendering engine platform framework, integrating multi-language and multi-type rendering engines, and being able to freely switch the underlying rendering and return the data stream in different usage scenarios. In the rendering process, mainly for the actual high-fidelity rendering of large quantities of terrain data and dynamic situation information encountered, the hybrid free rendering engine is optimized and improved by adopting irregular terrain gridding and dynamic loading display processing under refined scenes and ground situation mapping processing measures based on ray collision detection.
[0079] In the specific implementation process, the hybrid rendering engine focuses on solving the rendering of large quantities of basic static terrain data in the digital twin simulation environment, as well as the high-fidelity visualization rendering of geographic space environment situation information (dynamic data). The key lies in the gridding of irregular terrain and the dynamic loading display processing. In order to complete the integrated display of dynamic information and complex terrain environment, when drawing the dynamic information of the spatial environment in various terrain environments such as buildings, airports, vegetation, and ups and downs, there will be actions such as occlusion, free climbing, and high-rise strikes on buildings. Collision detection is required to draw dynamic information. This application further performs mapping processing on the dynamic situation information based on the ground situation mapping processing algorithm to solve the problem of the integrated display of dynamic information and basic static information in the spatial environment.
[0080] See also Figure 1 , the embodiment of the present application provides a highly realistic geospatial hybrid rendering method, such as Figure 1 As shown, the rendering method of the embodiment of the present application includes:
[0081] Step S1, based on the GIS engine, the terrain data is processed in real time, and the geospatial environment model grid is dynamically constructed in real time by integrating the GIS rendering engine and the Unreal rendering engine;
[0082] Step S2, based on LOD dynamic scheduling technology, dynamically selects the terrain slices required for loading and rendering according to the observer's position and distance, uses low-resolution slices for distant areas, and uses high-resolution slices for close areas.
[0083] Step S3, based on the data streaming mechanism, dynamically schedule data and render terrain data in real time according to the demand for display content in the current observer's view area.
[0084] Step S4, for the geospatial dynamic environment situation information, the dynamic situation information is plotted in a situation free plotting method based on ray collision detection, including:
[0085] Draw spline virtual planes and fold surface virtual planes based on mouse interaction;
[0086] According to the 2D coordinate range of the virtual plane, 2D line markers are drawn, and the two-dimensional graphics are dynamically converted and constructed into graphic elements in the three-dimensional space.
[0087] In the specific implementation process, the rendering method of the embodiment of the present application is based on the GIS engine, which processes terrain data in real time and performs real-time dynamic grid construction by integrating the UE rendering engine to achieve dynamic loading and display of large quantities of terrain data and high-fidelity restoration.
[0088] Further, see Figure 2, construct the geospatial environment model grid, including:
[0089] Step S11, analyzing geometric characteristics and structural information based on terrain data, including identification of terrain boundaries, side length measurement, normal calculation, angle and curvature analysis;
[0090] Step S12, recursively calculating the loss metric of each edge according to the length, normal direction, angle, and curvature of the terrain data edge;
[0091] Step S13, selecting the edge with the minimum loss metric as the collapse candidate;
[0092] Step S14, performing a collapse operation based on the collapse candidate to obtain an irregular triangular grid body;
[0093] Step S15, dynamically adjusting the grid density for different areas according to visual needs;
[0094] Step S16, after each collapse operation, recalculate the loss metrics of the surrounding edges, and iteratively select the edge with the minimum loss metric as the collapse candidate step.
[0095] Dynamic meshing mainly uses the edge collapse mesh simplification algorithm to maintain good terrain accuracy and effectively utilize computing resources. The main principle of this algorithm is to recursively calculate the loss metric (QEM) of each edge based on the length, normal direction, angle, curvature and other factors of the terrain data edge, and select the edge with the minimum loss for the collapse operation. The edge collapse operation replaces two vertices with a new vertex to obtain an irregular triangular grid; the density of the grid can be adaptively adjusted in different areas as needed. For flat or unimportant areas, the number of triangles is reduced, and the triangle vertices are dense in places with obvious terrain undulations. In the specific implementation process, the density of the angle grid is mainly determined by the accuracy of the DEM terrain data. The DEM terrain data is a kind of rasterized geographic spatial data. The flatness or undulation of the terrain, as well as the density of the grid are mainly determined by the elevation value in the DEM terrain data.
[0096] See also Figure 3 While using GIS+UE multi-rendering engine to render terrain grid in real time, in order to improve data loading and display performance, LOD dynamic scheduling technology is used to dynamically adjust rendering details according to the position and distance of the observer. When loading terrain data, the terrain slices required for loading and rendering are dynamically selected according to the position and distance of the observer. Areas with distant observers can use lower resolution slices, while areas close to the observer use higher resolution slices, which can provide satisfactory terrain details while maintaining performance.
[0097] Furthermore, in order to handle large-scale terrain data sets, data streaming is also supported, and terrain data is loaded and rendered on demand only when needed. It can dynamically schedule data and render terrain data in real time according to the current observer's view area's demand for display content. When loading terrain data, the required terrain slices are dynamically selected for loading and rendering according to the observer's position and distance. Areas with distant observers can use lower resolution slices, while areas close to the observer use higher resolution slices. In addition to supporting the loading of local terrain data, this scheduling method also supports terrain data services published in the form of network services. Specifically:
[0098] The terrain gridding dynamic scheduling of the present application uses "grid" as the basic unit of terrain display. When it is necessary to display the terrain data of a given space, the drawing main control thread decomposes the corresponding display task into several drawing subtasks that can be executed in parallel through the predetermined global subdivision grid, and assigns them to the drawing worker threads. Each drawing worker thread performs terrain element scheduling, preprocessing, symbolic rendering and other preprocessing in units of terrain grids. Finally, the drawing main control thread asynchronously outputs the results drawn by each drawing worker thread to the client for display. A multi-level buffer processing mechanism is implemented during the LOD scheduling process to increase the loading speed of large batches of terrain data, and can process terrain data up to PB level. Therefore, it can provide faster loading speed and allow the processing of large-scale terrain data sets.
[0099] Based on this, compared with the independent use mode of traditional GIS engine or UE rendering engine, first, this method can save the storage space of terrain data slices. After testing, the terrain vertex data within the same geographical range and the same resolution is reduced by an average of about 30%; second, this method can save computing costs, especially greatly save the cost of image texture mapping; third, this method can improve the efficiency of elevation-based terrain analysis; fourth, it can achieve efficient, fast and realistic rendering effects of real terrain data in a simulation environment.
[0100] In the specific implementation process of mapping dynamic situation information based on the ground-based situation mapping processing algorithm, ray collision detection is generally a basic function provided by the three-dimensional engine, and the collision detection result will provide the normal of the hit point and the hit plane. This application can achieve the free mapping of dynamic situation information in the geographic space micro-scene and the smooth and realistic display effect of lines through the ground-based situation mapping processing algorithm based on ray collision detection. At the same time, it can be easily transplanted in various engines and can be smoothly migrated in the hybrid free rendering engine. Applications have been verified in the refined scenes based on the Web large scene and UE.
[0101] The principles and goals of ground-based situational mapping are as follows:
[0102] Mainly aimed at the refinement, in complex geographic space micro-scenes, due to the limitations of basic physical environments such as terrain or complex irregular shapes, dynamic situation targets cannot be freely and smoothly mapped, resulting in uneven mapping lines and spline lines that cannot be extended and mapped according to freely specified terrain or objects. This application is based on the 2D traditional line marking algorithm library, adopts virtual planes and collision detection technology, and constructs spline virtual planes and folded surface virtual planes to encapsulate the coordinate conversion interface of the spatial surface, realizes the projection of the two-dimensional plane into the three-dimensional space, and combines the collision detection interface in the three-dimensional space to perform real-time detection of complex terrain and objects in the scene, so as to dynamically generate the spline shape of the target entity mapping in real time for free and smooth mapping.
[0103] The principle of virtual plane technology is to use positioning points and algorithms to create a coordinate conversion interface in three-dimensional space, which can project a two-dimensional plane into three dimensions, so that two-dimensional algorithms can be used in three-dimensional space. The principle of the spline virtual plane is to use a spline surface unfolded by a three-dimensional spline. Each positioning point consists of a position, a forward direction, and a right direction. The principle of the folded surface virtual plane is that each segment of a three-dimensional surface is a plane, and two planes intersect at the positioning point. Each positioning point consists of a position, a right-side direction in the intersection line, and a reference forward direction. In specific implementation, the positioning points of the spline virtual plane and the folded surface virtual plane can be used interchangeably, and the value conversion can be performed by switching the virtual plane; the virtual plane can be determined through mouse interaction, and the spline virtual plane can be drawn through mouse interaction.
[0104] See also Figure 4 ,The process of drawing a virtual plane based on mouse interaction is as follows, including:
[0105] Step S411, defining a predetermined vertical distance from the terrain surface to the line mark height, i.e., the plotting height h;
[0106] Step S412, capturing a mouse click event, determining the mouse click position P and the normal N of the click position through collision detection, and obtaining the actual positioning point of the plotted line in the three-dimensional space through vector calculation;
[0107] Step S413, when there are at least three positioning points after adding the current positioning point PN, calculate the forward direction and right direction of the previous positioning point PL of the current positioning point PN;
[0108] Step S414, determining whether the two positioning points are in an approximate plane according to the normal angle between the positioning point PN and the positioning point PL, if so, the positioning point PL performs an in-plane turn; if not, the positioning point PL performs a vertical turn;
[0109] Step S415, extending the data of the positioning point PL to the positioning point PN to obtain a spline curve that conforms to the terrain;
[0110] Step S416: construct the spline surface virtual plane based on the spline curve.
[0111] Exemplarily, the process of drawing the spline surface virtual plane is described as follows, including:
[0112] (1) Let h be the plotting height, record the position P and normal N of the collision detection hit of the mouse click event in the 3D scene, and P+N*h is the position of the positioning point:
[0113] (2) When there are at least three positioning points after adding the new positioning point PN, the forward direction and right direction of the penultimate positioning point PL are calculated, and then the virtual plane of the spline surface is determined through the following two sub-steps:
[0114] 1) According to the normal angle between PN and PL, determine whether the two positioning points are in an approximate plane. If so, PL performs an in-plane turn, that is, the right direction is in the plane of the two end segments of PL; if not, PL performs a vertical turn, that is, the right direction is perpendicular to the two end segments of PL.
[0115] 2) Extend the PL data to the PN.
[0116] See also Figure 5 The process of drawing a folded virtual plane based on mouse interaction is as follows, including:
[0117] Step S421, defining a predetermined vertical distance from the terrain surface to the line mark height, i.e., the plotting height h;
[0118] Step S422, capturing the mouse click event, determining the mouse click position T and the normal line N of the click position through collision detection, and obtaining the actual positioning point of the plotted line in the three-dimensional space through vector calculation;
[0119] Step S423, when adding the current positioning point PN, try to connect the current positioning point PN with its previous positioning point PL, the connection mode includes step connection and path finding connection;
[0120] Step S424: construct the folded virtual plane based on the successfully connected point groups.
[0121] Further, in step S423, the step connection includes:
[0122] Step S4231, a ray is emitted from the positioning point PL to the positioning point PN. If the ray collision detection finds a collision, the current attempt is abandoned, and an intermediate vertex is generated and a ray collision detection is performed:
[0123] Step S4232: Taking the average value of the normal line in the opposite direction from the positioning point PN to the positioning point PL as the downward direction D, n intermediate vertices are evenly divided between the positioning point PL and the positioning point PN, and ray collision detection is performed on each intermediate vertex.
[0124] Step S4233, if it is satisfied that: the difference between the hit distances detected between two adjacent intermediate vertices is less than the set value, the step connection is successful, and the positioning point PL is directly connected to the positioning point PN.
[0125] Furthermore, in step S423, the path finding connection includes:
[0126] Step a, based on the projection of the positioning point PL to the positioning point PN in the plane corresponding to the normal line of the positioning point PL, recorded as the forward direction F;
[0127] Step b, defining a height value m=h / 10, where h is the plotting height;
[0128] Step c, emitting rays forward from the positioning point PL after it touches the ground to perform ray collision detection;
[0129] Step d, if the ray collision detection has a collision, the hit point is recorded as A, the point is recorded as TA, and the normal is recorded as NA;
[0130] The projection of the reverse direction -F based on the forward direction in the plane corresponding to the normal line NA is recorded as the return direction R;
[0131] Step e, emitting rays from the hit point A along the return direction R to perform ray collision detection. If the ray collision detection shows a collision, the hit point is recorded as B, the point is recorded as TB, and the normal is recorded as NB;
[0132] Step f, determining whether the normal line NB of the hit point B is similar to the normal line NL of the positioning point PL;
[0133] Step g, if similar, calculate the point C and the normal NC of the two face corners according to the hit point A and the hit point B, obtain the positioning point PC, and update the point C to the positioning point PL; that is, there is a suitable path;
[0134] Step h, if there is no suitable path, emitting rays forward from the locating point PL after burying it in the ground to perform ray collision detection, and repeating steps d to g;
[0135] In step i, if there is still no suitable path, it is recorded as a movement failure and the loop is exited.
[0136] In some possible implementations, if the engine does not support ray collision detection by hitting the reverse plane, rays are emitted from the same starting point in the opposite direction to perform ray collision detection.
[0137] Exemplarily, the process of drawing the folded virtual plane is described as follows, including:
[0138] (1) Let h be the plotting height, record the position T and normal N of the collision detection hit of the mouse click event in the 3D scene, and T+N*h is the position P of the positioning point;
[0139] (2) When a new positioning point PN is added, an attempt is made to connect the penultimate positioning point PL with PN, which mainly includes the following sub-steps:
[0140] 1) Try step connection, the specific process is as follows:
[0141] a) Perform ray collision detection PL->PN. If there is a collision, the attempt is aborted;
[0142] b) The average value of the reverse direction of the PN and PL normals is the downward direction D, and PL<->PN is evenly divided into 5 intermediate vertices T. A ray collision test T->T+D*h*2 is performed on each T. The difference between the hit distances of two adjacent tests must be less than h / 5.
[0143] c) The step connection is successful, directly connecting PL->PN.
[0144] 2) Try to find a path to connect. There are two modes, see Figure 6-7 , the specific processing is as follows:
[0145] a) Calculate the projection of PL->PN in the plane corresponding to the normal line of PL, which is recorded as the forward direction F;
[0146] b) Set a small height value m=h / 10;
[0147] c) Perform ray collision detection
[0148] (TL+NL*m)->(TL+NL*m+F*d(TL-PL)*2), this ray detection is the ray detection from point PL to the ground and forward. If the target is not hit, jump to g), otherwise the hit point A is recorded as TA and the normal is NA;
[0149] d) Calculate the projection of -F in the plane corresponding to the normal line NA, record it as returning to the reverse direction R, and perform ray collision detection (TA+NA*m)->(TA+NA*m+R*d(TL-PL)*2). If the target is not hit, jump to g), otherwise record the hit point B, the point is TB, and the normal is NB;
[0150] e) Calculate whether NB is similar to NL. If not, jump to g);
[0151] f) Based on A and B, calculate the point C and the normal line NC of the two face corners, obtain the positioning point PC and the right side direction of the intersection line, set C as the new PL, and jump to k);
[0152] g) Perform ray collision detection again
[0153] (TL-NL*m)->(TL-NL*m+F*d(TL-PL)*2), this ray detection is the forward ray detection after the PL point is buried. If the engine does not support hitting the reverse plane, then (TL-NL*m)<-(TL-NL*m+F*d(TL-PL)*2) is performed. If the target is not hit, jump to k), otherwise the hit point A is recorded, the point is TA, and the normal is NA; where d is the detection length;
[0154] h) Calculate the projection of -F in the plane corresponding to the normal line NA, record it as returning to the reverse R, and perform ray collision detection (TA-NA*m)->(TA-NA*m+R*d(TL-PL)*2). If the engine does not support hitting the reverse plane, perform (TA-NA*m)<-(TA-NA*m+R*d(TL-PL)*2). If the target is not hit, jump to k), otherwise record the hit point B, the point is TB, and the normal is NB;
[0155] i) Calculate whether NB is similar to NL. If not, jump to k);
[0156] j) Based on A and B, calculate the point C and the normal line NC of the two face corners, obtain the positioning point PC and the right side direction of the intersection line, set C as the new PL, and jump to k);
[0157] k) Record it as a move failure and exit the loop.
[0158] (3) Add the successfully connected point group to the virtual plane of the folded surface.
[0159] After drawing the virtual plane, line markers are drawn in the virtual plane, that is, according to the 2D coordinate range of the virtual plane, 2D line markers are drawn, and the two-dimensional graphics are converted into graphics elements in the three-dimensional space.
[0160] In the specific implementation process, depending on the different line marks, the number of line mark positioning points can be the same as or one more than the number of virtual plane positioning points. The 2D coordinate range of the virtual plane is set to x[0,100n], y[-100,100]. If there are two starting points for the line mark, the positioning points are (0,50), (0,-50), (100,0), (200,0)...(100n,0). If there is only one starting point, the positioning point is (100i,0). After the 2D line mark is drawn, the primitives are converted into 3D primitives according to the virtual plane, and the marking can be realized.
[0161] See also Figure 8-9 , Figure 8-9 A diagram showing the rendering effect achieved by the rendering method of an embodiment of the present application in a three-dimensional scene.
[0162] To summarize, the rendering method implemented in the present application targets the characteristics of different types of 3D graphics rendering engines, integrates different types of 3D graphics rendering engines to form a hybrid rendering engine, and is capable of freely switching the actual rendering engine according to actual scene requirements; on the basis of the hybrid rendering engine, through irregular terrain gridding and dynamic loading display processing based on the geographic space environment and ground situation mapping processing technology based on ray collision detection, a high-fidelity visualization analysis method for the geographic space environment for digital twins that includes multiple rendering engines is realized, which can meet the requirements of high fidelity, dynamic generation, and efficient expression of real-world geographic space terrain data information and dynamic situation information in the digital twin simulation environment.
[0163] See also Fig.10 , corresponding to the above-mentioned high-realistic geospatial hybrid rendering method embodiment, the present application embodiment provides a high-realistic geospatial hybrid rendering device, the rendering device comprising:
[0164] Dynamic gridding construction module 1001 is used to process terrain data in real time based on GIS engine, and to dynamically construct a geospatial environment model grid body in real time by integrating GIS rendering engine and Unreal rendering engine;
[0165] Dynamic loading module 1002, used for dynamically selecting the terrain slices required for loading and rendering based on the LOD dynamic scheduling technology according to the observer's position and distance, using low-resolution slices for distant areas and high-resolution slices for close areas;
[0166] The dynamic rendering module 1003 is used to dynamically schedule data and render terrain data in real time based on the data streaming mechanism and the demand for display content in the current observer's view area;
[0167] The free situation plotting processing module 1004 is used for geospatial dynamic environment situation information, and performs plotting processing on the dynamic situation information in a situation free plotting method based on ray collision detection, including:
[0168] Draw spline virtual planes and fold surface virtual planes based on mouse interaction;
[0169] According to the 2D coordinate range of the virtual plane, 2D line markers are drawn, and the two-dimensional graphics are dynamically converted and constructed into graphic elements in the three-dimensional space.
[0170] The above-mentioned highly realistic geospatial hybrid rendering device implements the steps and various processes of the above-mentioned highly realistic geospatial hybrid rendering method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0171] See also Fig.11 Corresponding to the above-mentioned high-realistic geospatial hybrid rendering method embodiment, an embodiment of the present application provides an electronic device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, the steps of the above-mentioned high-realistic geospatial hybrid rendering method embodiment and the various processes of the embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0172] The memory 1009 can be used to store software programs and various data. The memory 1009 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1009 may include a volatile memory or a non-volatile memory, or the memory 1009 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1009 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0173] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1010.
[0174] Corresponding to the above-mentioned high-realistic geospatial hybrid rendering method embodiment, the embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by the processor, the steps of the above-mentioned high-realistic geospatial hybrid rendering method embodiment and the various processes of the embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0175] The processor is the processor in the electronic device described in the above embodiment of the present application. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0176] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0177] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0178] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A highly realistic geospatial hybrid rendering method, characterized in that: include: Based on the GIS engine, terrain data is processed in real time, and the geospatial environment model grid is dynamically constructed in real time by integrating the GIS rendering engine and the Unreal rendering engine; Based on LOD dynamic scheduling technology, the terrain slices required for loading and rendering are dynamically selected according to the observer's position and distance. Low-resolution slices are used in distant areas, and high-resolution slices are used in close areas. Based on the data streaming mechanism, data is dynamically scheduled and terrain data is rendered in real time according to the demand for display content in the current observer's view area; For the dynamic environment situation information of geographic space, the situation free plotting method based on ray collision detection is used to plot the dynamic situation information, including: Draw spline virtual planes and fold surface virtual planes based on mouse interaction; According to the 2D coordinate range of the virtual plane, 2D line markers are drawn, and the two-dimensional graphics are dynamically converted and constructed into graphic elements in the three-dimensional space.
2. The highly realistic geospatial hybrid rendering method according to claim 1, characterized in that: The step of constructing a geospatial environment model grid body includes: Based on the terrain data, analyzing geometric characteristics and structural information, including identification of terrain boundaries, measurement of side lengths, calculation of normals, and analysis of angles and curvatures; Recursively calculating the loss metric of each edge according to the length, normal direction, angle, and curvature of the edge of the terrain data; Select the edge with the smallest loss metric as the collapse candidate; Perform a collapse operation based on the collapse candidate to obtain an irregular triangular grid body; For different areas, the grid density is dynamically adjusted according to visual needs; After each collapse operation, the loss metrics of the surrounding edges are recalculated, and the step of selecting the edge with the minimum loss metric as the collapse candidate is iterated.
3. The highly realistic geospatial hybrid rendering method according to claim 2, characterized in that: Draw spline virtual planes based on mouse interaction, including: Define the predetermined vertical distance from the terrain surface to the line mark height, i.e. the plotting height h; Capture mouse click events, determine the mouse click position P and the normal N of the click position through collision detection, and obtain the actual positioning point of the plotted line in three-dimensional space through vector calculation; When there are at least three positioning points after adding the current positioning point PN, calculate the forward direction and right direction of the previous positioning point PL of the current positioning point PN; According to the normal angle between the positioning point PN and the positioning point PL, determine whether the two positioning points are in an approximate plane. If so, the positioning point PL performs an in-plane turn; if not, the positioning point PL performs a vertical turn; Extend the data of the positioning point PL to the positioning point PN to obtain a spline curve that conforms to the terrain; The spline surface virtual plane is constructed based on the spline curve.
4. The highly realistic geospatial hybrid rendering method according to claim 2, characterized in that: Draw a virtual plane based on mouse interaction, including: Define the predetermined vertical distance from the terrain surface to the line mark height, i.e. the plotting height h; Capture mouse click events, determine the mouse click position T and the normal line N of the click position through collision detection, and obtain the actual positioning point of the plotted line in three-dimensional space through vector calculation; When adding the current positioning point PN, try to connect the current positioning point PN with its previous positioning point PL. The connection methods include step connection and path finding connection. The folded surface virtual plane is constructed based on the successfully connected point groups.
5. The highly realistic geospatial hybrid rendering method according to claim 4, characterized in that: The step connection comprises: A ray is emitted from the anchor point PL to the anchor point PN. If the ray collision detection finds a collision, the current attempt is abandoned, and the intermediate vertex is generated and the ray collision detection is performed: The average value of the normal line in the opposite direction from the positioning point PN to the positioning point PL is taken as the downward direction D, n intermediate vertices are evenly divided between the positioning point PL and the positioning point PN, and ray collision detection is performed on each intermediate vertex. If the following conditions are met: the difference between the hit distances detected between two adjacent intermediate vertices is less than the set value, the step connection is successful, and the positioning point PL is directly connected to the positioning point PN.
6. The highly realistic geospatial hybrid rendering method according to claim 4, characterized in that: The pathfinding connection includes: Step a, based on the projection of the positioning point PL to the positioning point PN in the plane corresponding to the normal line of the positioning point PL, recorded as the forward direction F; Step b, defining a height value m=h / 10, where h is the plotting height; Step c, emitting rays forward from the positioning point PL after it touches the ground to perform ray collision detection; Step d, if the ray collision detection has a collision, the hit point is recorded as A, the point is recorded as TA, and the normal is recorded as NA; The projection of the reverse direction -F based on the forward direction in the plane corresponding to the normal line NA is recorded as the return direction R; Step e, emitting rays from the hit point A along the return direction R to perform ray collision detection. If the ray collision detection shows a collision, the hit point is recorded as B, the point is recorded as TB, and the normal is recorded as NB; Step f, determining whether the normal line NB of the hit point B is similar to the normal line NL of the positioning point PL; Step g, if similar, calculate the point C and the normal NC of the two face corners according to the hit point A and the hit point B, obtain the positioning point PC, and update the point C to the positioning point PL; that is, there is a suitable path; Step h, if there is no suitable path, emitting rays forward from the locating point PL after burying it in the ground to perform ray collision detection, and repeating steps d to g; In step i, if there is still no suitable path, it is recorded as a movement failure and the loop is exited.
7. The highly realistic geospatial hybrid rendering method according to claim 6, characterized in that: If the engine does not support ray collision detection by hitting the reverse plane, rays are emitted from the same starting point in the opposite direction for ray collision detection.
8. A highly realistic geospatial hybrid rendering device, characterized in that: include: The dynamic gridding construction module is used to process terrain data in real time based on the GIS engine, and to dynamically build the geospatial environment model grid in real time by integrating the GIS rendering engine and the Unreal rendering engine; the dynamic loading module is used to dynamically select the terrain slices required for loading and rendering based on the observer's position and distance based on the LOD dynamic scheduling technology, using low-resolution slices for distant areas and high-resolution slices for close areas; Dynamic rendering module, used to dynamically schedule data and render terrain data in real time based on the data streaming mechanism and the demand for display content in the current observer's view area; The free situation plotting processing module is used to plot the dynamic situation information of the geospatial dynamic environment in a situation free plotting method based on ray collision detection, including: Draw spline virtual planes and fold surface virtual planes based on mouse interaction; According to the 2D coordinate range of the virtual plane, 2D line markers are drawn, and the two-dimensional graphics are dynamically converted and constructed into graphic elements in the three-dimensional space.
9. An electronic device, characterized in that: The electronic device comprises: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the highly realistic geospatial hybrid rendering method as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the high-fidelity geospatial hybrid rendering method as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Digital twin model construction system and method based on UE4
CN120374897A
