A fast and lightweight method for BIM
By performing classification and screening of the BIM model, grid simplification, data compression and format conversion, a lightweight model with multiple levels of details is generated, which solves the problem of low processing efficiency of the BIM model, and achieves a significant reduction in file size and improved processing efficiency.
Patent Information
- Application Number
- CN202411281736.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-09-13
AI Technical Summary
BIM models are large in size and complex in structure, resulting in low processing efficiency, especially when used on mobile devices or low-configuration computers.
By determining the lightweight target, classifying and filtering the BIM model data, using the Quadric Error Metrics algorithm and Decimation algorithm for grid simplification, using Draco tools for data compression, and converting and compressing the attribute data JSON format, and finally generating a multi-level detail lightweight model and performing spatial chunking and optimization.
It significantly reduces the file size of the BIM model, improves its processing and interaction efficiency on various devices, and improves work efficiency and user experience in building design, construction and operation management.
Smart Images

Figure CN118799529B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of BIM model processing, and in particular to a BIM fast and lightweight method. Background Art
[0002] Building Information Modeling (BIM) technology plays an important role in building design, construction, and operation management. However, BIM models usually contain a lot of detailed information, resulting in large file sizes and inefficient processing. This is especially evident when used on mobile devices or low-configuration computers. Therefore, it is very necessary to develop a method for fast and lightweight BIM models that can significantly reduce the complexity and file size of the model while retaining the necessary information. From a technical perspective, BIM lightweighting can be divided into two types: traditional ActiveX plug-in technology and WEBGL technology. Traditional ActiveX plug-in technology has been gradually eliminated due to its outdated technology and huge security risks. BIM lightweighting using WebGL technology represents the most advanced technology and direction. It has no data security risks and is not only suitable for various WEB browsers, but also for mobile App applications. It is the best choice for current BIM lightweight products.
[0003] Although the traditional BIM lightweight method has solved the problems of large model files, low transmission and processing efficiency to a certain extent, it also has some defects. Mesh simplification and data compression often lead to the loss or reduction of geometric information and attribute information, which may cause the model to be unable to fully express the design and construction information, affecting subsequent use and maintenance. Traditional lightweight algorithms are inefficient and take a long time to process complex and large-scale BIM models. When displayed in real-time applications (such as VR / AR), mobile devices or web pages, low processing efficiency will lead to poor user experience. Different lightweight tools and algorithms may produce output files in different formats. There may be compatibility issues between these files on different platforms and software, requiring additional conversion steps and tools to ensure compatibility, which increases the complexity of the work. At present, there is no unified standard to regulate the data screening, simplification and compression methods in the BIM lightweight process. The lack of standardization may lead to data consistency and integrity issues, affecting the reliability and availability of the model. Summary of the invention
[0004] The present invention provides a method for rapid and lightweight BIM, which is used to solve the problem of low processing efficiency caused by the large size and complex structure of the current BIM model in practical applications. Through the method of the present invention, the file size of the BIM model can be significantly reduced, and its processing and interaction efficiency on various devices can be improved, thereby improving the work efficiency and user experience in the process of building design, construction and operation management.
[0005] In a first aspect, the present invention provides a method for rapid lightweighting of BIM, the method for rapid lightweighting of BIM comprising:
[0006] Determine lightweight goals, and classify and screen BIM model data to obtain initial geometry data, initial attribute data, and auxiliary data;
[0007] Using a Quadric Error Metrics algorithm to perform mesh simplification processing on the initial geometric data to obtain first geometric data;
[0008] Deleting polygon edges and re-triangulating the first geometric data by using a Decimation algorithm to obtain second geometric data;
[0009] Using the Draco tool to compress the second geometric data to obtain lightweight geometric data, and converting and compressing the initial attribute data into JSON format to obtain lightweight attribute data;
[0010] Performing format conversion on the lightweight geometric data and the lightweight attribute data to obtain a lightweight BIM model, and performing hierarchical detail processing on the lightweight BIM model to generate a lightweight model with multiple levels of details;
[0011] The lightweight model with multiple levels of details is spatially divided and optimized to obtain a divided lightweight model, and the divided lightweight model is imported into a rendering engine for real-time rendering to obtain a real-time rendering result.
[0012] In a second aspect, the present invention provides a BIM fast lightweight device, the BIM fast lightweight device comprising:
[0013] The classification and screening module is used to determine the lightweight target and classify and screen the BIM model data to obtain the initial geometry data, initial attribute data and auxiliary data;
[0014] A mesh simplification module, used for performing mesh simplification processing on the initial geometric data by using a Quadric Error Metrics algorithm to obtain first geometric data;
[0015] A processing module, configured to perform polygon edge deletion and re-triangulation processing on the first geometric data by using a Decimation algorithm to obtain second geometric data;
[0016] A compression module, used to compress the second geometric data using a Draco tool to obtain lightweight geometric data, and to convert and compress the initial attribute data into a JSON format to obtain lightweight attribute data;
[0017] A conversion module, used for performing format conversion on the lightweight geometric data and the lightweight attribute data to obtain a lightweight BIM model, and performing hierarchical detail processing on the lightweight BIM model to generate a lightweight model with multiple levels of details;
[0018] The rendering module is used to spatially divide and optimize the lightweight model with multiple levels of details to obtain a divided lightweight model, and import the divided lightweight model into a rendering engine for real-time rendering to obtain a real-time rendering result.
[0019] In the technical solution provided by the present invention, the file size of the present invention is significantly reduced. Through geometric simplification, data compression and format conversion, the file size of the BIM model is greatly reduced. The reduced file size helps to transmit and store data more efficiently, especially in a network environment with limited bandwidth. Improve rendering and loading performance. By simplifying the mesh and using the level of detail model (LOD), the rendering and loading performance of the model on various devices (such as mobile devices, web browsers, VR / AR devices) is significantly improved. Users can view and operate BIM models more quickly, improving user experience. Retain key data. Despite the lightweight processing, key geometric information and attribute data are retained to ensure that the model has no significant loss in accuracy and integrity. Through data screening and classification, the core data required for the project is retained to support subsequent design, construction and operation and maintenance work. Improve data compatibility and interoperability, convert to a common lightweight data format (such as glTF, IFC, OBJ, etc.), and improve the compatibility and interoperability of the model between different platforms and applications. The lightweight model can be used in a variety of software environments, reducing the complexity of data conversion and adaptation. Optimized workflows simplify the workflow of BIM model processing through standardized lightweight processes and tool integration. After the workflow is optimized, the team can manage and apply BIM data more efficiently, reducing the possibility of manual operations and errors. Support dynamic data and real-time applications, through spatial block and indexing mechanisms, support dynamic data and real-time application scenarios. In applications such as smart buildings and smart cities, real-time changing data can be efficiently processed and displayed to improve the timeliness and accuracy of decision-making. Reduce the demand for hardware resources. The lightweight BIM model has lower demand for hardware resources (such as storage, memory, and processors) and is suitable for devices with various computing capabilities. BIM technology can be applied on more types of devices, including low-end computing devices and mobile terminals. More convenient collaboration. The lightweight model is easier to share and collaborate between teams, reducing the time for file transfer and loading. Support efficient collaboration between multiple teams and multiple disciplines to improve the overall work efficiency of the project. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0021] Figure 1 A schematic diagram of an embodiment of a method for rapid lightweighting of BIM in an embodiment of the present invention;
[0022] Figure 2 It is a schematic diagram of an embodiment of a device for rapid lightweighting of BIM in an embodiment of the present invention. DETAILED DESCRIPTION
[0023] An embodiment of the present invention provides a method for fast lightweighting of BIM. The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 An embodiment of the BIM fast lightweight method in the embodiment of the present invention includes:
[0025] Step S101, determine the lightweight target, and classify and screen the BIM model data to obtain initial geometry data, initial attribute data and auxiliary data;
[0026] It is understandable that the execution subject of the present invention may be a BIM fast and lightweight device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0027] Specifically, the lightweight target is clearly defined, and the data structure of the BIM model data is analyzed according to the lightweight target to obtain the topological structure and element relationship diagram of the model. By analyzing the geometric shape of the model, the connection relationship between components and the spatial configuration, the overall structure of the model and the relative importance of each part are understood. According to the determined element relationship diagram, the importance of each element in the model is scored to generate an element importance ranking list. The scoring process usually depends on multiple factors, such as the function, location, frequency of use and impact on the overall structure of the element. Based on the element importance ranking list, the first retention threshold is set, and the model elements with scores below the threshold are marked to obtain the target element set. The boundary of the geometric data in the target element set is extracted to obtain a complete boundary curve set. The boundary curve set is analyzed by point set, and the target boundary contour is depicted by setting the tolerance value and iteratively calculating the vertical distance from each point to the line segment. Based on the target boundary contour, the original geometric surface is reconstructed to generate a more simplified target face set. On this basis, in order to optimize the display effect of the model and reduce the amount of data, the target face set is analyzed by normal vector, and the normal vector angle between adjacent faces is calculated. If the angle is found to be less than the preset threshold, these adjacent facets are merged to obtain the initial geometric data. At the same time, data redundancy analysis is performed on the attribute data in the BIM model. By calculating the usage frequency and information entropy of each attribute field, an attribute importance score table is generated. Based on the score table, a second retention threshold is set to filter out those attribute fields with scores higher than the threshold to obtain the initial attribute data. Resolution and complexity analysis is performed on the material, texture and lighting information in the model. According to the preset target ratio, these data will be downsampled and merged to generate auxiliary data, thereby simplifying the material and texture information of the model, reducing the burden of calculation and rendering, and improving the lightweight degree of the model.
[0028] Step S102, using the Quadric Error Metrics algorithm to perform mesh simplification processing on the initial geometric data to obtain first geometric data;
[0029] Specifically, each vertex in the initial geometric data is analyzed and calculated. For each vertex vi, calculate its corresponding plane equation set Pi to describe all planes associated with vi. vi represents the three-dimensional coordinates (xi, yi, zi) of the i-th vertex, and Pi consists of the normal vector components a, b, c and the constant term d of these vertices, where the general form of the plane equation is ax+by+cz+d=0. a, b, c are components of the normal vector, satisfying the unit normal vector condition, that is, a2+b2+c2=1, and d represents the signed distance from the plane to the origin. For each vertex vi, calculate the corresponding quadratic error matrix Qi according to its associated plane set Pi. The matrix Qi is obtained by taking the outer product of all plane equation coefficient vectors [a, b, c, d]T, where ai is the plane equation coefficient vector. Qi=Σ(ai*aiT), ai represents the plane equation coefficient vector [a, b, c, d] T , and Qi is a 4x4 symmetric matrix used to describe the sum of the squares of the distances from vertex vi to its associated plane. The transpose operation of the matrix is represented here as T. After obtaining the quadratic error matrix of the vertex, an optimal contraction point v' is calculated for each edge e (v1, v2) in the grid. The solution to this optimal contraction point is performed by the equation (Q1+Q2)v'=0, where Q1 and Q2 are the quadratic error matrices of the two endpoints v1 and v2 of edge e, respectively. If the equation has no solution, a point with the smallest error is selected from v1, v2 and the midpoint of the edge as the optimal contraction point v'. In this way, the vertex position where the geometric error is minimized during the edge contraction process is determined. The contraction cost Δ(v1, v2) of each edge e is calculated. This contraction cost represents the geometric error introduced when contracting the edge e to the optimal contraction point v'. After the contraction costs of all edges are sorted into an edge contraction cost list, a first priority queue of edges to be deleted is constructed. The edges in the priority queue are sorted from small to large according to the shrinkage cost Δ(v1, v2), so that the edges with the smallest cost can be processed first. In this process, the edges with the smallest shrinkage cost are extracted from the priority queue and the edge shrinkage operation is performed, thereby gradually simplifying the geometric structure of the mesh and reducing the number of vertices and faces. The simplified local mesh structure is checked for topological consistency, and non-manifold edges and vertices are repaired to ensure that the simplified mesh structure still meets the basic requirements of geometric topology, and the first geometric data is obtained.
[0030] Step S103, deleting polygon edges and re-triangulating the first geometric data by using a Decimation algorithm to obtain second geometric data;
[0031] Specifically, vertex curvature is calculated for each vertex in the first geometric data, the geometric form of each vertex in its neighborhood is evaluated, and a vertex curvature set is generated. Vertex curvature is an important indicator that describes the curvature degree of the local surface of the vertex, which can help identify which vertices can be processed first in the geometric simplification process. According to the vertex curvature set, edge importance is calculated for each edge in the mesh. The edge importance is usually determined by the curvature difference between its two end vertices and the role of the edge in the overall geometric shape. By calculating the importance of these edges, an edge importance list is generated, which reflects the importance of each edge in preserving the overall geometric form during the mesh simplification process. A minimum heap is constructed based on the edge importance list. The minimum heap is a data structure that can quickly find and remove the minimum element. The minimum heap can efficiently sort the edge importance from small to large to form a second priority queue of edges to be deleted. In the queue, the least important edge is at the front and is processed first. When extracting the edge with the smallest importance from the second priority queue of edges to be deleted, it is determined whether deleting the edge will cause a change in the topological structure. If it is determined that it will not cause a topological change, the edge can be safely marked as an edge to be deleted to obtain a candidate edge for deletion. Perform edge collapse operations, including removing edges and corresponding vertices, to simplify the mesh structure. After each edge collapse operation, update the state of the local mesh structure, and recalculate the vertex curvature around each vertex and the importance of the related edges. After updating these data, update the minimum heap again to obtain a new priority queue of edges to be deleted. This process is repeated until the preset simplification goal is reached. After the mesh simplification is basically completed, generate a simplified mesh based on the updated priority queue of edges to be deleted. Since the simplification process may cause the mesh in some areas to no longer meet the topological requirements, the simplified mesh is locally re-triangulated to ensure that the topological structure of the mesh remains consistent. In this process, the geometric quality of the mesh is optimized by adjusting the connection method of the triangles. Perform an edge flip operation on the topologically optimized mesh to adjust the connection method of the triangles to minimize the surface error and maintain the details of the model to obtain the second geometric data.
[0032] Step S104: Use the Draco tool to compress the second geometry data to obtain lightweight geometry data, and convert and compress the initial attribute data into JSON format to obtain lightweight attribute data;
[0033] Specifically, the vertex coordinates in the second geometric data are quantized, and the floating-point coordinates are converted into integer values to reduce the data precision but maintain the overall geometric form, thereby generating quantized vertex data. The quantized vertex data are predictively encoded, and the predictive encoding predicts the value of the current vertex by using the adjacent vertex information, and records the difference between the actual value and the predicted value to generate vertex residual data. The vertex residual data are entropy encoded, and the entropy encoding achieves data compression by encoding common residual values into shorter bit strings and uncommon residual values into longer bit strings. The encoding model is dynamically adjusted according to the residual distribution characteristics to improve the compression efficiency and generate a compressed vertex stream. At the same time, the topological information in the second geometric data is encoded, and the encoded topological data is further compressed, and a compressed topological stream is generated by entropy encoding. The two streams, namely the compressed vertex stream and the compressed topological stream, are merged together, and Draco file header information is added to lightweight geometric data, and the file header information contains metadata required for describing the compressed data format and decoding. When processing the initial attribute data, structural analysis is performed to identify the key-value pairs and array structures in the data. Convert these structures into JSON format to obtain initial JSON data. To optimize the data volume, compress the initial JSON data by key name, replace the longer key names with short identifiers, and generate JSON data with compressed key names. Optimize the numerical precision of the JSON data with compressed key names, reduce the precision of floating point numbers to reduce the amount of data without significantly affecting the accuracy of attribute information, and generate JSON data with optimized precision. Compress the JSON data with optimized precision, including using standard compression algorithms such as Gzip or Zstandard, to further reduce the data volume and generate lightweight attribute data.
[0034] Step S105: convert the format of the lightweight geometric data and the lightweight attribute data to obtain a lightweight BIM model, and perform layered detail processing on the lightweight BIM model to generate a lightweight model with multiple levels of details;
[0035] Specifically, the lightweight geometric data is decompressed to restore the original mesh structure. The decompression process involves decoding vertex and topology information and reconstructing the geometry of the model. At the same time, the lightweight attribute data is decompressed, and structured attribute data is obtained through JSON parsing, which may include material, color, texture and other detailed information related to the model. The original mesh structure and the structured attribute data are merged, and a scene graph structure that complies with the glTF2.0 specification is constructed. glTF2.0 is an open standard for efficient transmission and loading of 3D models. By following this specification, the compatibility and consistency of the lightweight BIM model on different platforms and devices are ensured. The merged data generates a lightweight BIM model, which contains geometric information, as well as rich attribute and material information. The bounding volume hierarchy of the lightweight BIM model is calculated. By analyzing the geometric features of the model, the bounding volume of each part is calculated. The longest axis is selected for division, and a binary tree structure is recursively constructed to form a spatial index structure. The spatial index structure helps to quickly locate and render specific parts of the model, thereby improving rendering efficiency. Based on the spatial index structure, the lightweight BIM model is divided into LOD (Level of Detail) levels. LOD technology allows the model's level of detail to be dynamically adjusted according to the viewing distance and detail requirements to optimize rendering performance. A node importance list is generated by analyzing the geometric complexity and viewing distance of each node. According to the list, the mesh is simplified for each LOD level to generate a multi-level simplified mesh. The mesh simplification process involves reducing the number of vertices and patches while trying to maintain the appearance and important features of the original model. For each LOD level of the multi-level simplified mesh, a line map and a normal map are generated. Normal maps are an effective way to add details to the model surface through texture mapping technology, maintaining high-quality visual effects even in the case of geometric simplification. After generating the LOD model with a normal map, the model's texture is compressed to reduce the data volume and improve transmission and loading efficiency. A LOD switching strategy is constructed, which determines how to dynamically switch between different LOD levels under different viewing distances and scene conditions. The LOD model of compressed textures, spatial index structure and LOD switching strategy are packaged to obtain a lightweight BIM model with multiple levels of details.
[0036] Step S106: spatially divide and optimize the lightweight model with multiple levels of details to obtain a divided lightweight model, and import the divided lightweight model into a rendering engine for real-time rendering to obtain a real-time rendering result.
[0037] Specifically, the octree space partition is performed on the lightweight model with multiple levels of details, and the three-dimensional space of the entire model is recursively divided into smaller cubic areas to obtain the initial space partition structure. For each leaf node in the initial space partition structure, the geometric complexity index is calculated, including evaluating the number of geometric bodies, the number of vertices, and the number of facets contained in each leaf node, and a node complexity list is obtained. According to the obtained node complexity list, for the leaf nodes whose geometric complexity index exceeds the preset geometric complexity threshold, the leaf nodes are re-divided, and the overly complex nodes are further subdivided to reduce the geometric complexity of each child node, and the optimized space partition structure is obtained. The contained geometry and attribute data are extracted from each leaf node in the optimized space partition structure to construct an independent sub-model. The bounding sphere radius and center point of each sub-model are calculated. These parameters help to determine the visibility and occlusion culling of the sub-model, and a block lightweight model is obtained. Each sub-model is an independent block unit, which is easy to manage and optimize. The view cone culling optimization is performed on each sub-model in the block lightweight model. Frustum culling refers to the removal of sub-models outside the frustum according to the camera's perspective to avoid rendering objects that are not within the field of view, thereby improving rendering efficiency. After frustum culling, a list of visible blocks is obtained. Occlusion culling is performed on the visible block list to remove blocks that are blocked by other geometric bodies. Occlusion culling determines which objects are completely blocked by depth testing and bounding sphere calculations. Only those objects that are completely exposed to the field of view will be retained in the final rendering set. The unobstructed block set is selected to form the final rendering block set. These blocks will be organized into rendering batches, in which blocks with the same material are merged together. The merge operation helps reduce material switching during rendering, thereby optimizing the performance of the rendering pipeline. The optimized rendering data structure is loaded into the rendering engine for real-time rendering.
[0038] The optimized space partition structure is traversed in depth first to obtain a set of leaf nodes. The geometric data of each leaf node in the set of leaf nodes is subjected to boundary analysis, and the axis-aligned bounding box is obtained by calculating the coordinate extreme values of all vertices in the geometric data of each leaf node. The calculation of the axis-aligned bounding box defines a minimum bounding rectangle by determining the minimum and maximum values of the vertex on each axis. Based on the diagonal length of the axis-aligned bounding box, the geometric data of each leaf node is meshed and resampled to reduce the complexity of the geometric data while maintaining the main shape and features. Through resampling, the number of vertices and facets is reduced, thereby reducing the amount of data and improving the efficiency of subsequent processing. The resampled geometric data is associated and matched with the attribute data in each leaf node to generate a sub-model data set. The sub-model data set is analyzed, the local coordinate system of the sub-model is constructed, and the data representation of each sub-model is standardized. Based on the local coordinate system, the data points in the sub-model data set are transformed to calculate the center point and the radius of the bounding sphere of the sub-model. The center point is the geometric center of the bounding sphere, and the radius of the bounding sphere is the distance from the center point to the farthest point in the data set. These two parameters together define the spatial occupancy range of the sub-model. The corresponding block lightweight model is generated according to the sub-model data set, the bounding sphere radius and the center point. The block lightweight model not only retains the main geometry and attribute information of the original BIM model, but also significantly reduces the amount of data through spatial block and data compression.
[0039] Sort each tile in the visible tile list by depth. Sort each tile by its distance from the viewpoint to get a sorted tile list. The sorted tile list helps with subsequent occlusion culling and visibility analysis, ensuring that closer tiles are processed first from the viewpoint. Build a hierarchical Z-buffer structure, which is implemented by dividing the view frustum into m×m grids, each corresponding to a maximum depth value, to form an initial Z-buffer structure. m is a positive integer, usually selected based on the view resolution and accuracy requirements. This structure is used to store the farthest visible depth information in each grid to help with occlusion culling. Iterate over the sorted tile list and perform frustum culling and occlusion culling on the bounding sphere of each tile. In the frustum culling stage, if the bounding sphere is completely outside the view frustum, the tile can be directly culled. In the occlusion culling stage, by comparing the tile's depth information with the depth value in the Z-buffer, the tile can also be culled if it is completely occluded by the previous tile. After these steps, an unobstructed block set is obtained. Each block in the unobstructed block set is projected in 2D to obtain its projection polygon on the screen. By calculating the overlap between the 2D projection polygon and the corresponding grid in the initial Z-buffer structure, the coverage of each block on the view is determined to obtain an overlapping grid set. The importance of the blocks in the overlapping grid set is scored. The scoring criteria may include factors such as the geometric complexity of the block, the importance of the material, and the contribution to the overall visual effect. According to the preset maximum number of rendering triangles, the blocks in the scored block set are selected from high to low according to the score. During the selection process, the geometric complexity of the selected blocks is accumulated until the maximum number of rendering triangles is reached, ensuring that when rendering resources are limited, the most important blocks are displayed first to optimize the overall visual effect. A rendering block set is obtained.
[0040] In the embodiment of the present invention, the file size of the BIM model is significantly reduced by geometric simplification, data compression and format conversion. This reduction not only makes the file easier to transmit and store, but is also particularly conducive to data exchange in a network environment with limited bandwidth. The reduction in file size means more efficient data processing and faster access speed, thereby improving overall work efficiency. Secondly, the use of mesh simplification and level of detail model (LOD) significantly improves the rendering and loading performance of the model on various devices. Whether on mobile devices, web browsers, or VR / AR devices, users can view and operate BIM models more quickly, thereby improving the user experience. This improvement allows complex models to run smoothly on more platforms and expands the application scope of BIM technology. Despite the lightweight processing, the key geometric information and attribute data of the model are retained. This ensures that there is no significant loss in the accuracy and integrity of the model. Through data screening and classification, the core data required for the project is retained to support subsequent design, construction and operation and maintenance work. The retention of key data is the key to ensuring the practicality of the model and avoiding the potential risks caused by information loss. In addition, converting BIM models into common lightweight data formats (such as glTF, IFC, OBJ, etc.) improves the compatibility and interoperability of models between different platforms and applications. Lightweight models can be used in a variety of software environments, reducing the complexity of data conversion and adaptation. High compatibility makes data exchange between different project teams and tools smoother and improves collaboration efficiency. The workflow of BIM model processing is simplified through standardized lightweight processes and tool integration. The optimized workflow enables the team to manage and apply BIM data more efficiently, reducing the possibility of manual operations and errors. Standardized processes not only improve work efficiency, but also ensure the consistency and reliability of data processing. Supporting dynamic data and real-time applications is also one of the important effects of lightweight solutions. Through spatial blocking and indexing mechanisms, lightweight models can support dynamic data and real-time application scenarios. In applications such as smart buildings and smart cities, real-time changing data can be efficiently processed and displayed to improve the timeliness and accuracy of decision-making. This real-time processing capability is essential for modern management and operations. The lightweight BIM model has a lower demand for hardware resources (such as storage, memory, and processors) and is suitable for devices with various computing capabilities. This enables BIM technology to be applied on more types of devices, including low-end computing devices and mobile terminals. The reduction in resource requirements not only saves hardware costs, but also expands the popularity of technology.
[0041] In a specific embodiment, the process of executing step S101 may specifically include the following steps:
[0042] (1) Determine the lightweight target and perform data structure analysis on the BIM model data based on the lightweight target to obtain the model topology and element relationship diagram;
[0043] (2) According to the element relationship diagram, the model elements of the BIM model data are scored by importance to obtain an element importance ranking list, and based on the element importance ranking list, a first retention threshold is set, and model elements with element importance scores lower than the first retention threshold are marked to obtain a target element set;
[0044] (3) Extract the boundaries of the geometric data in the target element set to obtain a boundary curve set, perform point set analysis on the boundary curve set, set the tolerance, iteratively calculate the vertical distance from the point to the line segment, and obtain the target boundary contour;
[0045] (4) Based on the target boundary contour, the original geometric surface of the BIM model data is reconstructed to obtain a target face set, and the target face set is subjected to normal vector analysis to calculate the normal vector angle between adjacent faces. If the normal vector angle is less than the preset angle threshold, the adjacent faces are merged to obtain the initial geometric data.
[0046] (5) Perform data redundancy analysis on the attribute data of the BIM model data, calculate the usage frequency and information entropy of each attribute field, obtain the attribute importance score table, and set the second retention threshold based on the attribute importance score table, filter the attribute fields with attribute importance scores higher than the second retention threshold, and obtain the initial attribute data;
[0047] (6) Perform resolution and complexity analysis on the material, texture, and lighting information in the BIM model data, and perform downsampling and merging according to the preset target ratio to obtain auxiliary data.
[0048] Specifically, determine the specific criteria for lightweight goals, such as reducing the file size of the model, improving rendering performance, or reducing data transmission time. Based on these goals, perform data structure analysis on the BIM model data to extract the model's topology and element relationship diagram. The model topology describes the spatial relationship between the components, while the element relationship diagram reveals the associations and dependencies between the elements in the model. Based on the element relationship diagram, the model elements of the BIM model data are scored for importance. The scoring process can be based on multiple factors, such as the element's position in the structure, its contribution to the model's integrity, its frequency of use, etc. For example, define an importance scoring formula:
[0049] ;
[0050] in, Is an element The importance rating of is the functional importance of the element, indicating how critical the element is in the structure; is the complexity of the element, such as the complexity of the geometry or the level of detail of the attribute data; is the position importance of the element, indicating the prominence of the element in the view. Adjust according to the needs of specific applications. Generate a ranked list of element importance based on importance scores. In order to optimize the data, set a first retention threshold for element importance scores. , mark the model elements with scores below the threshold to form a target element set. The elements in the set are relatively unimportant parts of the model and can be simplified or removed first. Perform boundary extraction on the geometric data in the target element set. By calculating the outer boundary of each element, a boundary curve set is obtained. Perform point set analysis on the boundary curve set and set the tolerance Then, iteratively calculate the vertical distance from each point to the nearest line segment. The formula is as follows:
[0051] ;
[0052] in is the perpendicular distance from the point to the line segment, is the vector from the point to the starting point of the line segment, is the direction vector of the line segment. Through iterative calculation and adjustment, the target boundary outline is drawn. Based on the target boundary outline, the original geometric surface of the BIM model data is reconstructed to obtain a more simplified target face set. On this basis, the normal vectors of these faces are analyzed to calculate the normal vector angles of adjacent faces. Assume that the normal vector is and , the angle formula is:
[0053] ;
[0054] If the angle Less than the preset threshold , then merge these patches to reduce the number of patches and obtain the initial geometric data. At the same time, perform data redundancy analysis on the attribute data of the BIM model data. By calculating the usage frequency and information entropy of each attribute field, generate an attribute importance score table. Information entropy The calculation formula is:
[0055] ;
[0056] in is the probability of the attribute value appearing. According to the scoring table, a second retention threshold is set , filter out the attribute fields with scores higher than the threshold to form the initial attribute data. Perform resolution and complexity analysis on the material, texture, and lighting information in the BIM model data. Obtain auxiliary data by downsampling the detail level of material maps and textures and merging similar material information. By reducing the resolution and complexity of materials by a certain ratio (e.g., 50%), the file size and rendering time can be significantly reduced.
[0057] In a specific embodiment, the process of executing step S102 may specifically include the following steps:
[0058] (1) For each vertex vi in the initial geometric data, the plane equation set Pi is calculated to obtain the vertex associated plane set, where vi represents the three-dimensional coordinates (xi, yi, zi) of the i-th vertex, Pi represents the set of all plane equations ax+by+cz+d=0 corresponding to vi, x, y, z are the coordinate variables of any point on the plane, a, b, c are the normal vector components of the plane, indicating the orientation of the plane, and satisfying a 2 +b 2 +c 2 =1, d is the constant term of the plane equation, which represents the signed distance from the plane to the origin;
[0059] (2) According to the vertex associated plane set, calculate the corresponding quadratic error matrix Qi for each vertex vi, where Qi = (aiai T ), ai is the plane equation coefficient vector [a, b, c, d] T , Qi is a 4x4 symmetric matrix, which represents the sum of the squares of the distances from vertex vi to its corresponding plane, and T represents the transpose operation of the matrix;
[0060] (3) Calculate the optimal contraction point v' for each edge e (v1, v2) in the grid. The optimal contraction point v' is obtained by solving the equation (Q1+Q2) v'=0. If the equation has no solution, then select the point with the smallest error among v1, v2 and the midpoint of the edge as the optimal contraction point v', where v1 and v2 are the two endpoints of the edge e, Q1 is the quadratic error matrix of v1, and Q2 is the quadratic error matrix of v2.
[0061] (4) Calculate the contraction cost Δ(v1, v2) of each edge e and obtain a list of edge contraction costs. Δ(v1, v2) represents the geometric error when contracting edge e to the optimal contraction point v'.
[0062] (5) According to the edge shrinkage cost list, a first priority queue of edges to be deleted is constructed, and the edges are sorted in ascending order according to the shrinkage cost Δ(v1, v2). The edge with the smallest shrinkage cost is extracted from the first priority queue of edges to be deleted and the edge shrinkage operation is performed to obtain a simplified local grid structure.
[0063] (6) Perform a topological consistency check on the simplified local mesh structure and repair non-manifold edges and vertices to obtain the first geometric data.
[0064] Specifically, for each vertex in the initial geometric data Compute the associated set of plane equations , each vertex By three-dimensional coordinates The plane equation is in the form of ,in is the coordinate variable of any point on the plane, is the normal vector component of the plane, indicating the orientation of the plane and satisfying . Constant term Represents the signed distance from the plane to the origin. With these parameters, the vertex All relevant plane equations are expressed as the set Using these plane equations, for each vertex Calculate the corresponding quadratic error matrix The quadratic error matrix The calculation formula is:
[0065] ;
[0066] in It is The coefficient vector of the plane , represents the normal vector and offset of the plane. This vector is used to calculate the vertex The sum of the squares of the distances to its corresponding plane. Is a 4x4 symmetric matrix, representing the vertex The distance error to all its associated planes is accumulated. T represents the transpose operation of the matrix. For each edge in the grid Calculate the optimal shrinkage point Solve the equation ,in and The edges The two endpoints and The quadratic error matrix. If the equation has a solution, then the solution is the optimal contraction point If the equation has no solution, then you need to Select the point with the smallest error among the midpoints of the edges as the optimal contraction point This process ensures that the contraction of the edge will bring the smallest geometric error. According to the optimal contraction point , calculate each edge The cost of shrinkage , that is, edge Shrink to the optimal shrinkage point By calculating the geometric error of the two endpoints of the edge distance, and minimize the sum of squares of these distances. The shrinkage costs of all edges are sorted into a list to build a first priority queue for edges to be deleted. In this queue, the edges are sorted from small to large according to the shrinkage cost to ensure that the edges with the smallest error are processed first. The edges with the smallest shrinkage cost are extracted from the first priority queue for edges to be deleted, and the edge shrinkage operation is performed. This operation updates the topological structure of the mesh, removes unnecessary vertices and faces, and simplifies the geometry of the mesh. A topological consistency check is performed on the simplified local mesh structure to ensure that the topological structure of the mesh remains consistent and to avoid problems with non-manifold edges and vertices. Non-manifold edges and vertices can cause incorrect display and rendering problems of geometric models. Through these steps, the first geometric data, that is, the simplified mesh structure, is obtained.
[0067] In a specific embodiment, the process of executing step S103 may specifically include the following steps:
[0068] (1) Calculating the vertex curvature of each vertex in the first geometric data to obtain a vertex curvature set, and calculating the edge importance of each edge in the mesh based on the vertex curvature set to obtain an edge importance list;
[0069] (2) Build a minimum heap based on the edge importance list and sort the edges in ascending order of importance to obtain the second priority queue of edges to be deleted;
[0070] (3) Extract the edge with the smallest importance from the second priority queue of edges to be deleted, and determine whether deleting the edge with the smallest importance will lead to topological changes. If not, mark the edge with the smallest importance as an edge to be deleted, and obtain a candidate deletion edge;
[0071] (4) Perform edge collapse operation on the candidate deletion edges to obtain the updated local grid structure, recalculate the curvature of the vertices around each vertex and the importance of the related edges, update the minimum heap, and obtain the updated priority queue of the edges to be deleted;
[0072] (5) Generate a simplified mesh according to the updated priority queue of edges to be deleted, locally retriangulate the simplified mesh to obtain a topologically optimized mesh, and perform an edge flipping operation on the topologically optimized mesh to obtain second geometric data.
[0073] Specifically, the vertex curvature is calculated for each vertex in the first geometric data. Curvature is an important indicator for measuring the degree of curvature of the local surface of the vertex, which can be estimated by calculating the difference in normal vectors between each vertex and its neighboring vertices. , curvature It can be expressed as the sum of the changes in the normal vectors of the surrounding patches. Assume that the vertex The normal vector of each connected face is , then the curvature can be approximated as:
[0074] ;
[0075] in, is the vertex The average value of all connected face normal vectors. Represents a vertex The curvature of Indicates The normal vector of each face, and is the average normal vector of all normal vectors. After obtaining the vertex curvature set, the edge importance is calculated for each edge in the mesh. The edge importance reflects the importance of the edge in maintaining the shape and characteristics of the mesh. Usually, the importance of the edge can be estimated by the curvature of the vertices at both ends of the edge, and the formula is
[0076] ;
[0077] in, It is the edge The importance of and are the curvature values of the vertices at both ends of the edge, respectively. The formula shows that the edges connected by vertices with higher curvature are more important in the mesh because they usually represent more details or features. A minimum heap is constructed based on the edge importance list. A minimum heap is a data structure that allows the minimum element to be quickly accessed and removed at any time. The minimum heap is used to quickly find and process the edge with the lowest importance, thereby gradually simplifying the mesh structure. After sorting the edges from small to large importance, a second priority queue of edges to be deleted is obtained. After extracting the edge with the lowest importance from the priority queue, it is determined whether deleting this edge will cause a change in the mesh topology. This determination includes checking whether deleting the edge will cause the appearance of non-manifold situations, such as isolated points or holes. If deleting the edge does not cause a significant change in the topology, it is marked as an edge to be deleted, and a set of candidate deletion edges is obtained. An edge collapse operation is performed on the candidate deletion edges. In the edge collapse operation, two vertices of an edge are merged into one vertex, and redundant facets are removed, thereby simplifying the geometric structure of the mesh. For example, if there is an edge connecting two unimportant small windows in a building model, collapsing this edge can effectively reduce the number of facets without significantly affecting the overall appearance. After performing edge collapse, the updated local mesh structure is obtained. The curvature of the vertices around each vertex and the importance of the related edges are recalculated to update the minimum heap. The updated priority queue of edges to be deleted will contain the new edges with the lowest importance, and the simplification process will continue. The simplified mesh is generated based on the updated priority queue of edges to be deleted. Some areas in the mesh may become irregular or distorted due to multiple edge collapses and require local retriangulation. The retriangulation process restores the regularity and aesthetics of the mesh by re-dividing the triangular facets in these areas. Perform edge flipping operations on the topology optimized mesh to optimize the shape of the triangles to ensure that the shape of each triangle is close to a regular triangle, improving the rendering quality and model stability.
[0078] In a specific embodiment, the process of executing step S104 may specifically include the following steps:
[0079] (1) quantizing the vertex coordinates in the second geometric data to obtain quantized vertex data, and predictively encoding the quantized vertex data to obtain vertex residual data;
[0080] (2) Perform entropy coding on vertex residual data and dynamically adjust the coding model according to the residual distribution characteristics to obtain a compressed vertex stream;
[0081] (3) Encoding the topological information in the second geometric data to obtain topologically encoded data, and performing entropy encoding on the topologically encoded data to obtain a compressed topological stream;
[0082] (4) Merge the compressed vertex stream and the compressed topology stream, and add the Draco file header information to obtain lightweight geometry data;
[0083] (5) Perform structural analysis on the initial attribute data to obtain key-value pairs and array structures, and convert the key-value pairs and array structures into JSON format to obtain initial JSON data;
[0084] (6) compressing the key name of the initial JSON data to obtain JSON data with compressed key names, and optimizing the numerical precision of the JSON data with compressed key names to obtain JSON data with optimized precision;
[0085] (7) Compress the precision-optimized JSON data to obtain lightweight attribute data.
[0086] Specifically, determine the quantization step size, which determines the accuracy of the coordinate value. Assume that the original range of the vertex coordinates on a certain axis is , dividing the range into discrete values, where is the number of bits required. The quantization formula can be expressed as:
[0087] ;
[0088] in, is the original coordinate value, is the quantized coordinate value. Quantization reduces the precision of the data but retains the overall geometric shape by converting floating-point coordinates into integer values. Predictive coding is performed on the quantized vertex data. Predictive coding is a data compression technique that achieves compression by predicting the value of the current data point and recording the difference between the predicted value and the actual value (i.e., the residual). For vertex data, the previous vertex position is usually selected as the predicted value. Assume that The predicted value of the vertex is , the actual value is , then the vertex residual data It can be expressed as:
[0089] ;
[0090] in, represents the residual data, are the actual vertex coordinates, is the predicted value. In this way, the change of vertex position is represented as a smaller residual value, which is convenient for further compression. The vertex residual data is entropy encoded. Entropy coding is a lossless data compression method that assigns codes of different lengths according to the probability distribution of data. Common entropy coding methods include Huffman coding and arithmetic coding. By calculating the probability distribution of each residual value, the coding model is dynamically adjusted to minimize the coding length and obtain the compressed vertex stream. The topological information in the second geometric data is encoded. Topological information usually includes vertex connection relationships, which can be encoded as a series of triangles or polygons. For these topological data, indexing is first performed to convert the connection relationship of the vertices into an index list, and then the index list is entropy encoded to obtain a compressed topological stream. The compressed vertex stream and the topological stream are merged, and the Draco file header information is added, which includes the data format version, the number of vertices and faces, quantization parameters, etc. The obtained lightweight geometric data contains all the necessary information of the model, while significantly reducing the data volume, which is suitable for transmission and storage. The initial attribute data is structurally analyzed to identify the key-value pairs and array structures therein. These structures are usually used to describe the material, color, texture and other properties of the model. Convert these key-value pairs and array structures into JSON format to obtain the initial JSON data. JSON is a lightweight data exchange format suitable for network transmission. Perform key name compression on the initial JSON data. Reduce the amount of data by replacing longer key names with short identifiers. Then optimize the numerical precision of the JSON data with compressed key names, reduce the precision of the numerical data, and reduce the data size. Compress the precision-optimized JSON data. Common compression algorithms include Gzip and Zlib, which can significantly reduce the size of text data and ultimately obtain lightweight attribute data.
[0091] In a specific embodiment, the process of executing step S105 may specifically include the following steps:
[0092] (1) Decompress the lightweight geometry data to obtain the original mesh structure, and decompress and parse the lightweight attribute data into JSON to obtain structured attribute data;
[0093] (2) The original mesh structure and structured attribute data are merged, and a scene graph structure that complies with the glTF2.0 specification is constructed to obtain a lightweight BIM model;
[0094] (3) Calculate the bounding volume hierarchy of the lightweight BIM model, select the longest axis for division, recursively construct a binary tree, and obtain the spatial index structure;
[0095] (4) Based on the spatial index structure, the lightweight BIM model is divided into LOD levels to obtain a node importance list. According to the node importance list, the mesh of each LOD level is simplified to obtain a multi-level simplified mesh.
[0096] (5) Generate a line map for each LOD level of the multi-level simplified mesh to obtain an LOD model with a normal map, and perform texture compression on the LOD model with the normal map to obtain an LOD model with a compressed texture;
[0097] (6) Construct an LOD switching strategy and package the LOD model of compressed texture, spatial index structure and LOD switching strategy to obtain a multi-level detail lightweight BIM model.
[0098] Specifically, the corresponding decoding algorithm is used to restore the compressed data to the original mesh structure. Lightweight geometric data is usually processed by quantization, predictive coding and entropy coding, so the decompression process needs to gradually reverse these processes. Entropy decoding is performed on the compressed vertex stream to restore the original vertex residual data. According to the stored quantization information, these vertex data are dequantized to restore the original floating-point coordinates. The quantized integer value is converted back to the original floating-point coordinate range. The formula is:
[0099] ;
[0100] in, is the dequantized coordinate, and are the minimum and maximum values of the coordinate range, is the quantized integer value, is the number of quantized bits. At the same time, the lightweight attribute data is decompressed, which usually includes decoding the key-value pairs and array structures of the JSON data. JSON parsing reads the compressed ISON data and restores it to its original structured form. The obtained structured attribute data contains various information of the BM model, such as material, color, texture and other details. After decompression and parsing, the original mesh structure and structured attribute data are merged. In order to construct a scene graph structure that complies with the glTF2.0 specification, the geometric data and attribute data are organized in the standard format of glTF. glTF2.0 is an efficient 3D model transmission format that supports various complex scene descriptions, including nodes, meshes, materials and animations. By importing the decompressed mesh and attribute data into the glTF structure, a lightweight BIM model is obtained. In order to optimize rendering efficiency, the bounding volume hierarchy is calculated for the lightweight BIM model. This calculation involves determining the bounding box of each model part and selecting the longest axis for division, thereby recursively constructing a binary tree structure to form a spatial index structure. By dividing the model space into several levels of bounding volumes, the efficiency of frustum culling and occlusion culling is improved, thereby optimizing rendering performance. Based on the spatial index structure, the lightweight BIM model is divided into LOD levels. LOD technology allows different levels of detail to be used at different distances and viewing angles, thereby balancing rendering quality and performance. According to the spatial index structure, each node in the BIM model is scored for importance to form a node importance list. The importance score can be based on multiple factors, such as perspective relevance, model details, and material properties. The formula can be expressed as:
[0101] ;
[0102] in, Is a node The importance rating of is the visibility score of the node, is the complexity score of the node, and is a weight factor. According to the node importance list, mesh simplification is performed for each LOD level to reduce the number of vertices and faces of the mesh while retaining as many visual features as possible to form a multi-level simplified mesh. For each LOD level, a line map is generated to enhance the visual details. Line maps add fine lines and normal information to the surface of the model, so that the model can still show rich details even with low geometric details. After the line map is generated, the LOD model with normal map is texture compressed. The purpose of compressing textures is to reduce the amount of data while maintaining high texture quality. Common texture compression algorithms include JPEG, PNG, or specialized 3D texture compression technologies such as S3TC. Construct an LOD switching strategy to decide how to switch between different LOD levels at different distances and viewing angles, thereby optimizing rendering performance. The LOD switching strategy can decide when to switch to a lower or higher LOD level based on factors such as the screen area or distance of the node. The LOD model of compressed textures, the spatial index structure, and the LOD switching strategy are packaged to obtain a multi-level detail lightweight BIM model. For example, in an architectural scene, low-detail models are used for distant views to save computing resources, while high-detail models are used for close views to ensure the refinement of visual effects.
[0103] In a specific embodiment, the process of executing step S106 may specifically include the following steps:
[0104] (1) Perform octree space partitioning on the lightweight model with multiple levels of detail to obtain the initial space partitioning structure, and calculate the geometric complexity index of each leaf node in the initial space partitioning structure to obtain a node complexity list;
[0105] (2) According to the node complexity list, the leaf nodes whose geometric complexity index exceeds the geometric complexity threshold are redivided to obtain the optimized space division structure;
[0106] (3) Extract the geometric and attribute data contained in each leaf node in the optimized space partition structure, build an independent sub-model, and calculate the bounding sphere radius and center point of the sub-model to obtain a block-based lightweight model;
[0107] (4) Perform frustum culling optimization on each sub-model in the block lightweight model to obtain a list of visible blocks;
[0108] (5) Perform occlusion culling on the visible block list to obtain a set of unoccluded blocks, and select the set of unoccluded blocks to obtain a rendering block set;
[0109] (6) Organizing the rendering block sets into rendering batches, merging blocks with the same material, generating an optimized rendering data structure, and loading the optimized rendering data structure into the rendering engine for real-time rendering to obtain real-time rendering results.
[0110] Specifically, the lightweight model with multiple levels of detail is partitioned using an octree space. An octree is a data structure used for partitioning three-dimensional space, which recursively divides the space into eight subspaces (called eighth spaces). An axis-aligned bounding box is defined for the entire scene, and then it is divided into eight subspaces based on the three-dimensional center point of the scene. For each subspace, if the contained geometric complexity exceeds a predetermined threshold, further recursive partitioning is performed until the complexity limit is met or the size of the minimum partitioning unit is reached. A geometric complexity index is calculated for each leaf node in the initial spatial partitioning structure. Geometric complexity is usually determined by the number of vertices and facets in the node. Define geometric complexity index for:
[0111] ;
[0112] in, Indicates The number of vertices in a node, Indicates the number of patches, Is a weight factor used to balance the contribution of vertices and faces in complexity. According to the formula, the complexity index of each leaf node is calculated and a node complexity list is generated. According to the node complexity list, identify which nodes have a geometric complexity that exceeds a preset threshold. For these nodes, redivision is performed to further refine the spatial division structure. This redivision continues to recursively apply octree partitioning until the complexity of all nodes is below the threshold. In the optimized spatial division structure, the geometry and attribute data contained in each leaf node are extracted to construct an independent sub-model. For each sub-model, its bounding sphere radius and center point are calculated. The bounding sphere is a spherical area that can enclose all geometric elements of the sub-model. Its radius and center point It can be calculated by the following formula:
[0113] ;
[0114] in, It is the sub-model The coordinates of the vertices, is the total number of vertices, Represents the Euclidean distance from the vertex to the center point. The calculation of the bounding sphere helps with subsequent frustum culling and occlusion culling optimization. Perform frustum culling optimization on each sub-model in the block lightweight model. Frustum culling refers to the culling of parts that are not in the field of view according to the camera perspective during the rendering process, thereby reducing the amount of rendering calculations. By calculating whether the bounding sphere of each sub-model intersects with the frustum, it is decided whether to cull the sub-model. The resulting visible block list only contains the parts within the frustum. Based on the visible block list, occlusion culling is performed. By detecting whether some blocks are completely occluded by other blocks, those invisible blocks are culled. Occlusion culling usually uses the depth buffer (Z-buffer) technology to record the farthest depth of each pixel in the scene to determine which blocks are occluded by the front geometry. The resulting unoccluded block set only contains those parts that are not occluded by other objects. Select from the unoccluded block set to obtain the final rendering block set. According to the needs of the scene and performance constraints, the most important or detailed parts are selected for rendering. Organize rendering tile sets into rendering batches, and merge tiles with the same material to reduce state switching during rendering. Generate an optimized rendering data structure, including merged geometry data, material, and texture information. Load the optimized rendering data structure into the rendering engine for real-time rendering. The real-time rendering results show an optimized lightweight model with efficient rendering performance and rich visual details.
[0115] In a specific embodiment, the execution step extracts the geometry and attribute data contained in each leaf node in the optimized space partition structure, constructs an independent sub-model, and calculates the bounding sphere radius and center point of the sub-model to obtain a block-based lightweight model, which may specifically include the following steps:
[0116] (1) Perform a depth-first traversal on the optimized space partition structure to obtain a set of leaf nodes;
[0117] (2) Perform boundary analysis on the geometric data of each leaf node in the leaf node set, and obtain an axis-aligned bounding box by calculating the coordinate extreme values of all vertices in the geometric data of each leaf node;
[0118] (3) According to the diagonal length of the axis-aligned bounding box, the geometric data of each leaf node is grid-resampled to obtain the resampled geometric data;
[0119] (4) Associating and matching the resampled geometric data with the attribute data in each leaf node to obtain the sub-model data set, and analyzing the sub-model data set to construct the local coordinate system of the sub-model;
[0120] (5) Based on the local coordinate system, the data points in the sub-model data set are transformed to obtain the center point and bounding sphere radius of the sub-model;
[0121] (6) Generate a corresponding block lightweight model based on the sub-model dataset, bounding sphere radius and center point.
[0122] Specifically, in the depth-first traversal of the octree, the system starts from the root node, visits each child node in turn until the deepest leaf node, and then backtracks to the last node that was not fully visited to continue traversing. In this way, a set of all leaf nodes for the entire space division is obtained. This process ensures that the system has complete processing of every sub-area in the model without missing any details. The geometric data of each leaf node in the leaf node set is subjected to boundary analysis to determine the spatial range and boundary conditions of each sub-model. The core of the boundary analysis is to calculate the coordinate extreme values of all vertices in each leaf node, that is, to find the minimum and maximum values of all vertices on each coordinate axis. These extreme values are used to construct an axis-aligned bounding box (AABB), which defines the minimum enclosing rectangle of the model. The calculation formula of AABB is:
[0123] ;
[0124] ;
[0125] in, Represents the three coordinate axes of the vertex. According to the diagonal length of the AABB, the geometric data of each leaf node is meshed and resampled to reduce the number of vertices and faces while maintaining the main features of the model. The resampling process may involve techniques such as simplifying the surface and reducing vertex density to reduce data complexity. The formula for calculating the diagonal length is:
[0126] ;
[0127] in, Represents the diagonal length of the AABB. Based on this length, determine the accuracy and range of the resampling. After the resampling is completed, the resampled geometric data is associated and matched with the attribute data in each leaf node to ensure the integrity and consistency of the geometric and attribute data, and obtain the sub-model data set. Attribute data includes material, color, texture, etc., which need to correspond accurately to the geometric data to ensure the visual effect of the model. Analyze the sub-model data set and construct the local coordinate system of the sub-model. The establishment of a local coordinate system helps to standardize and simplify subsequent processing, including model transformation, display and storage. The origin of the local coordinate system is usually selected at the geometric center of the sub-model, and the direction axis is determined according to the main geometric features of the model. Based on the local coordinate system, the data points in the sub-model data set are transformed. Through the transformation, the center point and the radius of the enclosing sphere of the sub-model are obtained. Center point Calculated from the average value of all vertices:
[0128] ;
[0129] in, It is The position of the vertices, is the total number of vertices. The radius of the bounding sphere is the maximum distance from all vertices to the center point:
[0130] ;
[0131] These parameters define the spatial range and position of the sub-model, which helps further space management and display optimization. Generate the corresponding block lightweight model according to the sub-model dataset, bounding sphere radius and center point. The block model reduces the data volume and complexity while preserving the main geometric and visual features of the model. For example, in a complex architectural scene, some parts such as walls or floors may contain a large number of repeated structures or details. Through resampling and transformation of the local coordinate system, these parts can be effectively simplified without significantly affecting the overall visual effect.
[0132] In a specific embodiment, the execution step performs occlusion culling on the visible block list to obtain a set of unoccluded blocks, and the process of selecting the set of unoccluded blocks to obtain a rendering block set may specifically include the following steps:
[0133] (1) Depth-sort each block in the visible block list to obtain a sorted block list;
[0134] (2) Construct a hierarchical Z-buffer structure, divide the view cone into m×m grids, each grid corresponds to a maximum depth value, and obtain the initial Z-buffer structure, where m is a positive integer;
[0135] (3) Traverse the sorted block list, perform frustum clipping and occlusion culling on the bounding sphere of each block, and obtain a set of unobstructed blocks;
[0136] (4) Calculate the overlap between the 2D projection polygon of each block in the unobstructed block set and the corresponding grid in the initial Z-buffer structure to obtain an overlapping grid set;
[0137] (5) The importance of the blocks in the overlapping mesh set is scored to obtain a scored block set. Based on the preset maximum number of rendering triangles, the blocks in the scored block set are selected from high to low according to the scores, and the geometric complexity of the selected blocks is accumulated until the maximum number of rendering triangles is reached to obtain a rendering block set.
[0138] Specifically, each block in the visible block list is sorted by depth. Depth usually refers to the distance from the camera to the object. The depth of the block is determined by calculating the distance from a representative point in the block (such as the center point of the bounding sphere of the block) to the camera. The formula is:
[0139] ;
[0140] in, Indicates the depth value, are the coordinates of the block center point, is the position of the camera. According to this formula, the depth of each block is calculated and sorted from far to near by depth value to obtain a sorted block list, ensuring that in the subsequent occlusion culling process, the blocks far away from the camera are processed first, so that they can be occluded by the blocks closer to the camera when necessary. Construct a hierarchical Z-buffer structure and divide the view cone into grids, each grid corresponds to a maximum depth value, and the initial Z-buffer structure is obtained. In this process, the Z-buffer is used to record the farthest depth value of each pixel to ensure that the occlusion relationship is correctly handled during rendering. is a positive integer, which indicates the resolution of the grid. The higher the resolution, the higher the accuracy of occlusion culling. The sorted list of blocks is traversed, and the bounding sphere of each block is subjected to frustum clipping and occlusion culling. Frustum clipping refers to checking whether the bounding sphere of the block intersects with the camera's frustum. If the bounding sphere is completely outside the frustum, the block can be culled. Occlusion culling determines whether it is occluded by comparing the depth value of the block with the depth value in the Z-buffer. If the depth of a block is greater than the depth of the corresponding position in the current Z-buffer, it may be completely occluded by the previous block, so it can be culled. Through these steps, a set of unoccluded blocks is obtained. The overlap between the 2D projection polygon of each block in the set of unoccluded blocks and the corresponding grid in the initial Z-buffer structure is calculated to determine the coverage of these blocks in screen space. The 3D geometry of each block is projected onto a 2D plane, and the overlap between these projections and the Z-buffer grid is calculated. The overlap can be calculated by measuring the area coverage or pixel occupancy ratio to obtain an overlapping grid set. The importance of the blocks in the overlapping grid set is scored. The scoring criteria can include the geometric complexity of the blocks, material properties, user interest points, etc. The formula can be expressed as:
[0141] ;
[0142] in, It is block The importance rating of is the geometric complexity of the tile, such as the number of vertices or faces; is a material property score, such as the complexity or reflectivity of the material; is the user interest score, i.e., the part of the model that the user is particularly interested in; is the corresponding weight factor. The combination of these scoring indicators ensures that important tiles are rendered first. According to the preset maximum number of rendered triangles, the tiles in the scored tile set are selected from high to low according to the score. The geometric complexity of the selected tiles is accumulated until the maximum number of rendered triangles is reached. Ensure that the most important tiles are rendered first when resources are limited, optimize visual effects and rendering efficiency. Through the above steps, the final rendering tile set contains all the tiles that need to be rendered.
[0143] The above describes the BIM fast lightweight method in the embodiment of the present invention. The following describes the BIM fast lightweight device in the embodiment of the present invention. Figure 2 In one embodiment of the present invention, a device for rapid lightweighting of BIM includes:
[0144] The classification and screening module 201 is used to determine the lightweight target and classify and screen the BIM model data to obtain initial geometry data, initial attribute data and auxiliary data;
[0145] A mesh simplification module 202 is used to perform mesh simplification processing on the initial geometric data using a Quadric Error Metrics algorithm to obtain first geometric data;
[0146] The processing module 203 is used to perform polygon edge deletion and re-triangulation processing on the first geometric data by using a Decimation algorithm to obtain second geometric data;
[0147] The compression module 204 is used to compress the second geometry data using the Draco tool to obtain lightweight geometry data, and to convert and compress the initial attribute data into JSON format to obtain lightweight attribute data;
[0148] The conversion module 205 is used to convert the format of the lightweight geometric data and the lightweight attribute data to obtain a lightweight BIM model, and perform layered detail processing on the lightweight BIM model to generate a lightweight model with multiple levels of details;
[0149] The rendering module 206 is used to spatially divide and optimize the lightweight model with multiple levels of details to obtain a divided lightweight model, and import the divided lightweight model into a rendering engine for real-time rendering to obtain a real-time rendering result.
[0150] Through the synergy of the above-mentioned components, the file size of the present invention is significantly reduced. Through geometric simplification, data compression and format conversion, the file size of the BIM model is greatly reduced. The reduced file size helps to transfer and store data more efficiently, especially in a network environment with limited bandwidth. Improve rendering and loading performance. Through mesh simplification and the use of level of detail models (LOD), the rendering and loading performance of the model on various devices (such as mobile devices, web browsers, VR / AR devices) is significantly improved. Users can view and operate BIM models more quickly, improving the user experience. Retain key data. Despite the lightweight processing, key geometric information and attribute data are retained to ensure that the model has no significant loss in accuracy and integrity. Through data screening and classification, the core data required for the project is retained to support subsequent design, construction and operation and maintenance work. Improve data compatibility and interoperability, convert to a common lightweight data format (such as glTF, IFC, OBJ, etc.), and improve the compatibility and interoperability of the model between different platforms and applications. The lightweight model can be used in a variety of software environments, reducing the complexity of data conversion and adaptation. Optimized workflows simplify the workflow of BIM model processing through standardized lightweight processes and tool integration. After the workflow is optimized, the team can manage and apply BIM data more efficiently, reducing the possibility of manual operations and errors. Support dynamic data and real-time applications, through spatial block and indexing mechanisms, support dynamic data and real-time application scenarios. In applications such as smart buildings and smart cities, real-time changing data can be efficiently processed and displayed to improve the timeliness and accuracy of decision-making. Reduce the demand for hardware resources. The lightweight BIM model has lower demand for hardware resources (such as storage, memory, and processors) and is suitable for devices with various computing capabilities. BIM technology can be applied on more types of devices, including low-end computing devices and mobile terminals. More convenient collaboration. The lightweight model is easier to share and collaborate between teams, reducing the time for file transfer and loading. Support efficient collaboration between multiple teams and multiple disciplines to improve the overall work efficiency of the project.
[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0152] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0153] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A BIM fast lightweight method, characterized in that: The method comprises: Determine the lightweight target, and classify and screen the BIM model data to obtain initial geometric data, initial attribute data and auxiliary data; specifically include: determine the lightweight target, and perform data structure analysis on the BIM model data according to the lightweight target to obtain the model topology and element relationship diagram; according to the element relationship diagram, score the importance of the model elements of the BIM model data to obtain an element importance ranking list, and based on the element importance ranking list, set a first retention threshold, mark the model elements with element importance scores lower than the first retention threshold, and obtain a target element set; perform boundary extraction on the geometric data in the target element set to obtain a boundary curve set, and perform point set analysis on the boundary curve set, set a tolerance, iteratively calculate the vertical distance from the point to the line segment, and obtain the target boundary contour; based on the target boundary contour, reconstruct the original geometric surface of the BIM model data to obtain a target facet set, and perform normal vector analysis on the target facet set, calculate the normal vector angle of adjacent facets, and if the normal vector angle is less than a preset angle threshold, merge the adjacent facets to obtain initial geometric data; perform data redundancy analysis on the attribute data of the BIM model data, calculate the usage frequency and information entropy of each attribute field, obtain an attribute importance scoring table, and set a second retention threshold according to the attribute importance scoring table, filter the attribute fields with attribute importance scores higher than the second retention threshold, and obtain initial attribute data; perform resolution and complexity analysis on the material, texture and lighting information in the BIM model data, perform downsampling and merging processing according to a preset target ratio, and obtain auxiliary data; Using a Quadric Error Metrics algorithm to perform mesh simplification processing on the initial geometric data to obtain first geometric data; Deleting polygon edges and re-triangulating the first geometric data by using a Decimation algorithm to obtain second geometric data; Using the Draco tool to compress the second geometric data to obtain lightweight geometric data, and converting and compressing the initial attribute data into JSON format to obtain lightweight attribute data; Performing format conversion on the lightweight geometric data and the lightweight attribute data to obtain a lightweight BIM model, and performing hierarchical detail processing on the lightweight BIM model to generate a lightweight model with multiple levels of details; The lightweight model of the multi-level details is spatially divided and optimized to obtain a block lightweight model, and the block lightweight model is imported into a rendering engine for real-time rendering to obtain a real-time rendering result; specifically comprising: performing octree spatial division on the lightweight model of the multi-level details to obtain an initial spatial division structure, and calculating a geometric complexity index for each leaf node in the initial spatial division structure to obtain a node complexity list; according to the node complexity list, the leaf nodes whose geometric complexity index exceeds the geometric complexity threshold are re-divided to obtain an optimized spatial division structure; depth-first traversal is performed on the optimized spatial division structure to obtain leaf nodes. The method comprises the steps of: performing boundary analysis on the geometric data of each leaf node in the leaf node set, and obtaining an axis-aligned bounding box by calculating the coordinate extreme values of all vertices in the geometric data of each leaf node; performing grid resampling on the geometric data of each leaf node according to the diagonal length of the axis-aligned bounding box to obtain the resampled geometric data; performing association matching on the resampled geometric data and the attribute data in each leaf node to obtain a sub-model data set, and analyzing the sub-model data set to construct a local coordinate system of the sub-model; performing coordinate transformation on the data points in the sub-model data set based on the local coordinate system to obtain the center point and the radius of the bounding sphere of the sub-model; and performing a coordinate transformation on the data points in the sub-model data set according to the sub-model. The data set, the radius of the bounding sphere and the center point generate a lightweight model of the corresponding block; perform frustum culling optimization on each sub-model in the lightweight model of the block to obtain a visible block list; perform depth sorting on each block in the visible block list to obtain a sorted block list; construct a hierarchical Z-buffer structure, divide the frustum into m×m grids, each grid corresponds to a maximum depth value, and obtain an initial Z-buffer structure, where m is a positive integer; traverse the sorted block list, perform frustum clipping and occlusion culling on the bounding sphere of each block, and obtain an unobstructed block set; each block in the unobstructed block set is sorted. The overlapping degree of the 2D projection polygon and the corresponding grid in the initial Z-buffer structure is calculated to obtain an overlapping grid set; the importance of the blocks in the overlapping grid set is scored to obtain a scored block set, and according to a preset maximum number of rendering triangles, the blocks in the scored block set are selected from high to low according to the scores, and the geometric complexity of the selected blocks is accumulated until the maximum number of rendering triangles is reached to obtain a rendering block set; the rendering block set is organized into a rendering batch, the blocks with the same material are merged to generate an optimized rendering data structure, and the optimized rendering data structure is loaded into a rendering engine for real-time rendering to obtain a real-time rendering result.
2. The BIM rapid lightweight method according to claim 1 is characterized in that: The using of the Quadric ErrorMetrics algorithm to perform mesh simplification processing on the initial geometric data to obtain first geometric data includes: For each vertex vi in the initial geometric data, a plane equation set Pi is calculated to obtain a vertex associated plane set, where vi represents the three-dimensional coordinates (xi, yi, zi) of the i-th vertex, Pi represents the set of all plane equations ax+by+cz+d=0 corresponding to vi, x, y, z are the coordinate variables of any point on the plane, a, b, c are the normal vector components of the plane, indicating the orientation of the plane, satisfying a 2 +b 2 +c 2 =1, d is the constant term of the plane equation, which represents the signed distance from the plane to the origin; According to the vertex associated plane set, the corresponding quadratic error matrix Qi is calculated for each vertex vi, where Qi=(aiai T ), ai is the plane equation coefficient vector [a, b, c, d] T , Qi is a 4x4 symmetric matrix, which represents the sum of the squares of the distances from vertex vi to its corresponding plane, and T represents the transpose operation of the matrix; Calculate the optimal contraction point v' for each edge e (v1, v2) in the grid. The optimal contraction point v' is obtained by solving the equation (Q1+Q2) v'=0. If the equation has no solution, select the point with the smallest error among v1, v2 and the midpoint of the edge as the optimal contraction point v', where v1 and v2 are the two endpoints of the edge e, Q1 is the quadratic error matrix of v1, and Q2 is the quadratic error matrix of v2; Calculate the contraction cost Δ(v1, v2) of each edge e and obtain a list of edge contraction costs. Δ(v1, v2) represents the geometric error when contracting edge e to the optimal contraction point v'. According to the edge shrinkage cost list, a first priority queue of edges to be deleted is constructed, edges are sorted in ascending order according to shrinkage cost Δ(v1, v2), edges with the smallest shrinkage cost are extracted from the first priority queue of edges to be deleted, and edge shrinkage operation is performed to obtain a simplified local grid structure; A topological consistency check is performed on the simplified local mesh structure and non-manifold edges and vertices are repaired to obtain first geometric data.
3. The BIM rapid lightweight method according to claim 2 is characterized in that: The method of performing polygon edge deletion and re-triangulation processing on the first geometric data by using a Decimation algorithm to obtain second geometric data includes: Calculating vertex curvature for each vertex in the first geometric data to obtain a vertex curvature set, and calculating edge importance for each edge in the mesh based on the vertex curvature set to obtain an edge importance list; Construct a minimum heap based on the edge importance list, and sort the edges in ascending order of importance to obtain a second priority queue of edges to be deleted; Extracting the edge with the smallest importance from the second priority queue of edges to be deleted, determining whether deleting the edge with the smallest importance will cause a topology change, and if not, marking the edge with the smallest importance as an edge to be deleted, thereby obtaining a candidate deletion edge; Performing edge collapse operation on the candidate deletion edges to obtain an updated local grid structure, recalculating the curvature of vertices around each vertex and the importance of related edges, updating the minimum heap, and obtaining an updated priority queue of edges to be deleted; A simplified mesh is generated according to the updated priority queue of edges to be deleted, the simplified mesh is locally retriangulated to obtain a topologically optimized mesh, and an edge flipping operation is performed on the topologically optimized mesh to obtain second geometric data.
4. The BIM rapid lightweight method according to claim 1 is characterized in that: The using of the Draco tool to compress the second geometric data to obtain lightweight geometric data, and converting and compressing the initial attribute data into JSON format to obtain lightweight attribute data, includes: quantizing the vertex coordinates in the second geometric data to obtain quantized vertex data, and predictively encoding the quantized vertex data to obtain vertex residual data; Performing entropy coding on the vertex residual data, and dynamically adjusting the coding model according to residual distribution characteristics to obtain a compressed vertex stream; Encoding the topological information in the second geometric data to obtain topologically encoded data, and performing entropy encoding on the topologically encoded data to obtain a compressed topological stream; Merging the compressed vertex stream and the compressed topology stream, and adding Draco file header information to obtain lightweight geometry data; Performing structural analysis on the initial attribute data to obtain key-value pairs and array structures, and converting the key-value pairs and the array structures into JSON format to obtain initial JSON data; Performing key name compression on the initial JSON data to obtain JSON data with compressed key names, and performing numerical precision optimization on the JSON data with compressed key names to obtain JSON data with optimized precision; The precision-optimized JSON data is compressed to obtain lightweight attribute data.
5. The BIM rapid lightweight method according to claim 1 is characterized in that: The step of converting the format of the lightweight geometric data and the lightweight attribute data to obtain a lightweight BIM model, and performing layered detail processing on the lightweight BIM model to generate a lightweight model with multiple levels of details includes: Decompressing the lightweight geometric data to obtain an original mesh structure, and decompressing and JSON parsing the lightweight attribute data to obtain structured attribute data; The original grid structure and the structured attribute data are merged, and a scene graph structure conforming to the glTF2.0 specification is constructed to obtain a lightweight BIM model; The bounding volume hierarchy structure of the lightweight BIM model is calculated, and the longest axis is selected for division, and a binary tree is recursively constructed to obtain a spatial index structure; Based on the spatial index structure, the lightweight BIM model is divided into LOD levels to obtain a node importance list, and according to the node importance list, each LOD level is mesh simplified to obtain a multi-level simplified mesh; Generate a line map for each LOD level of the multi-level simplified grid to obtain an LOD model with a normal map, and perform texture compression on the LOD model with the normal map to obtain an LOD model with a compressed texture; An LOD switching strategy is constructed, and the LOD model of the compressed texture, the spatial index structure and the LOD switching strategy are packaged to obtain a multi-level detail lightweight BIM model.
6. A BIM fast and lightweight device, characterized in that: A method for performing BIM rapid lightweighting according to any one of claims 1 to 5, wherein the BIM rapid lightweighting device comprises: The classification and screening module is used to determine the lightweight target and classify and screen the BIM model data to obtain the initial geometry data, initial attribute data and auxiliary data; A mesh simplification module, used for performing mesh simplification processing on the initial geometric data by using a Quadric Error Metrics algorithm to obtain first geometric data; A processing module, configured to perform polygon edge deletion and re-triangulation processing on the first geometric data by using a Decimation algorithm to obtain second geometric data; A compression module, used to compress the second geometric data using a Draco tool to obtain lightweight geometric data, and to convert and compress the initial attribute data into a JSON format to obtain lightweight attribute data; A conversion module, used for performing format conversion on the lightweight geometric data and the lightweight attribute data to obtain a lightweight BIM model, and performing hierarchical detail processing on the lightweight BIM model to generate a lightweight model with multiple levels of details; The rendering module is used to spatially divide and optimize the lightweight model with multiple levels of details to obtain a divided lightweight model, and import the divided lightweight model into a rendering engine for real-time rendering to obtain a real-time rendering result.
Citation Information
Patent Citations
LOD-based BIM model lightweight construction and display method
CN114283231A
BIM data processing system for BIM data format conversion
KR101465481B1