Method for storing a three-dimensional model based on a binary stream in a bim engine
By using a BVH tree structure and index table to organize model data in the BIM engine, the problem of low storage and loading efficiency of existing formats in BIM scenarios is solved, achieving fast loading and rendering effects, and supporting dynamic modification and updating of models.
Patent Information
- Application Number
- CN202311755373.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2043-12-20
AI Technical Summary
Existing 3D model storage formats such as obj, fbx, and gltf are insufficient to meet the requirements for efficient storage and fast loading in railway industry BIM scenarios, especially the real-time rendering requirements of large-scale models, and lack support for fine representation of model details and data topology.
The scene data is reorganized using a BVH tree structure. The model files are stored in units of BVH tree nodes, and an index table is created to divide the data into multiple files to store different types of data, including vertex positions, face indices, normals, UV texture coordinates, etc. The index table is used to achieve fast localization and loading.
It enables fast loading and rendering of model data in the BIM engine, reduces network requests and loading time, improves rendering performance and smoothness, and supports dynamic modification and updating of models.
Smart Images

Figure CN117827774B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of 3D model storage, and more particularly to a method for storing 3D model file formats based on binary streams in BIM engines. Background Technology
[0002] The .obj format is positioned as a storage format for modeling tools, so it focuses only on storing a single model and lacks any scene-level information. Furthermore, its feature set is limited, and the format is relatively outdated, resulting in extremely low efficiency in terms of storage space and the ability to quickly read and write data. Many contents in the .fbx data package are obsolete, such as NURBS surfaces and curves that rely on a complete CAD kernel, and BlinnPhong lighting models, which consume extra space and increase the workload during parsing. One of the biggest drawbacks of gltf is its overly simple 3D model data storage format. It does not allow for topological differences in position, UV, and normal data, and cannot be imported into DCC software for modification and editing. It is unsuitable for storing 3D assets and does not support shader networks. To adapt to the requirements of web-based transmission, the current material definitions in gltf are relatively simple.
[0003] More importantly, in the BIM 3D scene of the railway industry's electrical, electronic, and electrical systems, the types and number of models are numerous, and the details of the models are extremely fine (often requiring refinement down to the thread level of a screw) to accurately meet the design precision requirements of the BIM field. This inevitably results in the number of model patches often reaching tens of millions, or even billions. For such a massive scene model data, it is difficult for the BIM engine to meet the real-time rendering requirements by directly adopting these popular common file formats without specific customization.
[0004] The purpose of this invention is to design a new binary storage file format for BIM model data that is better able to meet the requirements of rapid loading of ultra-large-scale geometric data, based on the characteristics and requirements of BIM engines, so as to achieve efficient storage and transmission and better meet the real-time loading and rendering requirements of BIM engines. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a method for storing 3D model files based on binary streams in a BIM engine, comprising the following steps: In the BIM engine design architecture, the scene data is reorganized using a BVH tree structure. Model files, excluding texture mapping data files, are also stored in units of BVH tree nodes. Each tree node is uniquely numbered according to its location, and a special index table is created for BVH tree nodes.
[0006] Furthermore, following the organization method of BVH tree nodes, the model data was stored in 6 different files, and each file had a corresponding index table.
[0007] Furthermore, the six index tables are stored together in a dedicated file.
[0008] Furthermore, the UV coordinates of the component facets are stored in a separate file.
[0009] The beneficial effects of adopting the above technical solution are as follows: 1. By using the octree spatial partitioning method to reorganize the data, space is traded for time, enabling the BIM engine to quickly load model data; 2. Improve disk access, network transmission, and loading speeds by utilizing a unique index table; 3. Merging files into octree nodes using spatial partitioning to package their attribute information when loading a model can reduce network requests and loading time, thus enabling the loading of multiple Revit models.
[0010] 4. By directly transmitting model geometry data to the GPU instead of the CPU, we can improve rendering performance and facilitate smooth loading in 3D scenes. 5. We decompose the BIM model into different types of information and store them in separate files, as well as store texture maps and component UV coordinates separately. This allows for the modification and updating of specific types of data and avoids duplication.
[0011] 6. Quickly match the index table based on the BVH tree node ID numbering scheme to locate the model data of that node in the file. Attached Figure Description
[0012] Figure 1 The encoding rules for the BVH tree in this invention example; Figure 2 This is a structural block diagram of the complete file storage scheme of the BIM engine in an example of the present invention. Detailed Implementation
[0013] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.
[0014] To address the issue of real-time loading in the BIM rendering engine, we developed a proprietary model storage format solution specifically for the BIM engine architecture designed in-house by our organization.
[0015] according to Figure 1In this method, all data, including vertex positions, patch indices, normals, UV texture coordinates, bounding boxes, and texture maps, are stored in binary format. To enable loading of ultra-large-scale BIM model scenes, our BIM engine architecture reorganizes scene data using a BVH tree structure, allowing for rapid and dynamic switching between different Levels of Detail (LOD) models for rendering. To reduce unnecessary data conversion and packaging, and minimize data loading time, our model files (except for texture map data files) are also stored in units of BVH tree nodes, each node being uniquely numbered according to its orientation.
[0016] Furthermore, to enable random access and storage, we have created a dedicated index table for these BVH tree nodes in the file. Using this index table, we can quickly locate the model data of the node in the file based on the node ID to be loaded.
[0017] To further accelerate data retrieval, we stored data of different uses and types in six different files, organized according to the BVH tree node structure. For example, basic geometric data such as vertex positions, normals, and patch indices were stored in one file; bounding box data was stored in another file; texture mapping data was stored in yet another file, and so on. Each file also corresponds to an index table; for unified management, all six index tables are stored in a dedicated file called the index file.
[0018] In addition, to meet the requirements of dynamically stitching models from multiple Revit files and quickly reconstructing the UV coordinates of virtual textures, we store the UV coordinates of each component facet in a separate file. This allows for timely modification of the UV coordinates without having to repeatedly process other data that does not need to be modified, thereby further reducing the virtual texture reconstruction time.
[0019] The specific steps according to the above plan are as follows: 1) Basic Information on File Formats To facilitate file version control, copyright notices, and other basic information, we first store fixed-format version information in the header of each file, specifically including: (1) File type number: 0: Overall index table file; 1: Temporary index file; 2: Triangular facet geometric data file; 3: Virtual texture map data file; 4: Virtual texture UV coordinate file for facet vertices; 5: BIM architectural attribute collection file for components; 6: BVH tree node bounding box list file (2) File format version number: It consists of two parts: the major version number and the minor version number; (3) File header size (4) Number of BVH nodes in the file (5) Copyright statement information of the unit (6) Other additional data The above provides a detailed description of the fields in the file header information. Following this, the component data is stored.
[0020] Apart from virtual texture mapping data files, the contents of other types of component data are organized and stored in our solution using BVH octree nodes.
[0021] Next, we will continue to describe the details of each type of file.
[0022] 2) Triangular facet geometric data file This file primarily stores the basic geometric information of each component in the BVH tree node, specifically including the node ID string, the list of vertex position coordinates, the vertex indices of the triangles, the list of component IDs, the correspondence between facets and component local indices, and the correspondence between facets and component globally unique integer IDs. The corresponding data structure is as follows: structTriangleNode { intnodeIdNum; / / The number of characters in the node ID, i.e., its length. char* nodeId; / / Node ID string int vertNum; / / The number of float values for vertex coordinates in this node float* vertList = NULL / / List of vertex coordinates int vertIndexNum; / / The number of vertex indices corresponding to the triangles in this node. UINT32 * vertIndexList = NULL / / List of vertex indices for the face intIdsNum; / / The number of component IDs in this node UINT64 * IdsList = NULL / / Component ID: The first 32 characters are the Revit file ID, and the last 32 characters are the component ID. intelemIndexNum; / / Number of facet-component index ID mappings UINT32 * elemIndexList = NULL / / File to which the patch belongs - Component Index List (Local Number) intelemIdNum; / / Number of unique integer IDs (global IDs) for each facet-component. UINT32 * elemIdList = NULL / / List <uint32>elemIndexList = new List <uint32>(); / / List of component IDs (global numbers) to which the face belongs intuiReservedNum; / / Length of the reserved region UINT32 * uiReservedList; / / Reserved area }; By using the above component data organization method, we can quickly load and render the basic geometric data of the components contained in the specified BVH tree node before the engine renders.
[0023] Note: To facilitate the rapid reconstruction of the virtual texture, we store the vertex UV coordinates in a separate file, virtualUv.rd.
[0024] 3) Virtual texture UV coordinate file for face vertex To address the issue of GPUs struggling to load and even experiencing rendering stutters due to a large number of texture maps in BIM scenes, we conducted a requirements survey and ultimately adopted virtual texture technology, which effectively solved the problem of texture file quantity limitations. This technology requires merging a single virtual panoramic image. Then, based on the composite information of the virtual panoramic image, texture mapping can be re-performed, and new virtual texture UV coordinates can be calculated.
[0025] In real-world BIM projects, there's a need to merge and render multiple adjacent scene models as needed. In this case, we need to merge the textures used in these scenes into a larger, unified virtual panorama. More importantly, we also need to re-traverse each node of the BVH tree and modify the UV coordinates of the virtual texture corresponding to each triangle in the new virtual panorama.
[0026] structUvNode { intnodeIdNum; / / The number of characters in the node ID, i.e., its length. char* nodeId; / / Node ID string intuvNum; / / The number of float values for texture uv coordinates float* uvList = NULL / / List of texture coordinates intuiReservedNum; / / Length of the reserved region UINT32 * uiReservedList; / / Reserved area }; To expedite this modification process and reduce unnecessary data processing, we stored the potentially modified uvz coordinate data in a separate file, virtualUv.rd. This keeps the original triangular facet geometry file completely unchanged; only the virtual texture needs to be rebuilt, and the virtualUv.rd file needs to be modified. This method avoids performing numerous additional operations and calculations such as face reduction, octree refilling, and triangular facet geometry file reconstruction, thus shortening the model file reconstruction time.
[0027] 4) Virtual texture mapping data file In the previous section, we mentioned that we used virtual texture technology to process the large number of textures in the scene. This technology requires dividing the virtual panoramic image of different LOD detail layers into fixed-size tile textures according to fixed dimensions, and uniquely numbering each tile. Then, these tiles can be dynamically loaded in real time as needed.
[0028] To improve the loading speed of these tiles and facilitate unified management, we adopted a structure similar to that of triangular facet geometry data files, storing these tiles separately in an independent file named texture.rd. The data structure of the tile node is as follows: structTextureTileImageNode { std::string tileId; std::vector <char>contentList; / / Image compression data int width; / / Image width int height; / / Image height int nFormatId; / / Image compression format ID }; In this file, we store the basic information of each tile map and the corresponding image data in order of tile ID, specifically including: tile ID, image data, image compression data, image size, image compression format ID, etc.
[0029] 5) BIM building attribute collection file of components In BIM projects, in addition to the three-dimensional geometric information and texture mapping data of the components, there is also a large amount of architectural, engineering and management information related to these components. Although this information does not affect the rendering of the engine, it plays a crucial role in the application and promotion of the engine in fields such as digital twins.
[0030] To better integrate with the BIM engine's ability to switch between different levels of detail (LOD) nodes following the BVH tree and synchronously load component attributes in real time, we have also stored these attributes sequentially in the attribute.rd file, organized by component. The data structure of the component attribute node is as follows: structElemPropertyNode { std::string ElementId; / / Component ID std::map<std::string, std::string> propertyTable; / / List of property collections }; Each component's attribute node consists of two parts: the component ID and the attribute set. The attribute set is essentially composed of key-value pairs represented by characters, and the number of attributes is not fixed.
[0031] In this way, the set of attributes corresponding to a specified component ID can be quickly obtained from the engine. This also facilitates the dynamic modification, addition, and deletion of attributes by the BIM engine at any time.
[0032] 6) BVH tree node bounding box list file To facilitate the rapid reproduction of the BVH tree in the engine, we also stored the BVH tree node information established during the modeling phase in a separate file, boundingboxes.rd. The data structure of each node is as follows: structBoundingInfo / / Required parameter for calling DLL functions. Can only contain basic type members, not arrays, pointers, or other user-defined type members. { double boundMinX; / / Left boundary of the X-axis double boundMaxX; / / Right boundary of the X-axis double boundMinY; / / Lower boundary of the Y-axis double boundMaxY; / / Upper boundary of the Y-axis double boundMinZ; / / Z-axis rear boundary double boundMaxZ; / / Z-axis forward boundary int level; / / LOD level int index; / / The index of the sibling node std::string nodeId; / / Node ID }; This structure primarily includes the axial parallel boundary information of each AABB bounding box's six faces (top, bottom, left, right, front, and back), its level in the BVH tree, and its sequence number among its sibling nodes. Furthermore, the node ID is also constructed according to the BVH tree process, as follows: Figure 1 As shown, the ordered numbers generated according to specific rules are encoded as follows: 1. The root node's id is "", which is an empty string of length 0, indicating that it is the only node in LOD 0. 2. According to the spatial partitioning method, divide the BVH tree root into 8 child nodes, and the corresponding IDs are "0", "1", "2", "3", "4", "5", "6", and "7" respectively. The length of these ID strings is all 1, which means that they represent child nodes in a specific position in LOD 1. 3. For each child node at LOD 1, continue to partition it using the spatial partitioning method to create 8 grandchild nodes, with the following corresponding numbers: The child node IDs of node 0 in LOD 1 in LOD 2 are as follows: "00", "01", "02", "03", "04", "05", "06", "07", The child node IDs of node 1 in LOD level 1 in LOD level 2 are as follows: "10", "11", "12", "13", "14", "15", "16", and "17". The child node IDs of node 2 in LOD 1 in LOD 2 are as follows: "20", "21", "22", "23", "24", "25", "26", and "27". ... Following this pattern, the child node IDs of node 7 in LOD 1 in LOD 2 are: "70", "71", "72", "73", "74", "75", "76", and "77". These ID strings are all 2 characters long, which means they represent nodes at LOD 2 level, and their corresponding parent nodes at LOD 1 level are "0", "1", "2", ... "7".
[0033] 4. Continuing to subdivide downwards, we can obtain the child nodes at LOD level 3: The child node IDs of node 00 in LOD level 2 in LOD level 3 are as follows: "000", "001", "002", "003", "004", "005", "006", "007", The child node IDs of node 01 in LOD layer 2 in LOD layer 3 are as follows: "010", "011", "012", "013", "014", "015", "016", "017", ... 5. After dividing in this way up to the LOD n level, we can obtain a BVH tree composed of AABB bounding box nodes of level n+1, and each node is uniquely marked according to the numbering rules mentioned above.
[0034] In other words, the detailed numbering rules are: 1. Assume that the length of a node's ID is n, which means that the node belongs to LOD level n (counting from level 0). 2. The last digit indicates the node's sequence number among its sibling nodes; 3. Except for the last digit, the first n-1 digits represent the parent node's number.
[0035] Following this method, the root node's number is deduced to be "", which is an empty string of length 0, and it is the only node in LOD 0.
[0036] By applying this numbering rule, the level number of a node in a given LOD can be quickly located based on its node ID, and its parent node and all sibling nodes can be found. This numbering rule is also easy to encode and decode in the calculation program, making it ideal for quickly switching from the current LOD node to its parent or child node level in a BIM engine as needed, achieving smooth switching between geometric data at different detail levels.
[0037] Practice has shown that for a world coordinate system encompassing the entire Earth, dividing the Earth spatially from LOD 0 to LOD 24 is sufficient to represent the details of each component in a BIM scene. At this point, the BVH tree consists of 25 layers of AABB bounding box nodes, with the smallest leaf node bounding box only about 20 centimeters in size. For common BIM building models, it is entirely possible to smoothly display the model geometry data in these adjacent leaf nodes at a frame rate of over 60 frames per second.
[0038] 7) Index table file Simply organizing data content according to the above file format is far from sufficient to meet real-time access requirements, especially when there are many models in the scenario, even exceeding several gigabytes or tens of gigabytes.
[0039] To improve access performance, we created a dedicated index table for each of the above data files, based on their node IDs and storage locations. The detailed data structure is as follows: structIndexItem / / Map index item in the index table { std::streamoff pos; / / Location in the file std::string key; / / Index key std::streamoff len; / / Length }; In this index table, each index corresponds to a specific node in the original data file, including the node's storage location offset, node ID, and the total length of the data in that node.
[0040] By looking up the index table, the offset of the current node in the original data file and the total length of the data can be found, thus enabling fast random access to node data.
[0041] Since the index table needs to be dynamically generated synchronously during the process of storing the original data in sequence, the index table corresponding to each data file can be temporarily stored in the corresponding temporary index file XXXTempIndexTable.rd (XXX is the corresponding original data file name).
[0042] To facilitate unified management, after all data files have been populated and all temporary index files have been generated, these temporary index files can be packaged and merged into a final whole index table file, WholeIndexTable.rd, in a fixed order.
[0043] In response, our BIM engine's complete file storage solution process is as follows: Figure 2 As shown: 1. A model is decomposed into 6 or more files: "map.rd", "attributes.rd", "boundingboxes.rd", "texture.rd", "triangles.rd", "elements.rd", all using the *.rd suffix. 2. The attribute.rd file stores component attributes. 3. boundingboxes.rd stores all octree nodes in the model, including component triangles. 4. texture.rd stores all materials in the model: including different types such as materials and textures. 5. triangles.rd stores all the triangular faces (excluding UV coordinates) of the model components, including triangular faces that can be processed with or without the face reduction algorithm. 6. Elements.rd stores the original triangular face information of all model components. 7. virtualUv.rd stores the UV information of each original triangle face, so that the virtual texture coordinates can be quickly updated when dynamically merging different RVT model files.
[0044] Through the above, we can improve the loading speed and performance of the rendering engine, providing users with a better experience. The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to the technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalent features without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.< / char>
Claims
1. A method for storing 3D model file format based on binary stream in a BIM engine, characterized in that, include: In the BIM engine design architecture, the scene data is reorganized using an octree hierarchical structure. The model files, except for the texture mapping data files, are stored in units of octree hierarchical nodes. Each tree node is uniquely numbered with an ID according to its location, and an index table is created for the octree hierarchical nodes. The encoding rule for the Id number is as follows: the root node corresponds to an empty string, the child node Id of the LOD1 level is "0" to "7" in sequence, the child node Id of the LOD2 level is appended with "0" to "7" after the parent node Id, and so on, so that the length of the node Id represents the LOD level, the last digit represents the order number in the sibling node, and the remaining digits represent the parent node number. Furthermore, the model data is stored in multiple independent files as a binary stream, including at least: a basic geometric data file for storing vertex positions, normals, and patch indices; a bounding box file for storing bounding box data; a texture file for storing virtual texture mapping data; a UV coordinate file for storing component patch UV coordinates; and an attribute file for storing component BIM building attributes. Each file has a corresponding index table, and all index tables are stored in a unified index file. The UV coordinates are stored separately in a UV coordinate file so that only the UV coordinate file needs to be modified when dynamically merging multiple BIM models, without modifying the basic geometric data file; each component attribute node in the attribute file contains a component ID and a list of attribute sets consisting of string key-value pairs; each bounding box node in the bounding box file contains the axial parallel boundary information of the AABB bounding box, the LOD level of the node in the octree hierarchy, the sequence number in the sibling nodes, and the node ID; each index key in the index table includes at least the node ID, the storage position offset of the node in the corresponding original data file, and the length of the node data; The LOD level is a node at different detail levels of an octree hierarchy; In the index table, each index corresponds to a corresponding node in the original data file, specifically including the node's storage location offset, node ID, and the total data length of the node. By searching the index table, the storage location offset and total data length of the current node in the original data file can be found, thereby enabling fast random access to node data.
2. The method for storing 3D models based on binary streams in a BIM engine according to claim 1, characterized in that, The UV coordinates are stored separately in a virtualUv.rd file, which is used to quickly reconstruct the virtual texture.
3. The method for storing 3D models based on binary streams in a BIM engine according to claim 1, characterized in that, The index table needs to be dynamically generated synchronously during the process of storing the original data sequentially. Therefore, the index table corresponding to each data file is temporarily stored in the corresponding temporary index file XXXTempIndexTable.rd.
Citation Information
Patent Citations
Three-dimensional geometric model surface element space division and BVH tree construction method based on Morton codes
CN116310108A
