A method for constructing spatial index of oblique photography considering fast rendering on the Web

By optimizing the internal structure of the 3D model and building an efficient spatial index, the problem of slow loading of massive oblique photography models is solved, achieving fast rendering and improving user experience.

CN115330933BActive Publication Date: 2024-10-01CHANGJIANG SPATIAL INFORMATION TECH ENG CO LTD (WUHAN)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210906832.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-29
Publication Date
2024-10-01
Estimated Expiration
2042-07-29

AI Technical Summary

Technical Problem

The existing technology has problems of slow speed, delay, and lag when loading and parsing massive and fine oblique photography 3D models. This is mainly due to the slow loading of the top-level tile model and the complicated parsing of tile hierarchical relationships, which affects the user experience.

Method used

By optimizing the internal structure of the 3D model, including the compression and merging of texture images, and converting the top-level tile model into a point cloud model, and separating the model from the index, an efficient spatial index is constructed to improve model loading and parsing speeds.

Benefits of technology

Significantly improves the loading speed and user experience of 3D models, reducing data redundancy and resource waste. Especially in large-scale and multi-tile oblique photography scenes, the loading speed is reduced from several minutes to a few seconds, and the response speed is significantly improved. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115330933B_ABST
    Figure CN115330933B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for constructing an oblique photography spatial index taking into account fast rendering on the Web side. It includes the following steps: step one: optimizing the internal structure of a real-scene three-dimensional model and simplifying the internal data structure of the model; the optimization of the internal structure of the real-scene three-dimensional model includes optimizing the internal texture image of the model and merging geometric bodies; step two: converting the top-level tile model of the real-scene three-dimensional into a point cloud model to improve the loading speed of the top-level data of the real-scene three-dimensional; step three: optimizing the spatial index of the real-scene three-dimensional model, constructing an efficient spatial index, and obtaining a new oblique photography three-dimensional model. The present invention overcomes the defects of the existing slow loading and parsing speed of Web three-dimensional data; it has the advantages of improving the loading speed of the top-level tiles of the real-scene three-dimensional, shortening the time consumed by the three-dimensional rendering engine to parse the data structure of the real-scene three-dimensional model, improving the loading speed of the three-dimensional scene, and improving the user experience of three-dimensional WebGL rendering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of real-scene three-dimensional technology, and more specifically to a method for constructing an oblique photography spatial index taking into account fast rendering on a Web side. Background Art

[0002] Oblique photography technology is a high-tech technology developed in the international surveying and mapping field in recent years. It overturns the previous limitation that orthophotos can only be taken from a vertical angle. By carrying multiple sensors on the same flying platform, it simultaneously collects images from five different angles, including one vertical, four oblique angles, etc., bringing users into a real three-dimensional world that is more in line with human vision.

[0003] With the rapid development of oblique photography technology and the in-depth application of photogrammetry, the collected real-life 3D models are becoming more and more sophisticated and the scope is becoming wider. However, after the top-level models of the relevant preprocessing programs are merged, the internal data structure of the obtained 3D model is messy. When the 3D rendering engine parses this kind of real-life 3D model data structure, there is a problem of long time consumption, resulting in slow loading of the 3D scene and poor user experience.

[0004] In B / S-side 3D applications, 3D model data needs to be transmitted over the network in advance, and then parsed and visualized. For massive and detailed tilt data, in a B / S application environment, problems such as data delay, freeze, and poor interactive response experience will be further amplified. The key causes of these problems are mainly the following two aspects:

[0005] (1) The top-level tile model of the real 3D scene is loaded slowly. The 3D WebGL engine loads the real 3D data from the top level of the pyramid. When the window is switched back and forth and the scale is frequently scaled, the previous model in the window needs to be released and the level needs to be recalculated and loaded from the top level of the pyramid, which affects the loading of the entire 3D scene.

[0006] (2) The tile hierarchy parsing of real-world 3D is complex. Taking the mainstream tilt data format OSGB as an example, the tile hierarchy is stored in the LOD inside the real-world 3D model. All models need to be parsed before the model pyramid can be constructed. For massive real-world 3D data, there are many model files, which further affects the speed of model index parsing.

[0007] Therefore, it is necessary to develop a method for constructing and rendering an oblique photography model spatial index that can improve the loading speed of the top tile model of the real scene 3D and improve the speed of parsing the real scene 3D model data structure by model index. Summary of the invention

[0008] The purpose of the present invention is to provide a method for constructing an oblique photography spatial index taking into account fast rendering on the Web side, optimize the model structure of real-scene 3D data, improve the loading speed of the top-level tiles of the real-scene 3D, separate the 3D model from the index, construct an efficient spatial index that is easier to parse, shorten the time consumed by the 3D rendering engine to parse the real-scene 3D model data structure, improve the loading speed of the 3D scene, and improve the user experience of 3D WebGL rendering; solve the problem of slow loading and parsing of Web 3D data.

[0009] In order to achieve the above object, the technical solution of the present invention is: a method for constructing an oblique photography spatial index taking into account fast rendering on the Web side, characterized in that it comprises the following steps:

[0010] Step 1: Optimize the internal structure of the real-life 3D model and simplify the internal data structure of the model;

[0011] The optimization of the internal structure of the real-scene 3D model includes the optimization of the texture image inside the model and the merging of geometric bodies; the merged texture image and geometric body are stored in the real-scene 3D model file; after the top-level model is merged by the relevant preprocessing program, the present invention reconstructs the original pyramid tile model with a small radius and a large number into a new pyramid tile model with a large radius and a large number, but there are hundreds or thousands of geometric bodies and texture images associated with the geometric bodies inside the top-level tile model, and the WebGL engine has a large pressure and takes a long time to parse these models; now all the geometric bodies inside the tile model are merged into one geometric body, and multiple texture images associated with the geometric body are compressed and merged into one texture image, so that the WebGL engine can parse the model quickly and occupy less resources, thereby improving the loading speed of the 3D model;

[0012] Step 2: Convert the top-level tile model of the real 3D scene into a point cloud model to improve the loading speed of the top-level data of the real 3D scene;

[0013] The point cloud model only has vertex sequences and color sequences corresponding to each vertex, but no geometry or texture. Therefore, the loading speed of the point cloud model is much faster than that of the 3D model. Because the first few layers of the model pyramid have a large range, many triangular faces, and fuzzy texture images, when viewing the scene from a distance, only the outline of the entire scene needs to be displayed in the window. Therefore, converting to a point cloud model does not affect the accuracy of the scene, but it can greatly improve the loading of the 3D model. When the window is switched back and forth, the first few layers of the model pyramid are frequently called, and the rendering engine can also respond quickly, thereby improving the loading speed of the 3D model.

[0014] Step 3: Optimize the spatial index of the real-scene 3D model, build an efficient spatial index, and obtain a new oblique photography 3D model;

[0015] The present invention separates the model from the index, and improves the rapid parsing of the model information; the model space index is divided into two parts: the model top-level space index and the model fine-level space index; the model top-level space index includes the model data of the first several layers of the model pyramid, and has a small amount of internal data and a simple structure, so that the WebGL engine can quickly parse it. After the top-level space index is loaded, it will be cached in the WebGL engine, thereby avoiding the waste of resources caused by frequent calls when the window is switched back and forth; the model fine-level space index only includes all the model information after a branch in the model pyramid, and has a small number of internal models. When the window is positioned at the fine level, the WebGL engine only needs to load and parse the fine-level space index to obtain the model information, and does not need to parse the space index that is not in the window, thereby reducing data redundancy, improving the parsing speed of the space index, and thus improving the loading speed of the entire three-dimensional model.

[0016] In the above technical solution, in step 1, the optimization of the texture image inside the real scene 3D model includes reading and compressing the texture image, compressing and merging all the texture images inside the real scene 3D model into one texture, including the following sub-steps:

[0017] Step 1.1.1: Read and compress the texture image, and create the image merging structure tagMergeImage;

[0018] Step 1.1.2: Merge multiple texture images in the real 3D model into one texture.

[0019] In the above technical solution, the image merging structure tagMergeImage includes an image buffer area ImageBuffer, an image width ImageWidth, an image height ImageHeight, and an offset ImageOffset after the image is merged. The offset includes an X-direction starting position x_start, a Y-direction starting position y_start, an X-direction length x_rangle, and a Y-direction length y_rangle. For the image merging structure tagMergeImage, an image merging container vecMergeImage is created, including the following sub-steps:

[0020] Step 1.1.1.1: Read texture images, use the OpenSceneGraph graphics library to obtain all texture images inside the model;

[0021] Step 1.1.1.2: Compress the texture image and push it into the image merging container. Use the open source library FreeImage to convert the acquired texture image into a JPEG format image and obtain the width and height of the image. Create an image merging structure object, store the image converted into JPEG format into the ImageBuffer of the object, and assign the width and height of the image to the ImageWidth and ImageHeight of the object.

[0022] In the above technical solution, in step 1.1.2, the method for merging multiple texture images in a real-life three-dimensional model into one texture mainly includes sorting images in an image merging container, obtaining the size of a target image, inserting images using an insertion splitting method, calculating the offset of the image in the container inserted into the target image, recalculating the width and height of the merged image, saving the image in the container in the target image according to the offset, and recalculating the offset of each image in the container.

[0023] In the above technical solution, the insertion splitting method is used to insert the image. The specific insertion process includes the following steps:

[0024] Step 1.1.2.3.1: Extract texture images (curImageWidth, curImageHeight) from the sorted image merge container vecMergeImage in sequence;

[0025] Step 1.1.2.3.2: Calculate the offset of the texture image inserted into the target image. When the texture image is inserted into the first texture image of the nLevel layer, where nLevel is an integer starting from 0, the image (i.e. the texture image to be inserted) is inserted into the upper left corner of the layer (i.e. the nLevel layer). Therefore, the offset of the image (i.e. the texture image to be inserted) is (0, LevelHeight*nLevel, curImageWidth, curImageHeight). The offset of the image (i.e. the texture image to be inserted) is assigned to the offset of the texture image object. Due to the insertion of the texture image, the layer (i.e. the nLevel layer) is divided into two pieces, one of which is the right area of ​​the image (i.e. the texture image just inserted) (curImageWidth, LevelHeight*nLevel, max_width-curImageWidth, LevelHeight).

[0026] The other piece is the lower area of ​​the image (i.e. the texture image just inserted) (0, LevelHeight*nLevel+curImageHeight, curImageWidth, LevelHeight-curImageHeight). Insert these two pieces into the vecFreePlace container in ascending order of free width.

[0027] Step 1.1.2.3.3: When inserting another texture image (i.e. inserting the second texture image), judge one by one according to the width curImageWidth and height curImageHeight of the current image and each node (x_start_free, y_start_free, free_width, free_height) in the free container vecFreePlace.

[0028] When curImageWidth<=free_width and curImageHeight<=free_height (the condition is to compare the width and height to determine whether the free area in the free container has enough space to accommodate the texture image to be inserted), the image (i.e. the second texture image to be inserted) is inserted into the free area (i.e. the free area that meets the conditions). The offset calculation method of the image (i.e. the second texture image to be inserted) is (x_start_free, y_start_free, curImageWidth, curImageHeight), and the free area (i.e. the free area that meets the conditions) is The free area is deleted from the free container, and the two pieces obtained by the split (i.e., the right piece and the lower piece) are inserted into the free container vecFreePlace in ascending order of width;

[0029] When curImageWidth<=free_width and curImageHeight<=free_height are judged, no free area is found in the container, then the image (i.e., the second texture image to be inserted) is inserted into the next layer, nLevel=nLevel+1, and the process goes to step 1.1.2.3.2;

[0030] Step 1.1.2.3.4: Recalculate the width (newImageWidth) and height (newImageHeight) of the merged image. Obtain the offset of each texture image in the merged image through step 1.1.2.3.3. The width (newImageHeight) is calculated by taking the maximum value of the offset x_start+x_rangle from the image merge container. The height (newImageHeight) is calculated by taking the maximum value of the offset y_start+y_rangle from the image merge container.

[0031] Step 1.1.2.3.5: Save the texture image in the free container in the target image according to the offset, including creating the target image, inserting the image in the image merging container into the target image and saving the target image;.

[0032] Step 1.1.2.3.6: Recalculate the offset of each image in the image container. The offset values ​​x_start, y_start, x_rangle and y_rangle of the image in the image merging container are calculated relative to the ratio of the entire image. The calculation formula is: x_start = x_start*1.0 / newImageWidth, y_start = y_start*1.0 / newImageHeight, x_rangle = x_rangle*1.0 / newImageWidth, y_rangle = y_rangle*1.0 / newImageHeight.

[0033] In the above technical solution, in step 1.1.2.3.5, the texture image in the free container is saved in the target image according to the offset. The specific method includes the following steps:

[0034] Step 1.1.2.3.5.1: Create a target image. Use the FreeImage open source library to create a target image with a width of newImageWidth, a height of newImageHeight, and a JPEG format.

[0035] Step 1.1.2.3.5.2: Insert the texture image in the image merge container into the target image, extract the texture image objects one by one from the image merge container vecMergeImage, use the FreeImage open source library to load the texture image, and create two layers of loops for the ImageWidth and ImageHeight of the texture image. The two layers of loops are: from left to right and from top to bottom of the image, extract the pixels of each coordinate (x, y) in the texture image. The coordinates corresponding to this point in the target image (i.e., the extracted texture image coordinate point (x, y)) are (x_start+x, y_start+y), and the extracted pixels are assigned to the corresponding coordinates of the target image;

[0036] Step 1.1.2.3.5.3: Save the newly obtained texture image into the memory buffer.

[0037] In the above technical solution, in step one, the geometric bodies are merged to merge all the geometric bodies inside the real-life three-dimensional model into one geometric body; the geometric body includes a vertex set, a texture coordinate set, a normal set, and a vertex index set; the specific method of merging the geometric bodies is: creating a vertex memory cache, a vertex index memory cache, and a texture coordinate memory cache, traversing the geometric bodies inside the real-life three-dimensional model, storing the vertex set in the geometric body into the vertex memory cache, storing the vertex index set into the vertex index memory cache, storing the texture coordinate set into the texture coordinate memory cache, and creating a variable nPrePositionNum to record the number of vertices of the previously processed geometric body, the default value of which is 0.

[0038] In the above technical solution, in step 2, the top tile model of the real three-dimensional scene is converted into a point cloud model, which includes the following sub-steps:

[0039] Step 2.1: Create a vertex memory buffer;

[0040] Step 2.2: Create a color memory buffer, obtain a set of texture coordinates from the geometry of the real-life 3D model, extract each texture coordinate, find the texture image associated with the geometry, use the interface in the OpenSceneGraph graphics library to obtain the color in the texture image where the texture coordinate is located, and store the color in the color memory buffer;

[0041] Step 2.3: Write the vertex memory buffer, color memory buffer, and spatial quantization parameters into the file according to the format of the point cloud model.

[0042] In the above technical solution, in step 2.1, creating a vertex memory buffer area includes the following sub-steps:

[0043] Step 2.1.1: Extract the model bounding box and use the OpenSceneGraph graphics library to obtain the model's bounding box (x_min, y_min, z_min, x_max, y_max, z_max);

[0044] Step 2.1.2: Perform spatial quantization on the vertex set, converting the original vertex (x, y, z) using the type float*3=12 bytes to using the type short*3=6, which reduces the size of the model by half, improves the network transmission speed, reduces the GPU usage, and performs spatial quantization;

[0045] In step 2.1.2, the vertex set is spatially quantized, which includes the following sub-steps:

[0046] Step 2.1.2.1: Calculate the scaling ratio. Divide the bounding box of the model into 65536 equal parts and calculate the scaling ratios in three directions (ScaleX, ScaleY, ScaleZ). The calculation formula is:

[0047] ScaleX=(x_max-x_min) / 65536, ScaleY=(y_max-y_min) / 65536, ScaleZ=(z_max-z_min) / 65536;

[0048] Step 2.1.2.2: Traverse the vertex set in the geometry, extract each vertex (x, y, z), and the spatial quantization formula for the vertex is x_new = (x-x_start)*ScaleX, y_new = (y-y_start)*ScaleY, z_new = (z-z_start)*ScaleZ, and store (x_new, y_new, z_new) in the vertex memory buffer.

[0049] In the above technical solution, in step 3, the real-scene 3D model space index contains the information of the entire 3D model and the data structure information between the models in the model space index in the JSON data format.

[0050] The method for optimizing the spatial index of the real scene 3D model is:

[0051] Step 3.1: The information of the entire 3D model, including the offset matrix of the 3D model, the viewing distance (the model can only be loaded within the viewing distance range), the coordinate system type and the offset matrix of the 3D model, includes the following sub-steps:

[0052] Step 3.1.1: The offset matrix of the three-dimensional model is obtained by putting the zero-point coordinates of the three-dimensional model on the sphere. Through this offset matrix, the entire three-dimensional model is moved onto the sphere.

[0053] Step 3.1.2: The coordinate system type of the 3D model is to identify whether the internal coordinate system of the entire 3D model is oriented upward along the Y axis or the Z axis. The default is Y axis upward.

[0054] Step 3.2: Data structure information between models in the real-scene 3D model spatial index, including the relative path, visible distance, bounding box of the model, as well as the hierarchical relationship between models and the hierarchical relationship between models and the next-level spatial index;

[0055] Step 3.3: The real-scene 3D model spatial index is divided into two parts: the top-level spatial index of the model data and the fine-level spatial index of the model data, including the following sub-steps:

[0056] Step 3.3.1: The top-level spatial index of the model data contains the spatial indexes of the first few layers of the model pyramid. The specific extraction method includes the following sub-steps:

[0057] Step 3.3.1.1: Set the maximum level nMaxTopLevel of the top spatial index of the model data. When converting data, different values ​​can be set according to different 3D model data. The default value is 5 layers.

[0058] Step 3.3.1.2: Create a structure tagNodeIndex for each node in the model data space index, which contains the model's relative path strRelativePath, the model's visible distance dGeometricError, the bounding box box, and the subspace index node container vecChildren;

[0059] Step 3.3.1.3: Create a spatial index node for the model data. The spatial index node corresponds to the node in the model pyramid one by one. Starting from the top layer of the model pyramid, go down layer by layer, and recursively traverse the model pyramid to calculate whether the level of the extracted model is less than nMaxTopLevel. If it is less, go to step 3.3.1.4. If it is greater, go to step 3.3.1.5.

[0060] Step 3.3.1.4: Create a model data space index node object nodeIndex, extract the bounding box of the model, the relative path of the model, and the visible distance of the model through step 3.3.1.3, and assign them to nodeIndex; if the extracted model is the root node of the model pyramid, nodeIndex is the root node of the model data space index; if the extracted model is not the root node of the model pyramid, nodeIndex is imported into the child space index node container in its parent node;

[0061] Step 3.3.1.5: The level of the current extracted model is equal to the maximum level nMaxTopLevel of the top-level spatial index of the model data. Set the extracted model as the root node of a branch in the fine layer, create a model data fine layer spatial index name with the same name as the extracted model but a different suffix name, and import the relative path of the model data fine layer spatial index into the child spatial index node container in its parent node, and the nMaxTopLevel of the top-level spatial index is the relative path of the fine layer spatial index;

[0062] Step 3.3.2: The spatial index of the fine layer of model data contains all models of a sub-branch of the nMaxTopLevel layer and later layers in the model pyramid; through step 3.3.1.5, we have extracted the root node of the fine layer model in a branch. The specific extraction of all nodes under the fine layer includes the following sub-steps:

[0063] Step 3.3.2.1: Starting from the root node of the fine-level model, recursively traverse all child nodes under the root node of the fine-level model;

[0064] Step 3.3.2.2: For each extracted model node, create a corresponding spatial index node object, obtain the bounding box of the model, the relative path of the model, and the visible distance of the model, and assign them to the spatial index node object corresponding to the model. If the extracted model node is a refined layer root node, the corresponding spatial index node object is the model data spatial index root node. If the extracted model node is not a refined layer root node, the spatial index node object corresponding to the model is imported into the child spatial index node container in its parent node.

[0065] Step 3.3.3: The top-level spatial index of the model data and the fine layer of the model data are written into the file in the format of the spatial index.

[0066] The * above represents the mathematical symbol multiplication sign.

[0067] Compared with the prior art, the present invention has the following advantages:

[0068] (1) Through efficient spatial indexing, the WebGL engine can quickly obtain model information. By optimizing the internal structure of the model, the WebGL engine can quickly parse the model, reduce data redundancy, and improve the loading speed of real-life 3D data.

[0069] (2) The top-level tiles of the real-scene 3D are converted into point clouds, thereby further improving the loading speed of the top-level data of the real-scene 3D (the present invention takes about 5 seconds to load and display the entire scene for the first time, and when the window is switched back and forth, it takes about 5 seconds to load and display the scene in the window, and the loading speed is fast; the defect of the slow loading speed of the prior art is overcome (the prior art takes about 2 minutes to load and display the scene for the first time, and when the radius of the oblique photography tiles is small and the number is large, the time will be longer. When the window is switched back and forth, it takes about 30 seconds to load and display the scene in the window); when the 3D browsing window is switched back and forth, the top-level data model of the real-scene 3D can respond quickly, thereby improving the experience of large-scale real-scene 3D interaction.

[0070] The present invention is applicable to all ranges of inclination, and is particularly applicable to large ranges of inclination; for oblique photography with a larger range and a greater number of tiles, the loading effect of the present invention is more obvious (that is, when the range of oblique photography is larger and the number of tiles is greater, the advantage of the fast loading speed of the present invention is more obvious, and is significantly better than the loading speed of the prior art). BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 This is a flowchart of the oblique photography conversion of the present invention.

[0072] Figure 2 This is a flow chart of the algorithm for optimizing the internal data structure of the model in the present invention.

[0073] Figure 3 This is a data flow chart of the texture image merging process in the present invention.

[0074] Figure 4 This is a flowchart of the algorithm in the texture image merging process of the present invention.

[0075] Figure 5 The flowchart of the algorithm for converting the model in the present invention into a point cloud model.

[0076] Figure 6 This is a diagram of the model space index data structure in the present invention.

[0077] Figure 7 This is a data structure diagram of the top-level spatial index and the detailed-level spatial index of the model in the present invention. DETAILED DESCRIPTION

[0078] The following is a detailed description of the implementation of the present invention in conjunction with the accompanying drawings, but they do not constitute a limitation of the present invention and are only given as examples. At the same time, the advantages of the present invention are made clearer and easier to understand through the description.

[0079] like Figure 1 As shown, a method for constructing an oblique photography spatial index taking into account fast rendering on a Web side includes the following steps:

[0080] Step 1: Optimize the internal structure of the model and simplify the internal data structure of the model. The algorithm is as follows: Figure 2 As shown; it mainly includes the optimization of the texture image inside the model and the merging of geometric bodies, including the following sub-steps:

[0081] Step 1.1: Optimization of the texture image inside the model, including reading and compressing the texture image, compressing and merging all the texture images inside the model into one texture, including the following sub-steps:

[0082] Step 1.1.1: Read and compress the texture image, create the image merge structure tagMergeImage, which mainly includes the image buffer ImageBuffer, the image width ImageWidth, the image height ImageHeight, and the offset ImageOffset after the image is merged. The offset includes the starting position x_start in the X direction, the starting position y_start in the Y direction, the length x_rangle in the X direction, and the length y_rangle in the Y direction. For this structure, create the image merge container vecMergeImage; including the following sub-steps:

[0083] Step 1.1.1.1: Read texture images, use the OpenSceneGraph graphics library to obtain all texture images inside the model;

[0084] Step 1.1.1.2: Compress the texture image and push it into the image merging container. Use the open source library FreeImage to convert the acquired texture image into a JPEG format image and obtain the width and height of the image. Create an image merging structure object, store the image converted into JPEG format into the ImageBuffer of the object, and assign the width and height of the image to the ImageWidth and ImageHeight of the object.

[0085] Step 1.1.2: Merge multiple texture images in the model into one texture, mainly including sorting images in the image merging container, obtaining the size of the target image, inserting the image using the insertion splitting method, calculating the offset of the image in the container inserted into the target image, recalculating the width and height of the merged image, saving the image in the container in the target image according to the offset, and recalculating the offset of each image in the container; including the following sub-steps:

[0086] Step 1.1.2.1: Sort the images in the image merging container from largest to smallest according to their width;

[0087] Step 1.1.2.2: Get the size of the target image, set the maximum width of the image (max_width) to 10240, set the default height of each layer (LevelHeight) to 512, extract the maximum value of the image height in the container, and compare it with 512. If it is greater than 512, LevelHeight is the height of the image;

[0088] Step 1.1.2.3: Use the insertion splitting method to insert the image. The algorithm is as follows: Figure 3 As shown, calculate the offset of the image in the container to be inserted into the target image; create a free area structure tagFreePlace, which mainly includes the starting position in the X direction as x_start_free, the starting position in the Y direction as y_start_free, the free width free_width, and the free height free_height; create a free area structure container vecFreePlace, which is arranged in ascending order according to the free width; the free area container is empty at the beginning; the specific insertion process includes the following sub-steps:

[0089] Step 1.1.2.3.1: Extract texture images (curImageWidth, curImageHeight) from the sorted image merge container vecMergeImage in sequence;

[0090] Step 1.1.2.3.2: Calculate the offset of the image to be inserted into the target image. The data flow during the image insertion process is as follows: Figure 4 As shown, when the image is inserted into the first texture image of the nLevel layer, where nLevel is an integer starting from 0, the image (i.e., the texture image to be inserted) is inserted into the upper left corner of the layer (i.e., the nLevel layer), so the offset of the image (i.e., the texture image to be inserted) is (0, LevelHeight*nLevel, curImageWidth, curImageHeight), and the offset of the image (i.e., the texture image to be inserted) is assigned to the offset of the texture image object; due to the insertion of the texture image, the layer (i.e., the nLevel layer) is divided into two pieces, one of which is the right area of ​​the image (i.e., the texture image just inserted) (curImageWidth, LevelHeight*nLevel, max_width-curImageWidth, LevelHeight),

[0091] The other piece is the lower area of ​​the image (i.e. the texture image just inserted) (0, LevelHeight*nLevel+curImageHeight, curImageWidth, LevelHeight-curImageHeight). Insert these two pieces into the vecFreePlace container in ascending order of free width.

[0092] Step 1.1.2.3.3: When inserting another image, judge one by one according to the width curImageWidth and height curImageHeight of the current image and each node (x_start_free, y_start_free, free_width, free_height) in the free container vecFreePlace.

[0093] When curImageWidth<=free_width and curImageHeight<=free_height (the condition is to judge whether the free area in the free container has enough space to accommodate the texture image to be inserted by comparing the width and height), the image (i.e. the second texture image to be inserted) is inserted into the free area (i.e. the free area that meets the conditions), and the offset calculation method of the image (i.e. the second texture image to be inserted) is (x_start_free, y_start_free, curImageWidth, curImageHeight), and the free area is split into two pieces, one on the right side (x_start_free+curImageWidth, y_start_free, free_width-curImageWidth, free_height) and one on the bottom side (x_start_free, y_start_free+curImageHeight, curImageWidth, free_height-curImageHeight), the free area is deleted from the free container, and the two pieces obtained by the split (i.e. the one on the right and the one on the bottom) are inserted into the free container vecFreePlace in ascending order of width;

[0094] When curImageWidth<=free_width and curImageHeight<=free_height are judged, no free area is found in the container, then the image (i.e. the second texture image to be inserted) is inserted into the next layer, nLevel=nLevel+1, and proceed to step 1.1.2.3.2.

[0095] Step 1.1.2.3.4: Recalculate the width (newImageWidth) and height (newImageHeight) of the merged image. Through step 1.1.2.3, we get the offset of each texture image in the merged image. The width (newImageHeight) is calculated by taking the maximum value of the offset x_start+x_rangle from the image merge container, and the height (newImageHeight) is calculated by taking the maximum value of the offset y_start+y_rangle from the image merge container.

[0096] Step 1.1.2.3.5: Save the image in the container in the target image according to the offset, mainly including creating the target image, inserting the image in the image merging container into the target image, and saving the target image, including the following sub-steps:

[0097] Step 1.1.2.3.5.1: Create a target image. Use the FreeImage open source library to create a target image with a width of newImageWidth, a height of newImageHeight, and a JPEG format.

[0098] Step 1.1.2.3.5.2: Insert the image in the image merge container into the target image, extract the image objects one by one from the image merge container vecMergeImage, use the FreeImage open source library to load the image, create two layers of loops for the ImageWidth and ImageHeight of the image, extract the pixels of each coordinate (x, y) in the image from left to right and from top to bottom, the coordinates corresponding to this point in the target image (i.e. the extracted texture image coordinate point (x, y)) are (x_start+x, y_start+y), assign the extracted pixels to the corresponding coordinates of the target image;

[0099] Step 1.1.2.3.5.3: Save the newly obtained texture image into the memory buffer.

[0100] Step 1.1.2.3.6: Recalculate the offset of each image in the image container. The ratio of the offset values ​​x_start, y_start, x_rangle and y_rangle of the image in the image merging container to the entire image is calculated as follows:

[0101] x_start=x_start*1.0 / newImageWidth,

[0102] y_start=y_start*1.0 / newImageHeight,

[0103] x_rangle=x_rangle*1.0 / newImageWidth,

[0104] y_rangle=y_rangle*1.0 / newImageHeight.

[0105] Step 1.2: All geometries inside the model are merged into one geometry, which includes vertex sets, texture coordinate sets, normal sets, and vertex index sets. In order to reduce the impact of lighting on the model and reduce the file size of the model, a non-lighting method is usually used, so there is no need to store the normal set during conversion. Create vertex memory buffers, vertex index memory buffers, and texture coordinate memory buffers, traverse the geometry inside the model, store the vertex set in the geometry into the vertex memory buffer, store the vertex index set into the vertex index memory buffer, and store the texture coordinate set into the texture coordinate memory buffer. Create a variable nPrePositionNum to record the number of vertices of the previously processed geometry. The default value is 0. It includes the following sub-steps:

[0106] Step 1.2.1: Merge the vertex indexes inside the geometric body, extract each index in the vertex index set inside the geometric body, convert it into a new index value of nPrePositionNum + current index value, and store the new index value in the vertex index buffer;

[0107] Step 1.2.2: Merge the vertex set inside the geometric body, extract each vertex in the vertex set, and insert it into the vertex memory buffer in order, and at the same time nPrePositionNum = nPrePositionNum + the number of vertices of the current geometric body;

[0108] Step 1.2.3: Merge the texture coordinates inside the geometry. Obtain the texture image associated with the geometry through the current geometry. Obtain the offset of the texture image in the merged image through step 1.1.1. Traverse the texture coordinate set inside the geometry and extract the texture coordinates (x, y) of each point. Store (x_new, y_new) in the texture coordinate memory buffer through the conversion formula x_new = Offset.x_start + x*Offset.x_rangle, y_new = Offset.y_start + y*Offset.y_rangle.

[0109] Step 1.2.4: Store the vertex memory buffer, vertex index memory buffer, and texture coordinate memory buffer in the geometry format.

[0110] Step 1.3: Store the merged texture image and geometry into the model file.

[0111] Step 2: Convert the top tile model of the real 3D scene into a point cloud model to improve the loading speed of the top data of the real 3D scene. The point cloud model consists of a vertex set and a color set corresponding to each vertex. It has no geometry and texture, and the loading speed is much faster than that of the conventional module. The algorithm is as follows: Figure 5 As shown, it includes the following sub-steps:

[0112] Step 2.1: Create a vertex memory buffer, which mainly includes extracting the model bounding box and performing spatial quantization on the vertices of the geometric bodies in the model, including the following sub-steps:

[0113] Step 2.1.1: Extract the model bounding box and use the OpenSceneGraph graphics library to obtain the model's bounding box (x_min, y_min, z_min, x_max, y_max, z_max);

[0114] Step 2.1.2: Perform spatial quantization on the vertex set, converting the original vertex (x, y, z) using the type float*3=12 bytes to using the type short*3=6, which reduces the size of the model by half, improves network transmission speed, and reduces GPU usage. The spatial quantization process includes the following sub-steps:

[0115] Step 2.1.2.1: Calculate the scaling ratio, divide the bounding box of the model into 65536 equal parts, and calculate the scaling ratios in three directions (ScaleX, ScaleY, ScaleZ). The calculation formulas are ScaleX = (x_max-x_min) / 65536, ScaleY = (y_max-y_min) / 65536, ScaleZ = (z_max-z_min) / 65536;

[0116] Step 2.1.2.2: Traverse the vertex set in the geometry, extract each vertex (x, y, z), and the spatial quantization formula for the vertex is x_new = (x-x_start)*ScaleX, y_new = (y-y_start)*ScaleY, z_new = (z-z_start)*ScaleZ, and store (x_new, y_new, z_new) in the vertex memory buffer.

[0117] Step 2.2: Create a color memory buffer, obtain a set of texture coordinates from the geometry of the model, extract each texture coordinate, find the texture image associated with the geometry, use the interface in the OpenSceneGraph graphics library to obtain the color in the texture image where the texture coordinate is located, and store the color in the color memory buffer;

[0118] Step 2.3: Write the vertex memory buffer, color memory buffer, and spatial quantization parameters into the file according to the format of the point cloud model.

[0119] Step 3: Optimize the model spatial index and build an efficient spatial index. The spatial index contains the information of the entire 3D model and the data structure information between models in JSON format, such as Figure 6 As shown, it includes the following sub-steps:

[0120] Step 3.1: The information of the entire 3D model mainly includes the offset matrix, visible distance, and coordinate system type of the 3D model, including the following sub-steps:

[0121] Step 3.1.1: The offset matrix of the three-dimensional model is obtained by putting the zero-point coordinates of the three-dimensional model on the sphere. Through this offset matrix, the entire three-dimensional model is moved onto the sphere.

[0122] Step 3.1.2: The coordinate system type of the 3D model indicates whether the internal coordinate system of the entire 3D model is oriented upward along the Y axis or the Z axis. The default is Y axis upward.

[0123] Step 3.2: Data structure information between models in the model space index; including the relative path, visible distance, bounding box of the model, as well as the hierarchical relationship between models and the hierarchical relationship between models and the next layer of spatial index, such as Figure 7 As shown;

[0124] Step 3.3: The model space index is divided into two parts: the top-level space index of the model data and the fine-level space index of the model data. The data structure is as follows: Figure 7 As shown, it includes the following sub-steps:

[0125] Step 3.3.1: The top-level spatial index of the model data contains the information of the models in the first few layers of the model pyramid. The generated spatial index file is relatively small in size and has a simple internal structure. The WebGL engine can parse it quickly, so that it can quickly obtain the relevant information between the models. When the WebGL engine loads a 3D model, it starts loading from the top level of the model pyramid and locates the model level that needs to be rendered in the current window through the model's visible distance. Therefore, when loading a 3D scene for the first time or viewing a 3D scene from a distance, the WebGL engine only needs to parse the top-level spatial index, which improves the loading speed of the 3D scene. At the same time, once the index is loaded, it will be cached in the memory, avoiding the waste of resources caused by multiple requests and parsing when the window view is switched back and forth.

[0126] Step 3.3.2: The model data fine layer spatial index contains all the models under a sub-branch in the top layer of the model pyramid. The number of models under this branch will not be large, so the generated fine layer spatial index will not be large. The WebGL engine can quickly parse a single fine layer spatial index. When the window reaches the fine level, the WebGL engine only needs to parse the fine layer spatial index in the window, and does not need to load the spatial index outside the window, which avoids data redundancy and improves the speed of the rendering engine to parse the spatial index, thereby improving the loading speed of the entire 3D scene.

[0127] Example

[0128] The present invention is now described by taking the application of the present invention to a certain oblique photography spatial index construction as an example, which also has a guiding role in the application of the present invention to other oblique photography spatial index construction methods.

[0129] In this embodiment, the oblique photography space is 200 square kilometers of oblique photography, and the total file size of the entire 3D oblique photography model is 109GB, of which there are 8449 original top-level 3D tile models; when the WebGL engine directly loads the panorama of the entire 3D oblique photography model, these top-level 3D tile models are loaded one by one, and when the entire 3D scene panorama is loaded (actually only the first one or two layers of the pyramid of all 3D tile models are loaded), it takes more than 2 minutes, and when the window view is switched back and forth, it takes almost the same time to load, which seriously affects the user experience; in order to solve this problem, this embodiment adopts the method of the present invention to merge the top-level models of the relevant preprocessing program, and converts 8449 original top-level 3D tile models into 20 top-level 3D tile models, and now converts the oblique photography model after preprocessing (that is, a method for constructing an oblique photography space index taking into account the fast rendering of the Web end), including the following sub-steps:

[0130] Step 1: Simplify the internal data structure of the model; after the top-level models of the relevant preprocessing program are merged, 8449 original top-level 3D tile models are converted into 20 top-level 3D tile models. The merged top-level 3D tile model consists of hundreds or thousands of original top-level 3D tile models. If the internal data structure of the model is not simplified, the WebGL engine will parse the internal structure of the model and then load it, which will take more than 20 seconds. After simplification, there is only one geometry buffer block and one texture image inside the model, and it takes about 5 seconds for the WebGL engine to load the simplified model.

[0131] Step 2: Convert the top-level tile model of the real 3D scene into a point cloud model to improve the loading speed of the top-level data of the real 3D scene. The point cloud model only has vertex buffers and color buffers corresponding to vertices, but no geometric bodies or texture images. The WebGL engine has a fast loading speed. It takes about 2 seconds for the WebGL engine to load the point cloud model converted from the top-level model. At the same time, because the accuracy of the first few layers of the model pyramid is not high, converting to point cloud will not affect the accuracy of the entire scene.

[0132] Step 3: Optimize the model spatial index and build an efficient spatial index; the WebGL engine parses and loads the top-level spatial index of the model data; since the top-level spatial index file is relatively small and has fewer model indexes, the WebGL engine has a fast loading speed and can quickly obtain the information of the first few layers of the model pyramid. After loading, it will be cached in the cache area and will not be parsed repeatedly; there are two types of model spatial indexes provided by the prior art, one is to store all model spatial indexes in one file, and the other is to generate a spatial index for each model. For the first method, the spatial indexes of all models are stored in one file, and it takes more than 2 minutes for the WebGL engine to parse and load; for the second method, each model corresponds to a spatial index file, which increases IO reading and writing. When the window view is switched back and forth, the spatial index will be requested and loaded back and forth, resulting in a large waste of resources.

[0133] Conclusion: When the present invention is used to construct a spatial index in this embodiment, the real-scene three-dimensional data is loaded quickly, taking about 5 seconds; when the three-dimensional browsing window is switched back and forth, the real-scene three-dimensional top-level data model can respond quickly, thereby improving the experience of large-scale real-scene three-dimensional interaction; the existing technology overcomes the defects of slow loading speed of real-scene three-dimensional data (it takes about 2 minutes to load real-scene three-dimensional data); when the three-dimensional browsing window is switched back and forth, the real-scene three-dimensional top-level data model responds slowly (the response time of the real-scene three-dimensional top-level data model when the window is switched back and forth takes about 30 seconds), which seriously affects the experience of large-scale real-scene three-dimensional interaction.

[0134] Other parts not described belong to the prior art.

Claims

1. A method for constructing an oblique photography spatial index taking into account fast rendering on the Web side, characterized in that: The following steps are included: Step 1: Optimize the internal structure of the real-life 3D model and simplify the internal data structure of the model; The optimization of the internal structure of the real-scene 3D model includes the optimization of the internal texture image of the model and the merging of geometric bodies; the merged texture image and geometric body are stored in the real-scene 3D model file; Step 2: Convert the top-level tile model of the real 3D scene into a point cloud model to improve the loading speed of the top-level data of the real 3D scene; Step 3: Optimize the spatial index of the real-scene 3D model, build an efficient spatial index, and obtain a new oblique photography 3D model; In step 1, the optimization of the texture image inside the real-scene 3D model includes reading and compressing the texture image, compressing and merging all the texture images inside the real-scene 3D model into one texture, including the following sub-steps: Step 1.1.1: Read and compress the texture image, and create the image merging structure tagMergeImage; Step 1.1.2: Merge multiple texture images in the real 3D model into one texture; The image merging structure tagMergeImage includes an image buffer ImageBuffer, an image width ImageWidth, an image height ImageHeight, and an offset ImageOffset after the image is merged. The offset includes an X-direction starting position x_start, a Y-direction starting position y_start, an X-direction length x_range, and a Y-direction length y_range. For the image merging structure tagMergeImage, an image merging container vecMergeImage is created, including the following sub-steps: Step 1.1.1.1: Read texture images, use the OpenSceneGraph graphics library to obtain all texture images inside the model; Step 1.1.1.2: Compress the texture image and push it into the image merging container. Use the open source library FreeImage to convert the acquired texture image into a JPEG format image and obtain the width and height of the image. Create an image merging structure object, store the image converted into JPEG format into the ImageBuffer of the object, and assign the width and height of the image to the ImageWidth and ImageHeight of the object. In step 1.1.2, the method for merging multiple texture images in the real-life three-dimensional model into one texture includes sorting images in the image merging container, obtaining the size of the target image, inserting the image using the insertion splitting method, calculating the offset of the image in the container into the target image, recalculating the width and height of the merged image, saving the image in the container in the target image according to the offset, and recalculating the offset of each image in the container; The image is inserted using the insertion splitting method. The specific insertion process includes the following steps: Step 1.1.2.3.1: Extract texture images (curImageWidth, curImageHeight) from the sorted image merge container vecMergeImage in sequence; Step 1.1.2.3.2: Calculate the offset of the texture image inserted into the target image. When the texture image is inserted into the first texture image of the nLevel layer, where nLevel is an integer starting from 0, the texture image to be inserted is inserted into the upper left corner of the nLevel layer. Therefore, the offset of the texture image to be inserted is (0, LevelHeight*nLevel, curImageWidth, curImageHeight). Assign the offset of the texture image to be inserted to the offset of the texture image object. Due to the insertion of the texture image, the nLevel layer is divided into two pieces, one is the right area of ​​the texture image just inserted (curImageWidth, LevelHeight*nLevel, max_width-curImageWidth, LevelHeight), and the other is the lower area of ​​the texture image just inserted (0, LevelHeight*nLevel+curImageHeight, curImageWidth, LevelHeight-curImageHeight). Insert these two pieces into the vecFreePlace container in ascending order of free width. Step 1.1.2.3.3: When inserting the second texture image, judge one by one according to the width curImageWidth and height curImageHeight of the current image and each node in the free container vecFreePlace (x_start_free, y_start_free, free_width, free_height). When curImageWidth <= free_width and curImageHeight <= free_height, insert the second texture image to be inserted into the free area that meets the conditions. The offset calculation method of the second texture image to be inserted is (x_start_free, y_start_free ree, curImageWidth, curImageHeight), and split the free area into two pieces, namely: one on the right side (x_start_free + curImageWidth, y_start_free, free_width-curImageWidth, free_height), and one on the bottom side (x_start_free, y_start_free + curImageHeight, curImageWidth, free_height-curImageHeight), delete the free area from the free container, and insert the two pieces obtained by splitting into the free container vecFreePlace in ascending order of width; When curImageWidth<=free_width and curImageHeight<=free_height are judged, no free area is found in the container, then the second texture image to be inserted is inserted into the next layer, nLevel=nLevel+1, and the process goes to step 1.1.2.3.2; Step 1.1.2.3.4: Recalculate the width newImageWidth and height newImageHeight of the merged image. Obtain the offset of each texture image in the merged image through step 1.1.2.3.

3. The width newImageWidth is calculated by taking the maximum value of the offset x_start+x_range from the image merge container. The height newImageHeight is calculated by taking the maximum value of the offset y_start+y_range from the image merge container. Step 1.1.2.3.5: Save the texture image in the free container in the target image according to the offset, including creating the target image, inserting the image in the image merging container into the target image, and saving the target image; Step 1.1.2.3.6: Recalculate the offset of each image in the image container, the offset value x_start, y_start, x_range and y_range of the image in the image merging container relative to the ratio of the entire image, the calculation formula is: x_start = x_start*1.0 / newImageWidth, y_start = y_start*1.0 / newImageHeight, x_range=x_range*1.0 / newImageWidth, y_range=y_range*1.0 / newImageHeight; In step 1.1.2.3.5, the texture image in the free container is saved in the target image according to the offset. The specific method includes the following steps: Step 1.1.2.3.5.1: Create a target image. Use the FreeImage open source library to create a target image with a width of newImageWidth, a height of newImageHeight, and a JPEG format. Step 1.1.2.3.5.2: Insert the texture image in the image merge container into the target image, extract the texture image objects one by one from the image merge container vecMergeImage, use the FreeImage open source library to load the texture image, and create two layers of loops for the ImageWidth and ImageHeight of the texture image. The two layers of loops are: from left to right and from top to bottom of the image, extract the pixels of each coordinate (x, y) in the texture image. The coordinates corresponding to the coordinates (x, y) in the target image are (x_start+x, y_start+y), and the extracted pixels are assigned to the corresponding coordinates of the target image; Step 1.1.2.3.5.3: Save the newly obtained texture image into the memory buffer; In step 1, the geometry is merged to merge all the geometry inside the real-life 3D model into one geometry; the geometry includes a vertex set, a texture coordinate set, a normal set, and a vertex index set; the specific method of merging the geometry is as follows: create a vertex memory buffer, a vertex index memory buffer, and a texture coordinate memory buffer, traverse the geometry inside the real-life 3D model, store the vertex set in the geometry into the vertex memory buffer, store the vertex index set into the vertex index memory buffer, store the texture coordinate set into the texture coordinate memory buffer, create a variable nPrePositionNum to record the number of vertices of the previously processed geometry, and the default value is 0; In step 2, the top tile model of the real scene 3D is converted into a point cloud model, including the following sub-steps: Step 2.1: Create a vertex memory buffer; Step 2.2: Create a color memory buffer, obtain a set of texture coordinates from the geometry of the real-life 3D model, extract each texture coordinate, find the texture image associated with the geometry, use the interface in the OpenSceneGraph graphics library to obtain the color in the texture image where the texture coordinate is located, and store the color in the color memory buffer; Step 2.3: Write the vertex memory buffer, color memory buffer, and spatial quantization parameters into the file according to the format of the point cloud model; In step 2.1, create a vertex memory buffer, including the following sub-steps: Step 2.1.1: Extract the model bounding box and use the OpenSceneGraph graphics library to obtain the model's bounding box (x_min, y_min, z_min, x_max, y_max, z_max); Step 2.1.2: Perform spatial quantization on the vertex set, converting the original vertex (x, y, z) using the type float*3=12 bytes to using the type short*3=6 bytes, which reduces the size of the model by half, improves the network transmission speed, reduces the GPU usage, and performs spatial quantization; In step 2.1.2, the vertex set is spatially quantized, which includes the following sub-steps: Step 2.1.2.1: Calculate the scaling ratio. Divide the bounding box of the model into 65536 equal parts and calculate the scaling ratios in three directions (ScaleX, ScaleY, ScaleZ). The calculation formula is: ScaleX=(x_max-x_min) / 65536, ScaleY=(y_max-y_min) / 65536, ScaleZ=(z_max-z_min) / 65536; Step 2.1.2.2: Traverse the vertex set in the geometric body, extract each vertex (x, y, z), and the spatial quantization formula for the vertex is x_new = (x-x_start)*ScaleX, y_new = (y-y_start)*ScaleY, z_new = (z-z_start)*ScaleZ, and store (x_new, y_new, z_new) in the vertex memory buffer; In step 3, the real-scene 3D model space index contains the information of the entire 3D model and the data structure information between the models in the model space index in the JSON data format. The method for optimizing the spatial index of the real scene 3D model is: Step 3.1: The information of the entire 3D model, including the offset matrix, visible distance, coordinate system type and offset matrix of the 3D model, includes the following sub-steps: Step 3.1.1: The offset matrix of the 3D model is obtained by putting the zero-point coordinates of the 3D model on the sphere. Through this offset matrix, the entire 3D model is moved onto the sphere. Step 3.1.2: The coordinate system type of the 3D model is to identify whether the internal coordinate system of the entire 3D model is oriented upward along the Y axis or the Z axis. The default is Y axis upward. Step 3.2: Data structure information between models in the real-scene 3D model spatial index, including the relative path, visible distance, bounding box of the model, as well as the hierarchical relationship between models and the hierarchical relationship between models and the next-level spatial index; Step 3.3: The real-scene 3D model spatial index is divided into two parts: the top-level spatial index of the model data and the fine-level spatial index of the model data, including the following sub-steps: Step 3.3.1: The top-level spatial index of the model data contains the spatial indexes of the first few layers of the model pyramid. The specific extraction method includes the following sub-steps: Step 3.3.1.1: Set the maximum level nMaxTopLevel of the top spatial index of the model data. When converting data, different values ​​can be set according to different 3D model data. The default value is 5 layers. Step 3.3.1.2: Create a structure tagNodeIndex for each node in the model data space index, which contains the model's relative path strRelativePath, the model's visible distance dGeometricError, the bounding box box, and the subspace index node container vecChildren; Step 3.3.1.3: Create a spatial index node for the model data. The spatial index node corresponds to the node in the model pyramid one by one. Starting from the top layer of the model pyramid, go down layer by layer, and recursively traverse the model pyramid to calculate whether the level of the extracted model is less than nMaxTopLevel. If it is less, go to step 3.3.1.

4. If it is greater, go to step 3.3.1.

5. Step 3.3.1.4: Create a model data space index node object nodeIndex, extract the bounding box of the model, the relative path of the model, and the visible distance of the model through step 3.3.1.3, and assign them to nodeIndex; if the extracted model is the root node of the model pyramid, nodeIndex is the root node of the model data space index; if the extracted model is not the root node of the model pyramid, nodeIndex is imported into the child space index node container in its parent node; Step 3.3.1.5: The level of the current extracted model is equal to the maximum level nMaxTopLevel of the top-level spatial index of the model data. Set the extracted model as the root node of a branch in the fine layer, create a model data fine layer spatial index name with the same name as the extracted model but a different suffix name, and import the relative path of the model data fine layer spatial index into the child spatial index node container in its parent node, and the nMaxTopLevel of the top-level spatial index is the relative path of the fine layer spatial index; Step 3.3.2: The spatial index of the fine layer of model data contains all models of a sub-branch of the nMaxTopLevel layer and later layers in the model pyramid; through step 3.3.1.5, we have extracted the root node of the fine layer model in a branch. The specific extraction of all nodes under the fine layer includes the following sub-steps: Step 3.3.2.1: Starting from the root node of the fine-level model, recursively traverse all child nodes under the root node of the fine-level model; Step 3.3.2.2: For each extracted model node, create a corresponding spatial index node object, obtain the bounding box of the model, the relative path of the model, and the visible distance of the model, and assign them to the spatial index node object corresponding to the model. If the extracted model node is a refined layer root node, the corresponding spatial index node object is the model data spatial index root node. If the extracted model node is not a refined layer root node, the spatial index node object corresponding to the model is imported into the child spatial index node container in its parent node. Step 3.3.3: The top-level spatial index of the model data and the fine layer of the model data are written into the file in the format of the spatial index.