Spatial hierarchy rendering method and system for Internet three-dimensional map

By calculating the priority and depth deviation values ​​of the layer in the three-dimensional map for depth offset, the problem of depth conflict in the three-dimensional map is solved, ensuring the correct rendering of the layer and the accuracy of spatial relationships, and improving the user experience.

CN119152102AActive Publication Date: 2024-12-17SUZHOU IND PARK SURVEYING MAPPING & GEOINFORMATION CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411643561.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2024-12-17
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

The existing technology cannot effectively solve the problem of depth conflict in three-dimensional maps, resulting in blurred boundaries between layers, overlapping and wrong spatial hierarchy, affecting the readability and user experience of the map.

Method used

By obtaining data in the Internet 3D map scene, compute the priority order of each layer, and calculate the depth deviation value of the 2D and 3D models based on the camera position in the numeric shader to perform depth offset to ensure that The layer is rendered with the correct priority.

Benefits of technology

It effectively avoids the depth conflict between distant tiles under large pitch angles, ensures the correctness of the spatial relationship of the camera at any angle, improves the detection accuracy of depth buffering, and achieves correct spatial hierarchy expression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119152102A_ABST
    Figure CN119152102A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of three-dimensional map rendering, in particular to a spatial hierarchy rendering method and system for an internet three-dimensional map, and the method comprises the steps: recording the priority order of each layer to be rendered in an internet three-dimensional map scene; performing spatial hierarchy calculation on the two-dimensional layer, calculating a target depth deviation value of each fragment in the two-dimensional layer, and performing depth offset on the two-dimensional layer; performing spatial hierarchy calculation on the three-dimensional model, calculating a target depth deviation value of each fragment in the three-dimensional model, and performing depth migration on the three-dimensional model; according to the priority order of the two-dimensional layers and the three-dimensional models, drawing interfaces are called in sequence, and a rendering result graph is obtained. According to the method, the problem of possible distant tile depth conflict under the condition of a large pitch angle is avoided, and the correctness of the spatial relationship of the internet three-dimensional map of the camera at any angle is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of three-dimensional map rendering, and in particular to a spatial layer rendering method and system for Internet three-dimensional maps. Background Art

[0002] Based on the rapid development of visualization technology, Internet maps have been upgraded from two-dimensional to three-dimensional. Based on the original camera translation and zooming, three-dimensional maps have expanded the camera tilt angle. Users can not only zoom and pan the map, but also tilt the camera to obtain different perspectives and view map information more intuitively.

[0003] In a 3D map, due to their high consistency, 2D layers often cause depth conflicts (z-fighting) when the camera is tilted and moved. This is because when multiple 2D layers are superimposed in the same perspective, since their height information is the same, when the camera is tilted, the projection method of the object changes, which may cause the depth value difference of two surfaces that originally had little difference in the depth buffer to become more significant. The rendering engine cannot accurately judge the front and back relationship between the 2D layers, resulting in depth conflicts. Depth conflicts not only cause the boundaries between layers to be blurred or even overlapped, but also cause incorrect spatial hierarchy, seriously affecting the readability of the map and the user experience.

[0004] There are three common methods in the prior art to solve the above-mentioned depth conflict problem: (1) Turn off depth detection when rendering a 2D layer so that the next rendered layer covers the previous rendered layer, thereby avoiding depth conflicts. However, the 2D layer itself has material properties, and opaque materials often require depth writing and depth detection. This method will generate more logical judgments, greatly increasing the difficulty of rendering map data.

[0005] (2) Adjust the distance between the camera's near clipping plane (near) and far clipping plane (far). By adjusting the values ​​of the near clipping plane and the far clipping plane, the accuracy and coverage of the depth buffer can be changed, thereby reducing the occurrence of depth conflicts to a certain extent. However, adjusting the values ​​of the near clipping plane and the far clipping plane will affect the accuracy and performance of rendering. If the distance between the near clipping plane and the far clipping plane is adjusted too close, the map tiles will disappear, and if it is too far, there will be rendering performance problems, so it is difficult to achieve a perfect balance.

[0006] (3) Depth offset is performed on the world coordinates of the layer to avoid depth conflict by adding a small depth offset. However, when the camera's pitch angle is relatively large, such as when the tilt angle is close to 90°, that is, when observing the three-dimensional space from the perspective of the horizon, due to the depth offset between the layers, the layer above may cover the layer below it, which will still cause depth conflict and lead to an incorrect spatial position relationship. In addition, adjusting the world coordinate value will also affect the subsequent collision calculation.

[0007] Therefore, the existing methods for resolving depth conflicts all have their own limitations. In Internet 3D map visualization projects, due to the limitations of browser performance, correctly rendering spatial layers still faces great challenges. Summary of the invention

[0008] Therefore, the technical problem to be solved by the present invention is to overcome the problem of depth conflict generated during the spatial rendering of a three-dimensional map that cannot be effectively solved in the prior art.

[0009] In order to solve the above technical problems, the present invention provides a spatial hierarchical rendering method for an Internet three-dimensional map, comprising: Acquire various types of data in the Internet three-dimensional map scene, generate corresponding layers to be rendered, and record the priority order of each layer; the layers to be rendered include two-dimensional layers and three-dimensional models; Perform spatial hierarchy calculation on each 2D layer, calculate the target depth deviation value of each fragment in the 2D layer according to the camera position, and perform depth offset on each fragment of the 2D layer in the fragment shader; Perform spatial hierarchical calculations on the 3D model, calculate the target depth deviation value of each fragment in the 3D model according to the camera position, and perform depth offset on each fragment of the 3D model in the fragment shader; The drawing interface is called in sequence according to the priority order of the two-dimensional layer and the three-dimensional model, and the three-dimensional map scene is rendered on the screen to obtain the rendering result image.

[0010] Preferably, the various types of data in the Internet three-dimensional map scene include two-dimensional vector data, raster data and three-dimensional model data.

[0011] Preferably, performing spatial hierarchical calculation on each two-dimensional layer, calculating the target depth deviation value of each fragment in the two-dimensional layer according to the camera position, and performing depth offset on each fragment of the two-dimensional layer in the fragment shader includes: Calculate the first equidistant depth offset of the two-dimensional layer according to the priority order of the two-dimensional layer and the total number of layers of the three-dimensional map scene; Calculate the second equidistant depth offset of the two-dimensional layer according to the first equidistant depth offset of the two-dimensional layer and the camera height; Calculate the target depth deviation value of each fragment in the two-dimensional layer according to the camera angle and the second equidistant depth offset of the two-dimensional layer; In a 2D layer fragment shader, a depth offset is performed on the 2D layer in the fragment shader according to a target depth bias value of each fragment in the 2D layer.

[0012] Preferably, the calculating the first equidistant depth offset of the two-dimensional layer according to the priority order of the two-dimensional layer and the total number of layers of the three-dimensional map scene comprises: When the camera is above the ground, the calculation formula for the first equidistant depth offset of the 2D layer on the ground scene is: ; When the camera is below the surface, the calculation formula for the first equidistant depth offset of the 2D layer in the underground scene is: ; in, and They are the first equidistant depth offsets of the two-dimensional layer for the above-ground scene and the underground scene, Indicates the total number of layers in the 3D map scene. Indicates the priority order of the current 2D layer. Indicates the empirical correction value for equidistant depth offset.

[0013] Preferably, the correction empirical value of the equidistant depth offset is .

[0014] Preferably, calculating the second equidistant depth offset of the two-dimensional layer according to the first equidistant depth offset of the two-dimensional layer and the camera height comprises: The ratio of the vertical height of the camera to the camera height correction value is multiplied by the first equidistant depth offset of the 2D layer to obtain the second equidistant depth offset of the 2D layer.

[0015] Preferably, the camera height correction value is proportional to the vertical height of the camera.

[0016] Preferably, performing spatial hierarchical calculation on the three-dimensional model, calculating the target depth deviation value of each fragment in the three-dimensional model according to the camera position, and performing depth offset on each fragment of the three-dimensional model in the fragment shader includes: In the vertex shader of the 3D model, the world coordinate z value of the vertex of the fragment of the 3D model is used to determine whether the fragment is above or below the surface of the ground; When the camera is above the ground, the second equidistant depth offset of the two-dimensional layer with the lowest priority is obtained as the target equidistant depth offset; when the camera is below the ground, the second equidistant depth offset of the two-dimensional layer with the highest priority is obtained as the target equidistant depth offset; Calculate the target depth deviation value of each fragment in the 3D model based on the camera angle and the target isometric depth offset; In the 3D model fragment shader, depth offset is performed on the 3D model in the fragment shader according to a target depth deviation value of each fragment in the 3D model.

[0017] Preferably, the target depth deviation value of each fragment is calculated according to the camera angle and the isometric depth offset, including: In the vertex shader, the fragment vertex is converted to the world coordinate system through the preset model matrix to obtain the world coordinate of the fragment vertex; the world coordinate of the camera is subtracted from the world coordinate of the fragment vertex, and then the vector is normalized to obtain the direction vector from the fragment to the camera; After performing a dot product operation on the direction vector from the fragment to the camera and the normal vector of the fragment, the vector is inverted to obtain the initial depth deviation value of the current fragment affected by the camera angle. The isometric depth offset is passed into the fragment shader and multiplied by the initial depth deviation value of each fragment affected by the camera angle to obtain the target depth deviation value of each fragment due to the camera angle.

[0018] The present invention also provides a spatial hierarchical rendering system for Internet three-dimensional maps, comprising: A layer sequence recording module is used to obtain various types of data in the Internet three-dimensional map scene, generate layers to be rendered accordingly, and record the priority order of each layer; the layers to be rendered include two-dimensional layers and three-dimensional models; The 2D layer depth offset module is used to perform spatial layer calculation for each 2D layer, calculate the target depth deviation value of each fragment in the 2D layer according to the camera position, and perform depth offset on each fragment of the 2D layer in the fragment shader; The 3D model depth offset module is used to perform spatial layer calculation on the 3D model, calculate the target depth deviation value of each fragment in the 3D model according to the camera position, and perform depth offset on each fragment of the 3D model in the fragment shader; The rendering module is used to call the drawing interface in sequence according to the priority order of the two-dimensional layer and the three-dimensional model, render the three-dimensional map scene onto the screen, and obtain the rendering result image.

[0019] The above technical solution of the present invention has the following beneficial effects compared with the prior art: The spatial hierarchical rendering method for Internet three-dimensional maps described in the present invention not only takes into account the relative position between the camera and the target fragment on the basis of the isometric depth offset, but also calculates the target depth deviation value of each fragment in the two-dimensional layer and the three-dimensional model in real time according to the camera angle, thereby avoiding the depth conflict problem of distant tiles that may occur under large pitch angles, and ensuring the correctness of the spatial relationship of the Internet three-dimensional map at any angle of the camera.

[0020] Furthermore, the present invention also takes into account the depth accuracy error caused by the camera height in the process of calculating the equidistant depth offset. By introducing the camera height correction value to solve the problem of nonlinear depth accuracy caused by the camera height, the detection accuracy of the depth buffer is improved, and the correctness of the spatial relationship of the camera at any height is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein: Figure 1 is a flow chart of the method of the present invention; Figure 2 It is a rendering result diagram of the prior art; Figure 3 It is the rendering result diagram of the present invention. DETAILED DESCRIPTION

[0022] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention. Embodiment 1

[0023] Reference Figure 1 As shown, the present invention provides a spatial hierarchical rendering method for an Internet three-dimensional map, comprising: Step 1: Obtain various types of data in the Internet three-dimensional map scene, generate corresponding layers to be rendered, and record the priority order of each layer; the layers to be rendered include two-dimensional layers and three-dimensional models.

[0024] Step 1 includes the following sub-steps: Step 1.1: Obtain various types of data in the Internet three-dimensional map scene, including two-dimensional vector data, raster data, and three-dimensional model data.

[0025] The two-dimensional vector data includes city base map, road lines and lake data, which are in GeoJson data format. The raster data includes image map. The three-dimensional model data includes three-dimensional building white model, which is in GLB (GL TransmissionFormat Binary) data format.

[0026] Step 1.2: Prioritize various types of data in the Internet 3D map scene according to the expected scene effect, add them to the queue to be rendered in turn, generate layers to be rendered, and record the priority order of each layer. The layers to be rendered include two-dimensional layers and three-dimensional models.

[0027] For example, the image map is added first as a two-dimensional background layer, and the priority of this layer is recorded as 0; the city base map of two-dimensional vector data is added second, and the priority of the two-dimensional city base map layer is recorded as 1; above the two-dimensional city base map is a two-dimensional lake surface layer, and the priority of the two-dimensional lake surface layer is recorded as 2; subsequent two-dimensional layers are recorded in sequence; the two-dimensional road layer has the second highest priority, and the three-dimensional model has the highest priority.

[0028] Step 2: Perform spatial hierarchy calculation on each 2D layer, calculate the target depth deviation value of each fragment in the 2D layer according to the camera position, perform depth offset on each fragment of the 2D layer in the fragment shader to solve the depth conflict problem between 2D layers.

[0029] Step 2 includes the following sub-steps: Step 2.1: Calculate the first equidistant depth offset of the two-dimensional layer according to the priority order of the two-dimensional layer and the total number of layers of the three-dimensional map scene.

[0030] The calculation of depth offset takes into account whether the camera is above or below the ground surface. When the camera is above the ground surface, that is, displaying the ground scene, each 2D layer needs to be offset to the far end of the camera according to the priority order. The first equidistant depth offset of each 2D layer can be calculated by the priority order of the 2D layer and the total number of layers of the 3D map scene. For example, the 2D background layer with a priority order of 0 is added first, so its first equidistant depth offset is the largest, and the first equidistant depth offset of the 2D layers added subsequently decreases linearly.

[0031] On the contrary, when the camera is below the surface, that is, displaying the underground space scene, the two-dimensional background layer with a priority of 0 needs to be added last, so its first equidistant depth offset is the smallest.

[0032] In order to scale the first equidistant depth offset to the camera's depth range, i.e., the 0-1 numerical space, it is necessary to multiply it by the empirical correction value of the equidistant depth offset. The empirical correction value of the equidistant depth offset is adjusted through experiments to achieve the desired effect. In this embodiment, the empirical correction value of the equidistant depth offset is calculated through practice as .

[0033] Therefore, when the camera is above the ground, the calculation formula for the first isometric depth offset of the 2D layer in the ground scene is as follows: ; When the camera is below the surface, the calculation formula for the first equidistant depth offset of the 2D layer in the underground scene is as follows: ; in, and They are the first equidistant depth offsets of the two-dimensional layer for the above-ground scene and the underground scene, Indicates the total number of layers in the 3D map scene. Indicates the priority order of the current 2D layer. Indicates the empirical correction value for equidistant depth offset.

[0034] Step 2.2: Calculate the second equidistant depth offset of the 2D layer based on the camera height.

[0035] In addition to the close proximity of objects, the nonlinear nature of depth values ​​is another major factor that causes depth conflict.

[0036] In the three-dimensional map of the Internet, in order to simulate the visual effects of the real world, perspective projection transformation is usually used to achieve the perspective effect of "near is big, far is small". After the perspective projection transformation, the vertex coordinates of the two-dimensional layer are transferred to the clip space (Clip Space), and then converted to the normalized device coordinate space (Normalized Device Coordinates, NDC) through perspective division. Perspective division makes the relationship between the depth value and the real distance a nonlinear relationship. This is to provide higher depth accuracy for closer objects, making them more consistent with the perception of the human eye. However, this method will also cause a phenomenon that the more remote the place is, the more likely it is to cause flickering, while the closer it is, the less likely it is to cause flickering.

[0037] In order to solve the problem of nonlinear depth accuracy caused by camera height, the present invention introduces a camera height correction value, which is used to calculate the depth deviation of the two-dimensional layer caused by the camera height in real time. Specifically, when the camera is farther away from the two-dimensional layer, the offset of the two-dimensional layer should be increased accordingly due to the limited depth accuracy of the camera at a distance. On the contrary, when the camera is closer to the two-dimensional layer, the offset of the two-dimensional layer can be reduced accordingly because the camera has sufficient depth accuracy space at a close distance.

[0038] Therefore, the present invention considers the deviation caused by the camera height, scales the isometric offset, and calculates the second isometric depth offset of the two-dimensional layer due to the camera height. The formula is as follows: ; in, The second equidistant depth offset of the 2D layer. is the first equidistant depth offset of the 2D layer. Indicates the vertical height of the camera, Indicates the camera height correction value. The camera height correction value increases as the vertical height of the camera increases, and decreases as the vertical height of the camera decreases.

[0039] Step 2.3: Calculate the target depth deviation value of each fragment in the two-dimensional layer according to the camera angle.

[0040] When the camera is tilted, each fragment in the 2D layer is offset toward the camera according to the depth offset calculated in step 2.2, but is not actually in the same plane. In particular, when the camera is tilted at a large angle, that is, when viewing the 3D map scene from a perspective close to the horizon, the distant points in the 2D layer may be closer to the original plane after the offset, resulting in the actual fragment depth value being the same as the fragment depth value of other 2D layers, and the 2D layer in the distance will still have depth conflict problems.

[0041] Based on this problem, the present invention calculates the depth deviation caused by the camera angle for each fragment in the two-dimensional layer in real time. At this time, the depth offset of the two-dimensional layer is no longer an equidistant offset, but a real-time depth offset of the fragment based on the normal of the fragment and the direction vector from the fragment to the camera. The normal of the fragment is usually (0.0, 0.0, 1.0).

[0042] Specifically, the world coordinate position of the camera is passed into the 2D layer shader as a global variable (uniform). In the vertex shader of the 2D layer, each fragment vertex in the 2D layer is converted to the world coordinate system through the preset model matrix to obtain the world coordinate of each fragment vertex; the world coordinate of the camera is subtracted from the world coordinate of the fragment vertex, and then the vector is normalized to obtain the direction vector v from the fragment to the camera.

[0043] After performing the dot product operation on the direction vector v from the fragment to the camera in the two-dimensional layer and the normal vector n=(0.0,0.0,1.0) of the fragment, and then negating it, we can get the initial depth deviation value of the current fragment affected by the camera angle.

[0044] The second isometric depth offset of the two-dimensional layer in step 2.2 is passed into the fragment shader as a varying variable, and multiplied by the initial depth deviation value of each fragment in the two-dimensional layer affected by the camera angle to obtain the target depth deviation value of each fragment in the current two-dimensional layer due to the camera angle.

[0045] According to the camera angle, the target depth deviation value of each fragment in the two-dimensional layer is calculated in the fragment shader. The calculation formula is as follows: ; in, is the target depth deviation value of the fragment in the two-dimensional layer, The second equidistant depth offset of the 2D layer. Represents the direction vector from the fragment to the camera in the two-dimensional layer. Represents the normal vector of the fragment in the two-dimensional layer, Represents the dot product of the fragment-to-camera direction vector in a two-dimensional layer and the normal vector of the fragment. It means taking the absolute value of the dot product.

[0046] Specifically, when When it is 1.0, it means that the camera is facing the fragment from a vertical perspective, and the result is still an equidistant offset. When it is greater than or equal to 0 and less than 1.0, it means that there is a certain angle between the camera and the fragment, and the offset needs to be enlarged to distinguish other two-dimensional layers and eliminate depth conflict. When it is less than 0, it means that the camera is below the ground surface. At this time, the target depth deviation value is calculated based on the absolute value of the dot product.

[0047] In summary, the spatial hierarchy calculation is performed on each two-dimensional layer, and the target depth deviation value of the two-dimensional layer is calculated according to the camera height and camera angle. The formula includes: When the camera is above the ground, the target depth deviation value for each fragment in the 2D layer is: ; When the camera is below the ground surface, the target depth deviation value for each fragment in the 2D layer is: ; in, and are the target depth deviation values ​​of each fragment in the two-dimensional layer when the camera is above and below the surface, respectively. Indicates the total number of layers in the 3D map scene. Indicates the priority order of the current 2D layer. Represents the corrected empirical value of equidistant depth offset, Indicates the vertical height of the camera, Indicates the camera height correction value. Represents the direction vector from the fragment to the camera in the two-dimensional layer. Represents the normal vector of the fragment in the two-dimensional layer, Represents the dot product of the fragment-to-camera direction vector in a two-dimensional layer and the normal vector of the fragment. It means taking the absolute value of the dot product.

[0048] Step 2.4: In the 2D layer fragment shader, according to the target depth deviation value of each fragment in the 2D layer, the depth of each fragment of the 2D layer is offset in the fragment shader. The formula is: ; in, Represents the depth value of the fragment coordinates in the two-dimensional layer, which ranges from [0,1]. is the target depth deviation value of the fragment in the two-dimensional layer, It is the depth value of the fragment in the two-dimensional layer.

[0049] In summary, step 2 first calculates the first equidistant depth offset according to the priority order of the two-dimensional layer, and dynamically scales the first equidistant depth offset according to the camera height to calculate the second equidistant depth offset in order to address the depth accuracy error caused by the camera distance. Secondly, in order to solve the problem of distant tile depth conflict that may occur under large pitch angles, step 2 also calculates the target depth deviation value of the fragment in the two-dimensional layer in real time based on the second equidistant depth offset and the relative position between the camera and the target fragment, and finally solves the depth conflict problem of the two-dimensional layer. No matter from which angle the camera is, it can clearly and intuitively express the positional relationship in the front and back, upper and lower spaces of the scene, and achieve correct spatial hierarchy expression.

[0050] Step 3: Perform spatial hierarchy calculation on the 3D model, calculate the target depth deviation value of each fragment in the 3D model according to the camera position, and perform depth offset on each fragment of the 3D model in the fragment shader to solve the problem of spatial hierarchy disorder under the 3D model depth offset strategy.

[0051] Step 3 includes the following sub-steps: Step 3.1: In the vertex shader of the three-dimensional model, the world coordinate z value of the vertex of the fragment of the three-dimensional model is used to determine whether the fragment is above or below the surface.

[0052] In this implementation, it is assumed that the z value of the ground surface is equal to 0.0. If the world coordinate z value of a fragment is less than 0.0, the fragment is considered to be below the ground surface; conversely, if the world coordinate z value of a fragment is greater than or equal to 0.0, the fragment is considered to be above the ground surface.

[0053] Step 3.2: When the camera is above the ground, that is, at the ground scene perspective, obtain the second isometric depth offset of the two-dimensional layer with the lowest priority as the target isometric depth offset; when the camera is below the ground, obtain the second isometric depth offset of the two-dimensional layer with the highest priority as the target isometric depth offset; pass the obtained target isometric depth offset into the three-dimensional model shader as a global variable (uniform).

[0054] In this embodiment, the two-dimensional layer with the lowest priority is the two-dimensional background layer, and the two-dimensional layer with the highest priority is the two-dimensional road line layer.

[0055] Step 3.3: Calculate the target depth deviation value of each fragment in the 3D model based on the camera angle and the target isometric depth offset.

[0056] When the camera is above the ground, the depth offset of the underground fragments of the 3D model is required to prevent the underground parts that should be hidden from being seen from the ground perspective. Conversely, if the camera is below the ground, the depth offset of the above-ground fragments of the 3D model is required to prevent the above-ground parts from being improperly revealed from the underground perspective. This adjustment mainly solves the problem of improper exposure of parts of the 3D model when the camera perspective is switched, to ensure the accuracy of the 3D spatial hierarchy.

[0057] Therefore, this step is the same as step 2.3, and the deviation caused by the camera angle is calculated in real time for the fragments of the above-ground or underground part of the three-dimensional model.

[0058] Specifically, the world coordinate position of the camera is passed into the 3D model shader as a global variable (uniform). In the vertex shader of the 3D model, each fragment vertex in the 3D model is converted to the world coordinate system through the preset model matrix to obtain the world coordinate of the fragment vertex; the world coordinate of each fragment vertex is subtracted from the world coordinate of the camera, and then the vector is normalized to obtain the direction vector from the fragment to the camera. .

[0059] The direction vector from the fragment in the 3D model to the camera and the fragment's normal vector After performing the dot product operation of the vector, the inverse is taken to obtain the initial depth deviation value of the current fragment affected by the camera angle.

[0060] The target isometric depth offset in step 3.2 is passed into the fragment shader as a varying variable, and multiplied by the initial depth deviation value of each fragment in the 3D model affected by the camera angle to obtain the target depth deviation value of each fragment in the current 3D model due to the camera angle.

[0061] According to the camera angle and the target isometric depth offset, the target depth deviation value of each fragment in the 3D model is calculated in the fragment shader. The calculation formula is as follows: ; in, is the target depth deviation value of the fragment in the 3D model, is the target depth offset, Represents the direction vector from the fragment to the camera in the 3D model. Represents the normal vector of the fragment in the three-dimensional model, Represents the dot product of the fragment-to-camera direction vector and the normal vector of the fragment in the 3D model. It means taking the absolute value of the dot product.

[0062] Step 3.4: In the 3D model fragment shader, according to the target depth deviation value of each fragment in the 3D model, the depth offset is performed on each fragment of the 3D model in the fragment shader. The formula is: ; in, Represents the depth value of the fragment coordinates in the 3D model, which ranges from [0,1]. is the target depth deviation value of the fragment in the 3D model, It is the depth value of the fragment in the 3D model.

[0063] Since the Internet 3D map scene has 3D models including building white models in addition to the 2D layers, step 3 further performs depth offset on the 3D model. When the camera is above the surface, since the 2D layers have completed the depth offset, and the 3D model is still the original real depth without offset, some parts below the surface will be incorrectly displayed above the surface; when the camera goes down, the model above the surface also has this problem. In order to solve the problem of incorrect spatial position relationship of the 3D model, step 3 performs depth offset on the fragments of the 3D model below or above the surface for the 3D model, so as to ensure the correctness of the spatial relationship of the 3D map scene at any angle and height. No matter from which angle the camera is, it can clearly and intuitively express the position relationship of the scene in front and behind, up and down space, and achieve correct spatial hierarchy expression, providing favorable technical support for the construction of Internet 3D cities.

[0064] Step 4: Call the drawing interface in order of priority of the two-dimensional layer and the three-dimensional model, render the three-dimensional map scene onto the screen, and obtain the rendering result image.

[0065] Figure 2 This is the rendering result of the existing technology. It can be seen that after the map is rendered, the layer flashes and there is tearing due to the depth conflict problem. Figure 3 This is the rendering result diagram of the present invention, which clearly distinguishes the spatial levels between the two-dimensional layers and has the correct spatial relationship. Embodiment 2

[0066] Based on the spatial hierarchical rendering method for Internet three-dimensional maps described in Embodiment 1, this embodiment provides a spatial hierarchical rendering system for Internet three-dimensional maps, including: A layer sequence recording module is used to obtain various types of data in the Internet three-dimensional map scene, generate layers to be rendered accordingly, and record the priority order of each layer; the layers to be rendered include two-dimensional layers and three-dimensional models; The 2D layer depth offset module is used to perform spatial layer calculation for each 2D layer, calculate the target depth deviation value of each fragment in the 2D layer according to the camera position, and perform depth offset on each fragment of the 2D layer in the fragment shader; The 3D model depth offset module is used to perform spatial layer calculation on the 3D model, calculate the target depth deviation value of each fragment in the 3D model according to the camera position, and perform depth offset on each fragment of the 3D model in the fragment shader; The rendering module is used to call the drawing interface in sequence according to the priority order of the two-dimensional layer and the three-dimensional model, render the three-dimensional map scene onto the screen, and obtain the rendering result image.

[0067] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention first calculates the equidistant depth offset of a two-dimensional layer according to the priority order of the layers, and dynamically scales the equidistant depth offset of the two-dimensional layer according to the camera height. Secondly, in order to solve the problem of depth conflict of distant tiles that may occur under large pitch angles, the target depth deviation value of the fragment in the two-dimensional layer is further calculated in real time according to the scaled equidistant depth offset and the relative position between the camera and each fragment in the two-dimensional layer, and the depth of the two-dimensional layer is offset, thereby solving the depth conflict problem of the two-dimensional layer in the Internet three-dimensional map.

[0068] 2. After performing depth offset on the two-dimensional layer, the present invention considers the situations where the camera is above the surface and below the ground respectively, and adopts the same method to further perform depth offset on the fragments of the three-dimensional model below the surface or above the surface, so as to ensure the correctness of the spatial relationship of the three-dimensional map scene at any angle and height.

[0069] 3. The present invention also considers the relative position between the camera and the target fragment on the basis of the equidistant depth offset, and calculates the target depth deviation value of each fragment in the two-dimensional layer and the three-dimensional model in real time according to the camera angle, avoiding the problem of distant tile depth conflict that may occur under large pitch angles, and ensuring the correctness of the spatial relationship of the Internet three-dimensional map at any angle of the camera. In addition, the present invention performs depth offset based on fragment coordinates, which can solve the collision calculation problem of depth offset in the world coordinate system compared to the depth offset algorithm in the world coordinate system.

[0070] 4. Furthermore, the present invention also takes into account the depth accuracy error caused by the camera height in the process of calculating the equidistant depth offset. By introducing the camera height correction value to solve the problem of nonlinear depth accuracy caused by the camera height, the detection accuracy of the depth buffer is improved, and the correctness of the spatial relationship of the camera at any height is achieved.

[0071] 5. The present invention is applicable to scenes with multiple two-dimensional layers in Internet three-dimensional maps, such as vector lines, surface layers, and grid layers, which are superimposed and rendered with each other, and have the best display effect and interactive experience. It provides a high reference value for the situation of depth conflict of two-dimensional layers in three-dimensional maps.

[0072] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0073] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0074] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0075] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0076] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.

Claims

1. A spatial hierarchical rendering method for an Internet three-dimensional map, characterized in that: include: Obtain various types of data in the Internet 3D map scene, generate corresponding layers to be rendered, and record the priority order of each layer; The layers to be rendered include two-dimensional layers and three-dimensional models; Perform spatial hierarchy calculation on each 2D layer, calculate the target depth deviation value of each fragment in the 2D layer according to the camera position, and perform depth offset on each fragment of the 2D layer in the fragment shader; Perform spatial hierarchical calculations on the 3D model, calculate the target depth deviation value of each fragment in the 3D model according to the camera position, and perform depth offset on each fragment of the 3D model in the fragment shader; The drawing interface is called in sequence according to the priority order of the two-dimensional layer and the three-dimensional model, and the three-dimensional map scene is rendered on the screen to obtain the rendering result image.

2. The spatial layer rendering method for Internet three-dimensional maps according to claim 1, characterized in that: The various types of data in the Internet three-dimensional map scene include two-dimensional vector data, raster data and three-dimensional model data.

3. The spatial layer rendering method for Internet three-dimensional maps according to claim 1, characterized in that: The spatial layer calculation is performed on each two-dimensional layer, the target depth deviation value of each fragment in the two-dimensional layer is calculated according to the camera position, and the depth offset is performed on each fragment of the two-dimensional layer in the fragment shader, including: Calculate the first equidistant depth offset of the two-dimensional layer according to the priority order of the two-dimensional layer and the total number of layers of the three-dimensional map scene; Calculate the second equidistant depth offset of the two-dimensional layer according to the first equidistant depth offset of the two-dimensional layer and the camera height; Calculate the target depth deviation value of each fragment in the two-dimensional layer according to the camera angle and the second equidistant depth offset of the two-dimensional layer; In a 2D layer fragment shader, a depth offset is performed on the 2D layer in the fragment shader according to a target depth bias value of each fragment in the 2D layer.

4. The spatial hierarchical rendering method for Internet three-dimensional maps according to claim 3, characterized in that: The step of calculating the first equidistant depth offset of the two-dimensional layer according to the priority order of the two-dimensional layer and the total number of layers of the three-dimensional map scene includes: When the camera is above the ground, the calculation formula for the first equidistant depth offset of the 2D layer on the ground scene is: ; When the camera is below the surface, the calculation formula for the first equidistant depth offset of the 2D layer in the underground scene is: ; in, and They are the first equidistant depth offsets of the two-dimensional layer for the above-ground scene and the underground scene, Indicates the total number of layers in the 3D map scene. Indicates the priority order of the current 2D layer. Indicates the empirical correction value for equidistant depth offset.

5. The spatial layer rendering method for Internet three-dimensional maps according to claim 4, characterized in that: The correction empirical value of the equidistant depth migration is .

6. The spatial layer rendering method for Internet three-dimensional maps according to claim 3, characterized in that: Calculate the second isometric depth offset of the 2D layer based on the first isometric depth offset of the 2D layer and the camera height, including: The ratio of the vertical height of the camera to the camera height correction value is multiplied by the first equidistant depth offset of the 2D layer to obtain the second equidistant depth offset of the 2D layer.

7. The spatial layer rendering method for Internet three-dimensional maps according to claim 6, characterized in that: The value of the camera height correction value is proportional to the vertical height of the camera.

8. The spatial layer rendering method for Internet three-dimensional maps according to claim 3 is characterized in that: The method of performing spatial hierarchical calculation on the three-dimensional model, calculating the target depth deviation value of each fragment in the three-dimensional model according to the camera position, and performing depth offset on each fragment of the three-dimensional model in the fragment shader includes: In the vertex shader of the 3D model, the world coordinate z value of the vertex of the fragment of the 3D model is used to determine whether the fragment is above or below the surface of the ground; When the camera is above the ground, the second equidistant depth offset of the two-dimensional layer with the lowest priority is obtained as the target equidistant depth offset; when the camera is below the ground, the second equidistant depth offset of the two-dimensional layer with the highest priority is obtained as the target equidistant depth offset; Calculate the target depth deviation value of each fragment in the 3D model based on the camera angle and the target isometric depth offset; In the 3D model fragment shader, depth offset is performed on the 3D model in the fragment shader according to a target depth deviation value of each fragment in the 3D model.

9. A spatial hierarchical rendering method for Internet three-dimensional maps according to any one of claims 3 or 8, characterized in that: The target depth deviation value of each fragment is calculated based on the camera angle and the isometric depth offset, including: In the vertex shader, the fragment vertex is converted to the world coordinate system through the preset model matrix to obtain the world coordinate of the fragment vertex; the world coordinate of the camera is subtracted from the world coordinate of the fragment vertex, and then the vector is normalized to obtain the direction vector from the fragment to the camera; After performing a dot product operation on the direction vector from the fragment to the camera and the normal vector of the fragment, the vector is inverted to obtain the initial depth deviation value of the current fragment affected by the camera angle. The isometric depth offset is passed into the fragment shader and multiplied by the initial depth deviation value of each fragment affected by the camera angle to obtain the target depth deviation value of each fragment due to the camera angle.

10. A spatial hierarchical rendering system for Internet three-dimensional maps, characterized in that: include: The layer sequence recording module is used to obtain various types of data in the Internet three-dimensional map scene, generate corresponding layers to be rendered, and record the priority order of each layer; The layers to be rendered include two-dimensional layers and three-dimensional models; The 2D layer depth offset module is used to perform spatial layer calculation for each 2D layer, calculate the target depth deviation value of each fragment in the 2D layer according to the camera position, and perform depth offset on each fragment of the 2D layer in the fragment shader; The 3D model depth offset module is used to perform spatial layer calculation on the 3D model, calculate the target depth deviation value of each fragment in the 3D model according to the camera position, and perform depth offset on each fragment of the 3D model in the fragment shader; The rendering module is used to call the drawing interface in sequence according to the priority order of the two-dimensional layer and the three-dimensional model, render the three-dimensional map scene onto the screen, and obtain the rendering result image.

Citation Information

Patent Citations

  • Water ripple rendering method, device and equipment and storage medium

    CN110866967A

  • Map data rendering method and device, electronic equipment and storage medium

    CN117788726A

  • A method, an apparatus and a computer program product for volumetric video coding

    WO2021260266A1