Three-dimensional map rendering method and device and device with storage function
By offsetting the object depth during the three-dimensional map rendering process, the interpolation problem during the rendering of different GIS data is solved, and the rendering effect is improved.
Patent Information
- Application Number
- CN202411315410.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-02-07
AI Technical Summary
When using different GIS data for three-dimensional map rendering, interspersed problems between rendered objects such as terrain and roads are prone to occur, which affects the rendering effect.
By acquiring the first spatial data and the second spatial data, one 3D rendering and a second 3D rendering are performed respectively, and the depth offset of the corresponding rendered objects is performed during at least one rendering process, increasing the depth difference between the objects to reduce the Interspersed questions.
Through the depth offset technology, the depth difference between objects rendered by different spatial data is improved, the interpolation problem between rendered objects is reduced, and the rendering effect of three-dimensional maps is improved.
Smart Images

Figure CN119399348A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a three-dimensional map rendering method, device and a device with storage function. Background Art
[0002] GIS (Geographic Information System) data includes raster data and vector data. Raster data is composed of some control points, each of which has a latitude and longitude coordinate and a height value. For example, terrain data is usually a set of control points with a fixed density, while vector data is usually some point, line, and surface data on a two-dimensional plane. The specific expression of point, line, and surface data is a series of point strings.
[0003] Raster data can be used to generate terrain, and two-dimensional vector data plus a terrain height value can be used to generate three-dimensional scenes (such as building outlines, roads, rivers, green belts, etc.). However, since the terrain rendering grid and the road rendering grid do not use the same data and are not related, there will be problems with terrain and road interlacing in some areas. Summary of the invention
[0004] The present application mainly provides a three-dimensional map rendering method, device and device with storage function, which can solve the problem of interlacing that is easily generated when different GIS data are used for rendering.
[0005] To solve the above technical problems, a technical solution adopted in the present application is: providing a three-dimensional map rendering method, including: obtaining first spatial data and second spatial data; using the first spatial data to perform a three-dimensional rendering to form a first three-dimensional map, the first three-dimensional map including a first object generated by the first spatial data; using the second spatial data to perform a second three-dimensional rendering on the first three-dimensional map to form a second three-dimensional map, the second three-dimensional map including the first object and the second object generated by the second spatial data; wherein, in the rendering process of at least one of the first three-dimensional rendering and the second three-dimensional rendering, the corresponding rendering object is depth offset to increase the depth difference between the first object and the second object.
[0006] To solve the above technical problems, another technical solution adopted in the present application is: to provide a three-dimensional map rendering device, comprising: a communication circuit and a processor connected to each other; the processor is used to obtain the first spatial data and the second spatial data through the communication circuit, and execute instructions to implement the rendering method as described above.
[0007] In order to solve the above technical problems, another technical solution adopted by the present application is: providing a device with a storage function, storing a program, and the program is executed to implement the three-dimensional map rendering method as described above.
[0008] The beneficial effect of the present application is that, different from the prior art, in an embodiment of the present application, by performing a depth offset on a corresponding rendered object in at least one rendering process of performing a three-dimensional rendering once using first spatial data and performing a second three-dimensional rendering on a first three-dimensional map using second spatial data, the depth difference between the first object and the second object is increased, so that a more appropriate depth difference can be obtained between objects rendered with different spatial data, thereby reducing the interlacing problem between rendered objects and improving the three-dimensional map rendering effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 It is a flowchart of the first embodiment of the method for rendering a three-dimensional map of the present application;
[0010] Figure 2 is a schematic diagram of a second three-dimensional map when the first object is a terrain and the second object is a road surface;
[0011] Figure 3 It is a flowchart of the second embodiment of the method for rendering a three-dimensional map of the present application;
[0012] Figure 4 is a schematic diagram of a second three-dimensional map when the first object is a road surface and the second object is a road marking;
[0013] Figure 5 It is a flowchart of a third embodiment of a method for rendering a three-dimensional map of the present application;
[0014] Figure 6 It is a flowchart of a fourth embodiment of a method for rendering a three-dimensional map of the present application;
[0015] Figure 7 It is a flowchart of a fifth embodiment of a method for rendering a three-dimensional map of the present application;
[0016] Figure 8 It is a flowchart of a sixth embodiment of a method for rendering a three-dimensional map of the present application;
[0017] Fig. 9 yes Figure 8 Specific flow diagram of step S1214;
[0018] Fig.10 yes Fig. 9 Specific flow diagram of step S1214a;
[0019] Fig.11 It is a flowchart of the seventh embodiment of the method for rendering a three-dimensional map of the present application;
[0020] Fig.12It is a schematic diagram of inserting compensation data points into a triangle to form a subdivided triangle;
[0021] Fig.13 It is a flowchart of an eighth embodiment of the method for rendering a three-dimensional map of the present application;
[0022] Fig.14 It is a structural schematic diagram of an embodiment of a rendering device for a three-dimensional map of the present application;
[0023] Fig.15 It is a structural diagram of an embodiment of a device with storage function of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only 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 without creative work are within the scope of protection of this application.
[0025] like Figure 1 As shown, the first embodiment of the method for rendering a three-dimensional map of the present application includes:
[0026] S11: Acquire first spatial data and second spatial data.
[0027] When GIS data is used to generate a three-dimensional map, the GIS data is generally divided into multiple layers (such as road surface layer, building outline layer, water layer, green belt layer, isolation belt layer, block surface layer, rail line layer, overpass / pedestrian passage layer, etc.), and each layer contains multiple copies of data. Each copy of data can represent a road, a building outline, a river, a forest or grassland, etc. according to its type. In this embodiment, the first spatial data and the second spatial data are different copies of GIS data for rendering different three-dimensional objects. The first spatial data and the second spatial data can be raster data, or they can be height coordinates in vector data and raster data.
[0028] S12: Perform a three-dimensional rendering using the first spatial data to form a first three-dimensional map, where the first three-dimensional map includes a first object generated by the first spatial data.
[0029] S13: Perform secondary three-dimensional rendering on the first three-dimensional map using the second spatial data to form a second three-dimensional map, wherein the second three-dimensional map includes the first object and a second object generated by the second spatial data; wherein, during the secondary three-dimensional rendering process, depth offset is performed on the second object to increase the depth difference between the first object and the second object.
[0030] Specifically, in an application example, the first spatial data is raster data for rendering terrain, and the second spatial data is vector data for rendering road surfaces and the height coordinates of the raster data, such as Figure 2 As shown, the first spatial data can be rendered to generate a first object 21 (such as a piece of grass), and the second spatial data can be rendered to generate a second object 22 (such as a road). During the rendering process, the first spatial data can be used to perform a three-dimensional rendering, such as performing triangular mesh processing, coloring processing, etc., so that a first three-dimensional map can be formed, and the first three-dimensional map includes the first object 21. Then, based on the first three-dimensional map, the second spatial data is used to perform a secondary three-dimensional rendering, and the rendering process is similar to the primary three-dimensional rendering, and the second object 22 can be generated on the first three-dimensional map, thereby forming the second three-dimensional map. During the secondary rendering process, the second object 22 can be subjected to a depth offset process. For example, when the second object 22 is a road surface and the first object 21 is a terrain, the depth of the second object 22 can be reduced, so that the depth difference between the first object 21 and the second object 22 generated after rendering increases, so that the depth of the second object 22 (road surface) is less than the depth of the first object 21 (terrain), and the road surface can be covered on the terrain surface, avoiding the problem of interlacing between rendered objects and improving the rendering effect of the three-dimensional map.
[0031] In this embodiment, after performing the secondary three-dimensional rendering, the second three-dimensional map can also be displayed on a display device to view the rendering effect. If the rendering effect is not good, the depth offset can be continued to be performed to further adjust the depth of the second object so that the depth difference between the first object and the second object is further increased to improve the rendering effect. Of course, the first three-dimensional map can also be displayed.
[0032] Of course, in other embodiments, the depth offset may also be performed on the first object during a three-dimensional rendering process.
[0033] Specific as Figure 3 As shown, the second embodiment of the method for rendering a three-dimensional map of the present application includes:
[0034] S21: Acquire first spatial data and second spatial data.
[0035] S22: Performing a three-dimensional rendering using the first spatial data to form a first three-dimensional map, where the first three-dimensional map includes a first object generated by the first spatial data; wherein, during the three-dimensional rendering process, depth offset is performed on the first object.
[0036] S23: Perform secondary three-dimensional rendering on the first three-dimensional map using the second spatial data to form a second three-dimensional map, wherein the second three-dimensional map includes the first object and the second object generated by the second spatial data.
[0037] This embodiment is similar to the first embodiment of the rendering method of the three-dimensional map of the present application, and the similarities are not repeated here. The difference is that this embodiment does not perform depth offset on the second object in the secondary three-dimensional rendering process, but performs depth offset on the first object in the primary three-dimensional rendering process, thereby increasing the depth difference between the first object and the second object.
[0038] Specifically, in an application example, the first spatial data is the height coordinates of the first vector data for rendering the road surface and the raster data for rendering the terrain, and the second spatial data is the second vector data for rendering the road marking and the raster data for rendering the terrain, and the first vector data is different from the second vector data. Figure 4 As shown, the first spatial data can be rendered to generate a first object 31 (such as a road), and the second spatial data can be rendered to generate a second object 32 (such as a marking on the road). During the rendering process, the first spatial data can be used to perform a three-dimensional rendering, such as performing a triangular mesh processing, a coloring processing, etc., so that a first three-dimensional map can be formed, and the first three-dimensional map includes the first object 31. Then, based on the first three-dimensional map, the second spatial data is used to perform a secondary three-dimensional rendering, and the rendering process is similar to the primary three-dimensional rendering, and the second object 32 can be generated on the first three-dimensional map, thereby forming the second three-dimensional map. During the primary rendering process, the first object 31 can be subjected to a depth offset process. For example, when the first object 31 is a road surface and the second object 32 is a road marking, the depth of the first object 31 can be increased, so that the depth difference between the first object 31 and the second object 32 generated after rendering increases, so that the depth of the second object 32 (road marking) is less than the depth of the first object 31 (road surface), and the road marking can be covered on the surface of the road surface, avoiding the problem of interlacing between the rendered objects and improving the rendering effect of the three-dimensional map.
[0039] In this embodiment, after performing the secondary three-dimensional rendering, the second three-dimensional map can also be displayed using a display device to view the rendering effect. If the rendering effect is not good, the depth offset can be continued to be performed as above to further adjust the depth of the first object so that the depth difference between the first object and the second object is further increased to improve the rendering effect. Of course, the first three-dimensional map can also be displayed.
[0040] Of course, in other embodiments, the depth offset may be performed on the first object and the second object during the first 3D rendering and the second 3D rendering, respectively.
[0041] Specific as Figure 5 As shown, the third embodiment of the method for rendering a three-dimensional map of the present application includes:
[0042] S31: Acquire first spatial data and second spatial data.
[0043] S32: Perform a three-dimensional rendering using the first spatial data to form a first three-dimensional map, where the first three-dimensional map includes a first object generated by the first spatial data; wherein, during the three-dimensional rendering, depth offset is performed on the first object.
[0044] S33: Perform secondary three-dimensional rendering on the first three-dimensional map using the second spatial data to form a second three-dimensional map, wherein the second three-dimensional map includes the first object and a second object generated by the second spatial data; wherein, during the secondary three-dimensional rendering process, depth offset is performed on the second object.
[0045] This embodiment is similar to the first embodiment of the rendering method of the three-dimensional map of the present application, and the similarities are not repeated here. The difference is that this embodiment performs depth offset on the first object and the second object in the first three-dimensional rendering process and the second three-dimensional rendering, respectively, thereby increasing the depth difference between the first object and the second object.
[0046] Specifically, in one application example, combined with Figure 2 As shown, when the first object 21 is terrain and the second object 22 is a road surface, when the depth offset is performed on the first object 21, the depth of the first object 21 can be increased, and when the depth offset is performed on the second object 22, the depth of the second object 22 can be reduced, so that the depth difference between the first object 21 and the second object 22 generated after rendering increases, so that the depth of the second object 22 (road surface) is less than the depth of the first object 21 (terrain), and the road surface can be covered on the terrain surface to avoid the problem of interlacing between rendered objects and improve the three-dimensional map rendering effect. Of course, in other application examples, when performing depth offset, the depth of the first object and the second object can also be increased or decreased at the same time. By using an appropriate depth offset, the depth difference between the first object and the second object can be increased, so that a more appropriate depth difference can be obtained between objects rendered from different spatial data, thereby reducing the problem of interlacing between rendered objects and improving the three-dimensional map rendering effect.
[0047] In this embodiment, after performing the secondary three-dimensional rendering, the second three-dimensional map can also be displayed using a display device to view the rendering effect. If the rendering effect is not good, the depth offset can be continued to be performed as above to further adjust the depth of the first object and the second object so that the depth difference between the first object and the second object is further increased to improve the rendering effect. Of course, the first three-dimensional map can also be displayed.
[0048] like Figure 6As shown, the fourth embodiment of the method for rendering a three-dimensional map of the present application is based on the first embodiment of the method for rendering a three-dimensional map of the present application, and further defines step S12 to include:
[0049] S121: Obtain an initial depth value corresponding to the object to be offset and rendered.
[0050] The initial depth value is calculated based on the spatial data of the object to be offset and rendered.
[0051] Specifically, in an application example, when the object to be offset and rendered is a second object, the data points in the second spatial data can be converted from the local coordinate system to data points in the camera coordinate system, so that the distance between each data point and the origin can be obtained, and the initial depth value of each data point can be obtained. The set of initial depth values of each data point is the initial depth value of the second object.
[0052] S122: Setting the depth offset value.
[0053] The depth offset value can be positive or negative, and is set according to the object to be rendered.
[0054] S123: superimposing the depth offset value on the basis of the initial depth value.
[0055] Specifically, in an application example, when the first object is terrain and the second object is a road surface, and the second object needs to be depth offset, the initial depth value of the second object can be calculated using the second spatial data, and then the depth offset value can be set. At this time, the depth offset value can be set to a negative value (such as -2), and finally the depth offset value is superimposed on the initial depth value to obtain the final depth value of the second object. Through the depth offset, the depth difference between the first object and the second object can be increased, thereby reducing the interlacing problem between the rendered objects and improving the rendering effect.
[0056] Of course, in the above application example, when the depth offset is required for the first object, the depth offset value can be set to a positive value (such as +3), which can also increase the depth difference between the first object and the second object.
[0057] This embodiment can also be applied to the depth offset of the second or third embodiment of the three-dimensional map rendering method of the present application.
[0058] like Figure 7 As shown, the fifth embodiment of the method for rendering a three-dimensional map of the present application is based on the fourth embodiment of the method for rendering a three-dimensional map of the present application, and further defines that step S122 may include:
[0059] S1221: Obtain standard offset, standard offset coefficient and variable offset.
[0060] The standard offset and the standard offset coefficient are preset, and the variable offset is calculated based on the spatial data corresponding to the object to be offset and rendered.
[0061] S1222: Calculate the depth offset value using the following formula (1):
[0062] Offset=m*SDEPTH+DEPTHBIAS (1)
[0063] Among them, Offset is the depth offset value, m is the variable offset, DEPTHBIAS is the standard offset, and SDEPTH is the standard offset coefficient.
[0064] Specifically, in an application example, the standard offset and the standard offset coefficient can be parameters pre-set by the user, or automatically set by the rendering device. Of course, the standard offset and the standard offset coefficient can be adjusted according to the effect after rendering. For example, when the first object is a terrain and the second object is a road surface, when the second object is depth-shifted, the standard offset DEPTHBIAS can be set to -0.005, the standard offset coefficient SDEPTH can be set to -2, the variable offset m can be calculated based on the second spatial data corresponding to the second object, and the variable offset m is not less than zero, and then the depth offset value corresponding to the second object can be calculated using formula (1). Since the depth offset value is less than zero, the depth value of the second object can be reduced, thereby increasing the depth difference between the first object and the second object, reducing the problem of interlacing between the rendered first object and the second object, and improving the rendering effect.
[0065] Of course, in other application examples, the standard offset and the standard offset coefficient may also be set to positive values, which are specifically set according to the object to be rendered.
[0066] like Figure 8 As shown, the sixth embodiment of the method for rendering a three-dimensional map of the present application is based on the fifth embodiment of the method for rendering a three-dimensional map of the present application, and further defines step S121 to include:
[0067] S1211: Acquire multiple data points using the spatial data corresponding to the object to be offset and rendered.
[0068] The object to be rendered can be the first object or the second object. Figure 2 When the object to be offset is the second object (such as the terrain shown in FIG. 1 ), the corresponding first spatial data is raster data, including multiple data points, each of which includes a latitude and longitude coordinate and a height coordinate. Figure 2When the road surface is shown, the corresponding second spatial data is the height coordinates of the two-dimensional vector data and the raster data of the rendered terrain, the vector data includes multiple data points, and each data point includes a longitude and latitude coordinate.
[0069] S1212: Perform triangulation processing on the multiple data points to generate a triangular mesh.
[0070] S1213: Obtain an initial depth value within the area defined by each triangle of the triangular mesh.
[0071] Specifically, in an application example, the object to be offset and rendered is a first object (eg Figure 2 The first spatial data corresponding to the first spatial data is raster data, including multiple data points, each of which includes a latitude and longitude coordinate and a height coordinate. When the multiple data points are triangulated, adjacent data points can be connected, three adjacent data points can form a triangle, and multiple connected triangles can generate a triangular mesh in a three-dimensional space.
[0072] The vertex data of each triangle of the triangular mesh is converted from the local coordinate system to the vertex data of the world coordinate system, and the average of the distances between the three vertex data and the origin can be used as the initial depth value of the triangular area. Of course, data points can also be inserted into the triangular area, and the average of the depth values of the inserted data points can be used as the initial depth value of the triangular area, or the depth values of the inserted data points can be weighted and calculated to obtain the initial depth value of the triangular area.
[0073] Optionally, step S1221 may include:
[0074] S1214: Calculate the variable offset corresponding to the triangle according to the coordinates of the vertices of the triangle.
[0075] Optionally, in the above application example, the vertex coordinates of the triangle can be converted into vertex coordinates in the camera coordinate system, and then rasterization is performed on the triangle surrounded by the vertex coordinates, so as to form multiple fragments inside. Each fragment can be regarded as a data point, and each data point has three coordinate values of the x-axis, y-axis and z-axis. Then, the variable offset corresponding to the triangle can be calculated according to the following formula (2):
[0076]
[0077] Among them, m is the variable offset, Δz is the difference between the z-axis coordinate values of two adjacent data points, Δx is the difference between the x-axis coordinate values of two adjacent data points, Δy is the difference between the y-axis coordinate values of two adjacent data points, max(.) is the maximum value, and |.| is the absolute value.
[0078] Specifically, Fig. 9 As shown, step S1214 may include:
[0079] S1214a: Obtain the x-axis coordinate, y-axis coordinate and z-axis coordinate of each vertex of the triangle in a specific coordinate system, wherein the x-axis coordinate and the z-axis coordinate are obtained by the latitude and longitude coordinates in the spatial data corresponding to the object to be offset and rendered, and the y-axis coordinate is obtained by the height coordinate in the spatial data corresponding to the object to be offset and rendered.
[0080] The specific coordinate system may be a camera coordinate system, an orthogonal coordinate system after the camera coordinate system is projected, or a world coordinate system.
[0081] Alternatively, if Fig.10 As shown, step S1214a may include:
[0082] S12141: Convert the longitude and latitude coordinates in the spatial data corresponding to the object to be offset and rendered into coordinates in the Mercator coordinate system, and then convert the coordinates in the Mercator coordinate system into coordinate values corresponding to the x-axis and the z-axis in the world coordinate system.
[0083] S12142: Convert the height coordinate in the spatial data corresponding to the object to be offset and rendered into the coordinate value corresponding to the y-axis in the world coordinate system.
[0084] Since the spatial data (GIS data) corresponding to the object to be offset and rendered is usually longitude and latitude data and / or altitude coordinates, rather than the coordinate system required for rendering (such as the world coordinate system or the camera coordinate system), it is usually necessary to convert the spatial data, such as longitude and latitude data and / or altitude coordinates, into the world coordinate system during the rendering process.
[0085] Specifically, in an application example, when the spatial data corresponding to the object to be offset and rendered is raster data, and the specific coordinate system is the world coordinate system, the raster data includes longitude and latitude data and altitude coordinates. The longitude and latitude coordinates can be converted into coordinates in the Mercator coordinate system, and then the coordinates in the Mercator coordinate system can be converted into coordinate values corresponding to the x-axis and z-axis in the world coordinate system, and then the altitude coordinate can be converted into coordinate values corresponding to the y-axis in the world coordinate system, so that the coordinate value of the spatial data corresponding to the object to be offset and rendered in the world coordinate system can be obtained.
[0086] Of course, in other application examples, when the specific coordinate system is a camera coordinate system, the coordinate values in the world coordinate system can be converted into coordinate values in the camera coordinate system through coordinate conversion.
[0087] S1214b: Rasterize the triangle to obtain multiple fragments inside the triangle, each fragment having x-axis, y-axis, and z-axis coordinates.
[0088] Each rasterized fragment can be regarded as a pixel or a data point, and each data point has x-axis, y-axis, and z-axis coordinates in the specific coordinate system.
[0089] S1214c: Calculate a first ratio between the absolute value of the z-axis coordinate difference and the absolute value of the x-axis coordinate difference between each fragment and the adjacent fragment in the same triangle, and a second ratio between the absolute value of the z-axis coordinate difference and the absolute value of the y-axis coordinate difference.
[0090] S1214d: Select a maximum value from the calculated first ratio and the calculated second ratio as the variable offset.
[0091] Specifically, the first ratio is |Δz / Δx| in the above formula (2), and the second ratio is |Δz / Δy| in the above formula (2). After calculating the first ratio and the second ratio of each fragment to the adjacent fragment in the same triangle, the largest value can be selected as the variable offset.
[0092] In other embodiments, in order to further improve the rendering effect, an appropriate grid density may be set.
[0093] Specific as Fig.11 As shown, the seventh embodiment of the method for rendering a three-dimensional map of the present application is based on the sixth embodiment of the method for rendering a three-dimensional map of the present application, and further defines step S1212 to include:
[0094] S1212a: Obtain grid density.
[0095] The mesh density is a preset threshold value for limiting the maximum side length of a triangle. The maximum side length of each triangle in the triangular mesh after triangulation cannot be greater than the mesh density. The mesh density can be set according to the requirements of the rendering effect, and is usually a positive value, for example, it can be set to 5.
[0096] S1212b: Initial data points directly obtained by using the spatial data corresponding to the object to be offset and rendered are connected in pairs as vertices to form an initial triangular mesh.
[0097] The initial data point is a data point included in the spatial data corresponding to the object to be offset and rendered, or may be a data point obtained after corresponding processing (such as coordinate conversion) is performed on the data point included in the spatial data.
[0098] S1212c: Using the initial data points to obtain supplementary data points by interpolation, the supplementary data points are connected with adjacent initial data points to further divide the initial triangular mesh into subdivided triangular meshes, so that any side length of each triangle in the subdivided triangular mesh is less than the mesh density.
[0099] Specifically, in an application example, the mesh density is set to 5. When the initial triangular mesh formed by connecting the initial data points in pairs has a side length greater than 5, Fig.12 As shown, a supplementary data point 301 can be inserted into the triangle 30 by interpolation, and then the supplementary data point 301 is connected with the adjacent initial data point 302 (302a, 302b, 302c), so that the triangle can be subdivided into multiple subdivided triangles, thereby obtaining a subdivided triangular mesh, in which any side length of each triangle of the subdivided triangular mesh is less than the mesh density. The above-mentioned mesh subdivision process can also be performed multiple times, and the supplementary data point can be used as the initial data point in the next subdivision until any side length of each triangle of the subdivided triangular mesh is less than the mesh density. The above-mentioned process of generating a mesh can be implemented using CGAL (Computational Geometry Algorithms Library).
[0100] In this embodiment, after setting an appropriate grid density and performing depth offset on the first object and / or the second object, the interlacing problem of the first object and the second object can be avoided in the second three-dimensional map generated after three-dimensional rendering, thereby improving the rendering effect of the three-dimensional map.
[0101] like Fig.13 As shown, the eighth embodiment of the method for rendering a three-dimensional map of the present application is based on the first embodiment of the method for rendering a three-dimensional map of the present application, and further defines step S11 to include:
[0102] S111: Acquire a first spatial data file and a second spatial data file.
[0103] S112: Parse the first spatial data file and the second spatial data file to obtain first spatial data and second spatial data.
[0104] Among them, the first spatial data file and the second spatial data file can be the same file type or different file types. When the first spatial data is raster data, the first spatial data file is a TIF (Tagged Image File Format) file, and when the second spatial data is vector data, the second spatial data file is a JSON (JavaScript Object Notation, a lightweight data exchange format based on JavaScript language) file. At this time, GDAL (Geospatial Data Abstraction Library) can be used to parse the TIF file and the JSON file. Of course, other methods can also be used to parse the file, or different methods can be used to parse the two files.
[0105] This embodiment can also be applied to the second or third embodiment of the three-dimensional map rendering method of the present application.
[0106] like Fig.14 As shown, an embodiment of a three-dimensional map rendering device of the present application includes: a communication circuit 110 and a processor 120 connected to each other.
[0107] The communication circuit 110 is used to send and receive data and serves as an interface for the three-dimensional map rendering device to communicate with other devices.
[0108] Specifically, the communication circuit 110 may be used to acquire the first spatial data and the second spatial data.
[0109] The processor 120 can control the operation of the rendering device of the three-dimensional map. The processor 120 can be called a central processing unit (CPU). The processor 120 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or any other programmable logic device, discrete gate, transistor logic device or discrete hardware element. The general-purpose processor can be a microprocessor or any conventional processor.
[0110] The three-dimensional map rendering device may further include a memory (not shown) for storing commands and data required for the operation of the processor 120. The memory may also store data received by the communication circuit 110.
[0111] The processor 120 is used to obtain the first spatial data and the second spatial data through the communication circuit, and execute instructions to implement the rendering method provided by any one of the first to eighth embodiments of the three-dimensional map rendering method of the present application or a non-conflicting combination thereof.
[0112] Optionally, in this embodiment, the three-dimensional map rendering device may further include a display component 130 connected to the processor 120 and configured to display the first three-dimensional map and / or the second three-dimensional map.
[0113] The display component 130 may be a display, including a liquid crystal display, an organic light emitting display, a plasma display, or other display devices, or may be other devices integrated with a display panel, such as a mobile phone.
[0114] In this embodiment, the rendering device of the three-dimensional map performs depth offset on the corresponding rendering object in at least one rendering process of performing a three-dimensional rendering using first spatial data and performing a second three-dimensional rendering on the first three-dimensional map using second spatial data to increase the depth difference between the first object and the second object, so that a more appropriate depth difference can be obtained between the objects rendered by different spatial data, thereby reducing the interlacing problem between the rendering objects and improving the three-dimensional map rendering effect.
[0115] like Fig.15 As shown, in one embodiment of the device with storage function of the present application, a program 220 is stored, and the program 220 is executed to implement the rendering method provided by any one of the first to eighth embodiments of the rendering method of the three-dimensional map of the present application or a non-conflicting combination thereof.
[0116] The device with storage function may be a portable storage medium such as a USB flash drive or a CD, or may be a mobile phone, a computer, a server, or an independent component that can be integrated into the above devices, such as a processing / storage chip.
[0117] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for rendering a three-dimensional map, characterized in that: include: Acquire first spatial data and second spatial data; Performing a three-dimensional rendering using the first spatial data to form a first three-dimensional map, wherein the first three-dimensional map includes a first object generated by the first spatial data; Performing secondary three-dimensional rendering on the first three-dimensional map using the second spatial data to form a second three-dimensional map, wherein the second three-dimensional map includes the first object and a second object generated by the second spatial data; In the rendering process of at least one of the first 3D rendering and the second 3D rendering, a depth offset is performed on the corresponding rendering object to increase the depth difference between the first object and the second object.
2. The rendering method according to claim 1, characterized in that: One of the first spatial data and the second spatial data is raster data, and the other is vector data and height coordinates in the raster data, or one of the first spatial data and the second spatial data is first vector data and height coordinates in raster data, and the other is second vector data and height coordinates in the raster data, wherein the first vector data is different from the second vector data.
3. The rendering method according to claim 1, characterized in that: The step of performing depth offset on the corresponding rendering object during at least one of the first 3D rendering and the second 3D rendering comprises: Get the initial depth value corresponding to the object to be offset; Set the depth offset value; The depth offset value is superimposed on the initial depth value.
4. The rendering method according to claim 3, characterized in that: The setting of the depth offset value comprises: Get standard offset, standard offset coefficient and variable offset; The depth offset value is calculated using the following formula: Offset=m*SDEPTH+DEPTHBIAS; Wherein, Offset is the depth offset value, m is the variable offset, DEPTHBIAS is the standard offset, and SDEPTH is the standard offset coefficient; The standard offset and the standard offset coefficient are preset, and the variable offset is calculated based on the spatial data corresponding to the object to be offset and rendered.
5. The rendering method according to claim 4, characterized in that: The step of obtaining the initial depth value corresponding to the object to be offset and rendered comprises: Acquire a plurality of data points using the spatial data corresponding to the object to be offset and rendered; Performing triangulation processing on the plurality of data points to generate a triangular mesh; The initial depth value within the area defined by each triangle of the triangular mesh is obtained.
6. The rendering method according to claim 5, characterized in that: The step of obtaining the standard offset, the standard offset coefficient and the variable offset comprises: The variable offset corresponding to the triangle is calculated according to the coordinates of the vertices of the triangle.
7. The rendering method according to claim 6, characterized in that: The step of calculating the variable offset corresponding to the triangle according to the coordinates of the vertices of the triangle comprises: Obtaining an x-axis coordinate, a y-axis coordinate, and a z-axis coordinate of each vertex of the triangle in a specific coordinate system, wherein the x-axis coordinate and the z-axis coordinate are obtained from the longitude and latitude coordinates in the spatial data corresponding to the object to be offset, and the y-axis coordinate is obtained from the height coordinate in the spatial data corresponding to the object to be offset; Performing rasterization processing on the triangle to obtain a plurality of fragments inside the triangle, each of the fragments having x-axis, y-axis and z-axis coordinates; Calculate a first ratio between the absolute value of the difference between the z-axis coordinates of each fragment and the adjacent fragment in the same triangle and the absolute value of the difference between the x-axis coordinates, and a second ratio between the absolute value of the difference between the z-axis coordinates and the absolute value of the difference between the y-axis coordinates; A maximum value is selected from the first ratio and the second ratio obtained by calculation as the variable offset.
8. The rendering method according to claim 5, characterized in that: The step of triangulating the plurality of data points to generate a triangular mesh comprises: Get the mesh density; Initial data points directly obtained by using the spatial data corresponding to the object to be offset are connected in pairs as vertices to form an initial triangular mesh; Supplementary data points are obtained by interpolation using the initial data points, and the supplementary data points are connected to adjacent initial data points to further divide the initial triangular mesh into subdivided triangular meshes, so that any side length of each triangle in the subdivided triangular mesh is less than the mesh density.
9. A three-dimensional map rendering device, characterized in that: include: Interconnected communications circuits and processors; The processor is used to obtain the first spatial data and the second spatial data through the communication circuit, and execute instructions to implement the rendering method according to any one of claims 1 to 8.
10. A device with a storage function, storing a program, characterized in that: The program is executed to implement the three-dimensional map rendering method as described in any one of claims 1-8.