Method for generating three-dimensional building GLTF file based on index compression
Through the technology based on index compression and dynamic Huffman encoding, the problem of GLTF file size is solved, efficient file compression and transmission is achieved, the quality and accuracy of the model are maintained, and it is suitable for high-performance rendering applications.
Patent Information
- Application Number
- CN202411356763.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-14
AI Technical Summary
The existing GLTF file compression method ignores redundancy and repetition when processing indexed data, resulting in a decline in model quality and difficulty in effectively reducing file size, which affects transmission efficiency and loading speed.
Using an index compression method, the hash table classification index structure is established, and the translation matrix is calculated to perform spatial transformation of the polyhedral structure. Combined with the dynamic Huffman coding algorithm, the Mesh data and vertex merging are optimized, redundant data is reduced, and efficient GLTF is generated. document.
It significantly reduces the size of GLTF files, improves data transmission efficiency and loading speed, maintains the quality and accuracy of the model, and is suitable for high-performance rendering applications such as virtual reality and game development.
Smart Images

Figure CN119313847A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional modeling, and in particular to a method for generating a three-dimensional building GLTF file based on index compression. Background Art
[0002] In the fields of modern architectural design, virtual reality, and game development, 3D modeling technology has been widely used, especially in virtual display and architectural design, the use of 3D architectural models is becoming more and more common. GLTF is an open standard file format developed by Khronos Group, which is designed to efficiently transmit and load 3D model data. The GLTF format is portable, efficient, and easy to parse, and is widely used in WebGL, virtual reality (VR), augmented reality (AR), and game development. GLTF files usually include geometry information, material information, texture information, etc., and describe these data in JSON format, while storing actual data in binary files. This design enables GLTF files to be loaded and parsed quickly, and is suitable for real-time rendering applications with high performance requirements. However, as the complexity of 3D models increases, the size of GLTF files is also increasing, resulting in increased storage and transmission costs, while affecting the loading speed of 3D models and user experience.
[0003] Existing GLTF file compression methods mainly focus on the simplification of geometric data and the compression of texture images. However, these methods usually lead to a decrease in model quality. In addition, when processing index data (i.e., vertex index), traditional compression algorithms often ignore the redundancy and repetitiveness of index data and fail to fully utilize the potential of index compression. This makes it difficult to effectively reduce the file size while ensuring the details and accuracy of the model. Therefore, how to effectively reduce the size of GLTF files and improve file transmission efficiency and loading speed while maintaining model quality has become an urgent problem to be solved.
[0004] Therefore, how to provide a method for generating a three-dimensional building GLTF file based on index compression is a problem that those skilled in the art need to solve urgently. Summary of the invention
[0005] One object of the present invention is to propose a method for generating a three-dimensional building GLTF file based on index compression. By utilizing improved index compression technology and dynamic Huffman coding algorithm, the present invention effectively reduces the size of the GLTF file while maintaining the quality of the three-dimensional model. Specifically, the present invention describes in detail how to achieve efficient file compression and storage through steps such as index optimization, geometric data simplification, vertex merging and dynamic encoding. Compared with traditional compression methods, the technical solution of the present invention can not only better handle redundant and duplicate data in the model, but also dynamically adapt to changes in data streams, thereby improving the efficiency of data transmission and loading speed. In addition, the solution of the present invention also has the advantages of high security, high model fidelity and fast transmission efficiency.
[0006] A method for generating a three-dimensional building GLTF file based on index compression according to an embodiment of the present invention comprises the following steps:
[0007] S1, collect the three-dimensional coordinate data of the building and use it as initial input data;
[0008] S2. Group the three-dimensional coordinate data according to the floors of the building, and classify the data based on the building type, size and direction to form a classification index structure based on a hash table;
[0009] S3, selecting a polyhedron structure from the classification index structure based on the hash table as a benchmark model, recording its Mesh data and vertex coordinate information, and marking it as a reference model;
[0010] S4, calculating the translation matrix T of other polyhedral structures relative to the reference model, where the translation matrix T is used to perform spatial transformation on the three-dimensional coordinate data of other polyhedrons;
[0011] S5. Based on the coordinate data aligned with the reference model, the Mesh data of the benchmark model is appropriately transformed, the Mesh data of other polyhedrons is generated according to the index compression method, and the Mesh data of other polyhedrons and the translation matrix T are integrated into the Node node to form a node index structure, and the topology-preserving surface optimization algorithm is used to reduce redundant surface data;
[0012] S6. Perform separate geometric processing and data integration on the node index structure of each floor to generate corresponding floor Mesh data and Node nodes;
[0013] S7. The node index structures and Mesh data of all floors are unified and integrated through the node merging technology to generate a complete GLTF file, and the dynamic Huffman coding algorithm is used to compress the overall structure of the GLTF file.
[0014] Optionally, the S2 specifically includes:
[0015] S21, grouping the three-dimensional coordinate data of the building by floor, and recording the data of each floor separately;
[0016] S22, based on the building type, classifying the three-dimensional coordinate data of each floor into wall, column, and beam categories, wherein the classification of the building type is based on the function and structural characteristics of the building elements;
[0017] S23, classifying the three-dimensional coordinate data of the same category according to size and direction, wherein the size is distinguished according to the physical size and proportion of the building element, and the direction is divided according to the orientation angle of the building element in the three-dimensional space;
[0018] S24. For each type of classified data, create a hash table H, where the key value of the hash table is an identifier of the data classification, and the key-value pair is the storage location of the data of that type;
[0019] S25, using the hash table H to establish an index structure for each type of data, storing the classification results of the three-dimensional coordinate data in the index structure, and forming a complete classification index;
[0020] S26. The classification index structure performs data location and rapid retrieval through a hash function f(x), where f(x) is a hash value generated according to the classification identifier.
[0021] Optionally, the S4 specifically includes:
[0022] S41, extracting the three-dimensional coordinate data of the reference model and the three-dimensional coordinate data of other polyhedral models from the classified index structure based on the hash table to form a reference data set and a target data set respectively;
[0023] S42, calculating a geometric feature identifier for each polyhedron model in the target data set;
[0024] S43, determining the spatial relationship of each target data set relative to the reference data set based on the geometric feature identifier, and determining the corresponding relationship between the vertices of the target data set and the vertices of the reference data set by comparing these spatial relationships;
[0025] S44, calculating the translation vectors of other polyhedral models relative to the reference model according to the spatial relationship and the corresponding relationship;
[0026] S45, constructing a translation matrix T based on the calculated translation vector, where the translation matrix T is used to perform spatial transformation on all three-dimensional coordinate data in the target data set;
[0027] S46, applying the translation matrix T to the three-dimensional coordinate data of each polyhedral model in the target data set to generate an aligned coordinate data set;
[0028] S47, verifying and correcting the aligned coordinate data set.
[0029] Optionally, the S5 specifically includes:
[0030] S51, using the coordinate data set V aligned by the translation matrix T aligned , identify the key features of the Mesh data of the reference model and mark them as the key feature point set K f ;
[0031] S52, mesh data of other polyhedron models and key feature point set K of the reference model f Perform matching analysis to determine the mesh data that can be shared. For the incompletely matched parts, use the adaptive geometry reconstruction algorithm to generate the missing mesh data.
[0032] S53, in the generated Mesh data, adopting a vertex merging strategy based on geometric features, where the vertex merging strategy based on geometric features analyzes the similarity of geometric features between vertices and merges similar vertices to reduce redundant data;
[0033] S54. For the generated and merged Mesh data, a topology-preserving surface optimization algorithm is used. The topology-preserving surface optimization algorithm maintains the connectivity between all vertices, calculates the surface geometry error for each surface, and determines the priority of surface simplification based on the error value. An optimization strategy based on local geometric features is used to selectively delete redundant vertices and surfaces to reduce the complexity of the model.
[0034] S55, generating a Node node associated with each polyhedron model, wherein the Node node includes Mesh data, vertex attribute information, and a geometric feature identifier, and is combined with a translation matrix T for precise positioning and rendering;
[0035] S56, compressing the optimized Mesh data to remove redundant data;
[0036] S57. Integrate the processed Mesh data and Node nodes into the GLTF file structure to form a complete model data structure.
[0037] Optionally, the S54 specifically includes:
[0038] S541, constructing an initial topological structure mapping of the model, wherein the mapping defines the connectivity relationship between vertices, edges, and faces, marked as a topological feature map, and used to record key geometric and topological features of the model;
[0039] S542, introduce an adaptive geometric error measurement mechanism, which dynamically adjusts the weight factor according to the local complexity and global importance of the model to optimize the geometric error measurement:
[0040] E = αC + βA + γΔN + δG;
[0041] Where E is the comprehensive geometric error, C is the curvature of the measuring surface, A is the surface area of the measuring surface, ΔN is the rate of change of the measuring normal on the surface, and α, β and γ are adaptive weight factors;
[0042] S543, for a face whose comprehensive geometric error evaluation result is lower than a predetermined threshold, using an edge contraction technique based on curvature flow to optimize the number of vertices and the shape, and using a face simplification algorithm based on energy minimization to optimize the vertex positions and reconstruct the face, and for a face whose comprehensive geometric error evaluation result is higher than a predetermined threshold, using a geometric feature preservation algorithm;
[0043] S544. In the process of model simplification, an adaptive feature point protection algorithm is used, which automatically identifies and protects key feature points and feature edges of the polyhedron;
[0044] S545. Use topological integrity protection mechanisms when performing geometry simplification and topology optimization operations, including detecting and repairing potential non-manifold structures and topological anomalies;
[0045] S546, introduce a topology-preserving compression algorithm based on the balance of local and global features, and dynamically adjust the data compression strategy by analyzing the local complexity and global morphological characteristics of the model:
[0046]
[0047] Among them, P represents the compression priority, L f Represents the local complexity feature, G f represents the global feature weight, ω is the balancing function that determines the compression processing priority, and λ and μ are weight adjustment factors used to control the impact of local and global features on the compression priority.
[0048] Optionally, the S6 specifically includes:
[0049] S61, perform independent geometric processing on the node index structure of each floor, extract the geometric information of the polyhedron model of each floor, including the topological structure of vertices, edges and faces, and perform a preliminary evaluation of the geometric complexity;
[0050] S62, apply a multi-level mesh simplification algorithm, according to the geometric complexity and visual importance factor of each floor v Optimize mesh simplification and calculate the overall geometric complexity G c :
[0051]
[0052] Among them, G cis the simplified comprehensive geometric complexity, E i represents the geometric error of the ith simplification operation, w i is the corresponding weight factor, I v is the visual importance factor, δ is the visual importance adjustment factor;
[0053] S63, using spatial consistency maintenance technology, the consistency of geometric and topological features between floors in the multi-story building model during the simplification process, fixing the spatial position of key points through feature point locking technology, and maintaining the length relationship of important edges through constraint edge maintenance method;
[0054] S64, generate adaptive layer details for each floor, and calculate the detail preservation degree D s , to optimize the visual quality of the model at different resolutions:
[0055]
[0056] Among them, D s Indicates the degree of detail preservation. represents the jth geometric feature in the full detail model, represents the corresponding geometric features in the simplified detail model, ∈ is the detail preservation adjustment factor;
[0057] S65, introduce innovative topology optimization and compression algorithms, combine local geometric features and global topological features, and dynamically adjust vertex indexes and face indexes;
[0058] S66. Integrate the final Node information of each floor, including optimized Mesh data, vertex attributes, normal direction, material information and animation data, store them in a multi-level organizational structure, and realize GLTF file transmission and rendering;
[0059] S67. Perform basic integrity check on the final data.
[0060] Optionally, the S7 specifically includes:
[0061] S71. Integrate the node index structure and Mesh data of each floor into a unified GLTF file. Through a multi-level data organization method, organize the data of different floors in a tree structure to ensure orderly storage and access of data.
[0062] S72, applying a global data optimization algorithm to optimize the geometric data of all floors as a whole, including detecting and deleting redundant nodes;
[0063] S73. Use innovative compression technology to compress the optimized geometric data, especially use the improved dynamic Huffman coding algorithm to encode the data. The algorithm analyzes the changes in the data stream in real time, dynamically adjusts the coding dictionary, and uses an improved weight adjustment mechanism to optimize the coding efficiency. The formula is:
[0064]
[0065] Among them, H d' (x) represents the average code length of the improved dynamic Huffman coding, p i (x) is the probability of occurrence of attribute value x at the i-th moment, ω i A weight adjustment factor for adjusting the encoding dictionary according to dynamic changes in data;
[0066] S74. In the data compression process, an adaptive attribute coding strategy is adopted for different types of data, and a coding scheme is selected according to the distribution characteristics of the data;
[0067] S75, using a hybrid key-based encryption technology, combined with symmetric and asymmetric encryption algorithms, to encrypt the compressed data;
[0068] S76, integrating and generating a final GLTF file, the file including compressed and encrypted data blocks, and applying a data integrity verification mechanism when generating the file, using a verification algorithm to verify data consistency;
[0069] S77. To improve the transmission efficiency of GLTF files, dynamic block transmission technology is used to divide the files into several data blocks, and the transmission order and strategy are dynamically adjusted according to the network conditions;
[0070] S78. During file transfer, use real-time error detection and correction mechanisms, including forward error correction and automatic retransmission request technology, to promptly detect and repair erroneous data that occurs during the transmission process.
[0071] Optionally, the step S73 specifically includes:
[0072] S731, initializing an improved dynamic Huffman coding algorithm, establishing an initial coding dictionary according to the attribute value distribution in the initial data set, the initial coding dictionary assigning an initial weight to each symbol according to the initial occurrence frequency of the attribute value, and determining a basic coding structure;
[0073] S732. During the data stream processing, the occurrence frequency of the data attribute value is monitored in real time, and the improved adaptive adjustment mechanism is adopted to dynamically adjust the encoding weight through the weighting factor calculation formula:
[0074]
[0075] Among them, ω i is the weight factor at the i-th moment, p i (x) is the probability of occurrence of attribute value x at the i-th moment, α and λ are adjustment factors, κ controls the sensitivity of weight adjustment, and ∈ is a small constant used to avoid the denominator being zero;
[0076] S733, according to the updated weight factor ω i , dynamically adjust the structure of the Huffman tree, rebuild the encoding dictionary, and adjust the encoding length:
[0077] l i (x) = -log 2 (ω i +p i (x) γ );
[0078] Among them, l i (x) is the encoding length of the attribute value x at the i-th moment, and γ is the nonlinear adjustment parameter;
[0079] S734, regularly perform dictionary refresh operations, and when it is detected that the data distribution changes exceed a preset threshold, re-evaluate and adjust the encoding dictionary structure;
[0080] S735. When processing rare data and abnormal data, adopt a specific extended coding strategy to optimize the negative impact of these data on the overall coding efficiency by adding symbol prefixes or special code words;
[0081] S736, continuously and adaptively adjust the encoding dictionary and continuously optimize it according to the changes in the data stream;
[0082] S737, performing secondary optimization processing on the compressed data, further reducing redundant data by integrating multiple entropy coding techniques;
[0083] S738. After completing data compression, perform data integrity check.
[0084] The beneficial effects of the present invention are:
[0085] (1) The present invention can significantly reduce the size of GLTF files by using index compression technology and dynamic Huffman coding algorithm. Compared with traditional geometric data simplification and texture compression methods, this method can not only retain the geometric and topological structure of the model, but also effectively handle the redundancy and repetitiveness in the index data, greatly improving the data compression efficiency.
[0086] (2) By establishing a classification index structure based on a hash table, the present invention realizes rapid classification and retrieval of building model data. The hash table index structure makes the management of large-scale data more efficient, and can accurately group and classify according to the characteristics of the building, such as the floor, type, size and direction, thereby improving the organization and storage efficiency of the model.
[0087] (3) In the process of model generation, the present invention introduces a translation matrix T, which ensures the geometric consistency and spatial accuracy between different building components by translating and aligning the polyhedral structure. The use of the translation matrix not only simplifies the complexity of coordinate transformation, but also ensures the precise alignment of the model at different positions, thereby improving the integrity and accuracy of the model.
[0088] (4) The present invention uses a topology-preserving surface optimization algorithm to perform fine processing on the generated Mesh data. The algorithm merges vertices and simplifies redundant surfaces by analyzing the similarity of geometric features, significantly reducing the complexity of the model while maintaining the details of the model. This technical measure not only improves the loading speed of the model, but also retains the geometric features and visual effects of the original model to a large extent.
[0089] (5) Through the adaptive geometric error measurement mechanism of dynamically adjusting the weight factor, the present invention can dynamically optimize the compression strategy of geometric data according to the local complexity and global importance of the model. This adaptive mechanism ensures the model display effect in different application scenarios, and can maximize the compression rate while maintaining high visual fidelity. It is suitable for scenarios with high requirements on model quality, such as virtual reality and game development. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0091] Figure 1 A flow chart of a method for generating a three-dimensional building GLTF file based on index compression proposed by the present invention;
[0092] Figure 2 A method for generating a 3D building GLTF file based on index compression proposed by the present invention is a flow chart of 3D building model index compression and dynamic Huffman coding; DETAILED DESCRIPTION
[0093] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0094] refer to Figure 1-2, a method for generating a three-dimensional building GLTF file based on index compression, comprising the following steps:
[0095] S1, collect the three-dimensional coordinate data of the building and use it as initial input data;
[0096] S2. Group the three-dimensional coordinate data according to the floors of the building, and classify the data based on the building type, size and direction to form a classification index structure based on a hash table;
[0097] S3, selecting a polyhedron structure from the classification index structure based on the hash table as a benchmark model, recording its Mesh data and vertex coordinate information, and marking it as a reference model;
[0098] S4, calculating the translation matrix T of other polyhedral structures relative to the reference model, where the translation matrix T is used to perform spatial transformation on the three-dimensional coordinate data of other polyhedrons;
[0099] S5. Based on the coordinate data aligned with the reference model, the Mesh data of the benchmark model is appropriately transformed, the Mesh data of other polyhedrons is generated according to the index compression method, and the Mesh data of other polyhedrons and the translation matrix T are integrated into the Node node to form a node index structure, and the topology-preserving surface optimization algorithm is used to reduce redundant surface data;
[0100] S6. Perform separate geometric processing and data integration on the node index structure of each floor to generate corresponding floor Mesh data and Node nodes;
[0101] S7. The node index structures and Mesh data of all floors are unified and integrated through the node merging technology to generate a complete GLTF file, and the dynamic Huffman coding algorithm is used to compress the overall structure of the GLTF file.
[0102] In this implementation, S2 specifically includes:
[0103] S21, grouping the three-dimensional coordinate data of the building by floor, and recording the data of each floor separately;
[0104] S22, based on the building type, classifying the three-dimensional coordinate data of each floor into wall, column, and beam categories, wherein the classification of the building type is based on the function and structural characteristics of the building elements;
[0105] S23, classifying the three-dimensional coordinate data of the same category according to size and direction, wherein the size is distinguished according to the physical size and proportion of the building element, and the direction is divided according to the orientation angle of the building element in the three-dimensional space;
[0106] S24. For each type of classified data, create a hash table H, where the key value of the hash table is an identifier of the data classification, and the key-value pair is the storage location of the data of that type;
[0107] S25, using the hash table H to establish an index structure for each type of data, storing the classification results of the three-dimensional coordinate data in the index structure, and forming a complete classification index;
[0108] S26. The classification index structure performs data location and rapid retrieval through a hash function f(x), where f(x) is a hash value generated according to the classification identifier.
[0109] In this implementation, S4 specifically includes:
[0110] S41, extracting the three-dimensional coordinate data of the reference model and the three-dimensional coordinate data of other polyhedral models from the classified index structure based on the hash table to form a reference data set and a target data set respectively;
[0111] S42, calculating a geometric feature identifier for each polyhedron model in the target data set;
[0112] S43, determining the spatial relationship of each target data set relative to the reference data set based on the geometric feature identifier, and determining the corresponding relationship between the vertices of the target data set and the vertices of the reference data set by comparing these spatial relationships;
[0113] S44, calculating the translation vectors of other polyhedral models relative to the reference model according to the spatial relationship and the corresponding relationship;
[0114] S45, constructing a translation matrix T based on the calculated translation vector, where the translation matrix T is used to perform spatial transformation on all three-dimensional coordinate data in the target data set;
[0115] S46, applying the translation matrix T to the three-dimensional coordinate data of each polyhedral model in the target data set to generate an aligned coordinate data set;
[0116] S47, verifying and correcting the aligned coordinate data set.
[0117] In this implementation manner, S5 specifically includes:
[0118] S51, using the coordinate data set V aligned by the translation matrix T aligned , identify the key features of the Mesh data of the reference model and mark them as the key feature point set K f ;
[0119] S52, mesh data of other polyhedron models and key feature point set K of the reference model fPerform matching analysis to determine the mesh data that can be shared. For the incompletely matched parts, use the adaptive geometry reconstruction algorithm to generate the missing mesh data.
[0120] S53, in the generated Mesh data, adopting a vertex merging strategy based on geometric features, where the vertex merging strategy based on geometric features analyzes the similarity of geometric features between vertices and merges similar vertices to reduce redundant data;
[0121] S54. For the generated and merged Mesh data, a topology-preserving surface optimization algorithm is used. The topology-preserving surface optimization algorithm maintains the connectivity between all vertices, calculates the surface geometry error for each surface, and determines the priority of surface simplification based on the error value. An optimization strategy based on local geometric features is used to selectively delete redundant vertices and surfaces to reduce the complexity of the model.
[0122] S55, generating a Node node associated with each polyhedron model, wherein the Node node includes Mesh data, vertex attribute information, and a geometric feature identifier, and is combined with a translation matrix T for precise positioning and rendering;
[0123] S56, compressing the optimized Mesh data to remove redundant data;
[0124] S57. Integrate the processed Mesh data and Node nodes into the GLTF file structure to form a complete model data structure.
[0125] In this implementation manner, the S54 specifically includes:
[0126] S541, constructing an initial topological structure mapping of the model, wherein the mapping defines the connectivity relationship between vertices, edges, and faces, marked as a topological feature map, and used to record key geometric and topological features of the model;
[0127] S542, introduce an adaptive geometric error measurement mechanism, which dynamically adjusts the weight factor according to the local complexity and global importance of the model to optimize the geometric error measurement:
[0128] E = αC + βA + γΔN + δG;
[0129] Where E is the comprehensive geometric error, C is the curvature of the measuring surface, A is the surface area of the measuring surface, ΔN is the rate of change of the measuring normal on the surface, and α, β and γ are adaptive weight factors;
[0130] S543, for a face whose comprehensive geometric error evaluation result is lower than a predetermined threshold, using an edge contraction technique based on curvature flow to optimize the number of vertices and the shape, and using a face simplification algorithm based on energy minimization to optimize the vertex positions and reconstruct the face, and for a face whose comprehensive geometric error evaluation result is higher than a predetermined threshold, using a geometric feature preservation algorithm;
[0131] S544. In the process of model simplification, an adaptive feature point protection algorithm is used, which automatically identifies and protects key feature points and feature edges of the polyhedron;
[0132] S545. Use topological integrity protection mechanisms when performing geometry simplification and topology optimization operations, including detecting and repairing potential non-manifold structures and topological anomalies;
[0133] S546, introduce a topology-preserving compression algorithm based on the balance of local and global features, and dynamically adjust the data compression strategy by analyzing the local complexity and global morphological characteristics of the model:
[0134]
[0135] Among them, P represents the compression priority, L f Represents the local complexity feature, G f represents the global feature weight, ω is the balancing function that determines the compression processing priority, and λ and μ are weight adjustment factors used to control the impact of local and global features on the compression priority.
[0136] In this implementation manner, S6 specifically includes:
[0137] S61, perform independent geometric processing on the node index structure of each floor, extract the geometric information of the polyhedron model of each floor, including the topological structure of vertices, edges and faces, and perform a preliminary evaluation of the geometric complexity;
[0138] S62, apply a multi-level mesh simplification algorithm, according to the geometric complexity and visual importance factor of each floor v Optimize mesh simplification and calculate the overall geometric complexity G c :
[0139]
[0140] Among them, G c is the simplified comprehensive geometric complexity, E i represents the geometric error of the ith simplification operation, w i is the corresponding weight factor, I v is the visual importance factor, δ is the visual importance adjustment factor;
[0141] S63, using spatial consistency maintenance technology, the consistency of geometric and topological features between floors in the multi-story building model during the simplification process, fixing the spatial position of key points through feature point locking technology, and maintaining the length relationship of important edges through constraint edge maintenance method;
[0142] S64, generate adaptive layer details for each floor, and calculate the detail preservation degree D s , to optimize the visual quality of the model at different resolutions:
[0143]
[0144] Among them, D s Indicates the degree of detail preservation. represents the jth geometric feature in the full detail model, represents the corresponding geometric features in the simplified detail model, ∈ is the detail preservation adjustment factor;
[0145] S65, introduce innovative topology optimization and compression algorithms, combine local geometric features and global topological features, and dynamically adjust vertex indexes and face indexes;
[0146] S66. Integrate the final Node information of each floor, including optimized Mesh data, vertex attributes, normal direction, material information and animation data, store them in a multi-level organizational structure, and realize GLTF file transmission and rendering;
[0147] S67. Perform basic integrity check on the final data.
[0148] In this implementation manner, the S7 specifically includes:
[0149] S71. Integrate the node index structure and Mesh data of each floor into a unified GLTF file. Through a multi-level data organization method, organize the data of different floors in a tree structure to ensure orderly storage and access of data.
[0150] S72, applying a global data optimization algorithm to optimize the geometric data of all floors as a whole, including detecting and deleting redundant nodes;
[0151] S73. Use innovative compression technology to compress the optimized geometric data, especially use the improved dynamic Huffman coding algorithm to encode the data. The algorithm analyzes the changes in the data stream in real time, dynamically adjusts the coding dictionary, and uses an improved weight adjustment mechanism to optimize the coding efficiency. The formula is:
[0152]
[0153] Among them, H d'(x) represents the average code length of the improved dynamic Huffman coding, p i (x) is the probability of occurrence of attribute value x at the i-th moment, ω i A weight adjustment factor for adjusting the encoding dictionary according to dynamic changes in data;
[0154] S74. In the data compression process, an adaptive attribute coding strategy is adopted for different types of data, and a coding scheme is selected according to the distribution characteristics of the data;
[0155] S75, using a hybrid key-based encryption technology, combined with symmetric and asymmetric encryption algorithms, to encrypt the compressed data;
[0156] S76, integrating and generating a final GLTF file, the file including compressed and encrypted data blocks, and applying a data integrity verification mechanism when generating the file, using a verification algorithm to verify data consistency;
[0157] S77. To improve the transmission efficiency of GLTF files, dynamic block transmission technology is used to divide the files into several data blocks, and the transmission order and strategy are dynamically adjusted according to the network conditions;
[0158] S78. During file transfer, use real-time error detection and correction mechanisms, including forward error correction and automatic retransmission request technology, to promptly detect and repair erroneous data that occurs during the transmission process.
[0159] In this implementation manner, the step S73 specifically includes:
[0160] S731, initializing an improved dynamic Huffman coding algorithm, establishing an initial coding dictionary according to the attribute value distribution in the initial data set, the initial coding dictionary assigning an initial weight to each symbol according to the initial occurrence frequency of the attribute value, and determining a basic coding structure;
[0161] S732. During the data stream processing, the occurrence frequency of the data attribute value is monitored in real time, and the improved adaptive adjustment mechanism is adopted to dynamically adjust the encoding weight through the weighting factor calculation formula:
[0162]
[0163] Among them, ω i is the weight factor at the i-th moment, p i (x) is the probability of occurrence of attribute value x at the i-th moment, α and λ are adjustment factors, κ controls the sensitivity of weight adjustment, and ∈ is a small constant used to avoid the denominator being zero;
[0164] S733, according to the updated weight factor ω i, dynamically adjust the structure of the Huffman tree, rebuild the encoding dictionary, and adjust the encoding length:
[0165] l i (x) = -log 2 (ω i +p i (x) γ );
[0166] Among them, l i (x) is the encoding length of the attribute value x at the i-th moment, and γ is the nonlinear adjustment parameter;
[0167] S734, regularly perform dictionary refresh operations, and when it is detected that the data distribution changes exceed a preset threshold, re-evaluate and adjust the encoding dictionary structure;
[0168] S735. When processing rare data and abnormal data, adopt a specific extended coding strategy to optimize the negative impact of these data on the overall coding efficiency by adding symbol prefixes or special code words;
[0169] S736, continuously and adaptively adjust the encoding dictionary and continuously optimize it according to the changes in the data stream;
[0170] S737, performing secondary optimization processing on the compressed data, further reducing redundant data by integrating multiple entropy coding techniques;
[0171] S738. After completing data compression, perform data integrity check.
[0172] Embodiment 1:
[0173] The method of generating a 3D architectural GLTF file based on index compression of the present invention was implemented in Company B, a company engaged in high-end architectural design and virtual reality experience located in Shenzhen, Guangdong Province, China. Company B is committed to providing realistic architectural models and virtual display services, and has various types of architectural model resources, including residential, commercial buildings, and historical buildings. In order to improve the data transmission efficiency and loading speed of the 3D model, especially in a network transmission environment, Company B adopted the method of the present invention to optimize the generation and compression of its GLTF files.
[0174] Before applying the method of the present invention, Company B traditionally relied on geometric data simplification and texture compression to reduce the size of GLTF files. However, these methods often lead to a decrease in model quality, especially when the architectural details are more complex. In order to maintain high-quality model display effects while reducing file size, the present invention provides a new solution.
[0175] During the project implementation, Company B selected a complex commercial building as a test object. The 3D model of the building contains detailed architectural elements such as walls, columns, beams, stairs, and windows. The entire model includes approximately 5 million vertices and 8 million faces, and the file size reaches 600MB. Without optimization, it takes about 30 seconds to load a complete model, which has a significant impact on the customer experience.
[0176] Through the method of the present invention, the three-dimensional coordinate data of the building is first collected, and the data is grouped and classified. Based on the characteristics of the building type, size and direction, a classification index structure is established using a hash table. A benchmark model is selected, its Mesh data and vertex coordinate information are recorded, and the translation matrix T is calculated. The translation matrix T is used to perform spatial transformation on the three-dimensional coordinate data of the polyhedral structure, so that the alignment of the various parts of the model is more accurate. Next, the index compression technology is applied to generate the Mesh data of other polyhedrons, and the topology-preserving face optimization algorithm is used to optimize the Mesh data. This algorithm ensures the details and structural integrity of the model while reducing redundant face data. Finally, the data of all floors are integrated into a complete GLTF file through node merging technology, and the file is compressed using a dynamic Huffman coding algorithm.
[0177] During the implementation process, Company B compared the key performance data before and after optimization to evaluate the effect of the method of the present invention. The specific data are as follows:
[0178] Table 1 Comparison of key performance before and after GLTF file optimization
[0179]
[0180] As can be seen from the data in Table 1, the method of the present invention has achieved significant improvements in many aspects. First, through index compression technology and dynamic Huffman coding algorithm, the size of the GLTF file is significantly reduced from the original 600MB to 150MB, a reduction of 75%. This not only reduces the storage cost, but also greatly improves the file transmission efficiency. In an environment where the network transmission rate is 100Mbps, the transmission speed is increased by 4 times, from the original 4MB / s to 16MB / s.
[0181] In addition, the model loading time has been greatly reduced, from 30 seconds without optimization to 8 seconds, a reduction of 73.3%. This significant reduction in loading time significantly improves the user experience, especially in virtual reality and augmented reality applications, where this increase in response speed is particularly critical. At the same time, through improved compression and optimization techniques, the model's visual quality retention rate has been increased from 80% to 95%, ensuring that the model display effect is maintained at a high quality while compressing the data volume.
[0182] In summary, by implementing the method of the present invention, Company B not only successfully improved the loading and transmission efficiency of the three-dimensional model, but also maintained the high quality of the model, greatly improving the customer experience and satisfaction. The method of the present invention provides an efficient and reliable solution for the data processing of complex building models, and is particularly suitable for scenarios that require fast transmission and loading in a network environment, such as virtual reality, augmented reality, and online display. The implementation of this method also lays the foundation for Company B's extensive application in other projects in the future.
[0183] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for generating a 3D building GLTF file based on index compression, characterized in that: The steps include: S1, collect the three-dimensional coordinate data of the building and use it as initial input data; S2. Grouping the three-dimensional coordinate data according to the floors of the building, and classifying the data based on the building type, size and direction to form a classification index structure based on a hash table; S3, selecting a polyhedron structure from the classification index structure based on the hash table as a benchmark model, recording its Mesh data and vertex coordinate information, and marking it as a reference model; S4, calculating the translation matrix T of other polyhedral structures relative to the reference model, where the translation matrix T is used to perform spatial transformation on the three-dimensional coordinate data of other polyhedrons; S5. Based on the coordinate data aligned with the reference model, the Mesh data of the benchmark model is appropriately transformed, the Mesh data of other polyhedrons is generated according to the index compression method, and the Mesh data of other polyhedrons and the translation matrix T are integrated into the Node node to form a node index structure, and the topology-preserving surface optimization algorithm is used to reduce redundant surface data; S6. Perform separate geometric processing and data integration on the node index structure of each floor to generate corresponding floor Mesh data and Node nodes; S7. The node index structures and Mesh data of all floors are unified and integrated through the node merging technology to generate a complete GLTF file, and the dynamic Huffman coding algorithm is used to compress the overall structure of the GLTF file.
2. A method for generating a three-dimensional building GLTF file based on index compression according to claim 1, characterized in that: The S2 specifically includes: S21, grouping the three-dimensional coordinate data of the building by floor, and recording the data of each floor separately; S22, based on the building type, classifying the three-dimensional coordinate data of each floor into wall, column, and beam categories, wherein the classification of the building type is based on the function and structural characteristics of the building elements; S23, classifying the three-dimensional coordinate data of the same category according to size and direction, wherein the size is distinguished according to the physical size and proportion of the building element, and the direction is divided according to the orientation angle of the building element in the three-dimensional space; S24. For each type of classified data, create a hash table H, where the key value of the hash table is an identifier of the data classification, and the key-value pair is the storage location of the data of that type; S25, using the hash table H to establish an index structure for each type of data, storing the classification results of the three-dimensional coordinate data in the index structure, and forming a complete classification index; S26. The classification index structure performs data location and rapid retrieval through a hash function f(x), where f(x) is a hash value generated according to the classification identifier.
3. The method for generating a three-dimensional building GLTF file based on index compression according to claim 1, characterized in that: The S4 specifically includes: S41, extracting the three-dimensional coordinate data of the reference model and the three-dimensional coordinate data of other polyhedral models from the classified index structure based on the hash table to form a reference data set and a target data set respectively; S42, calculating a geometric feature identifier for each polyhedron model in the target data set; S43, determining the spatial relationship of each target data set relative to the reference data set based on the geometric feature identifier, and determining the corresponding relationship between the vertices of the target data set and the vertices of the reference data set by comparing these spatial relationships; S44, calculating the translation vectors of other polyhedral models relative to the reference model according to the spatial relationship and the corresponding relationship; S45, constructing a translation matrix T based on the calculated translation vector, where the translation matrix T is used to perform spatial transformation on all three-dimensional coordinate data in the target data set; S46, applying the translation matrix T to the three-dimensional coordinate data of each polyhedral model in the target data set to generate an aligned coordinate data set; S47, verifying and correcting the aligned coordinate data set.
4. The method for generating a three-dimensional building GLTF file based on index compression according to claim 1, characterized in that: The S5 specifically includes: S51, using the coordinate data set V aligned by the translation matrix T aligned , identify the key features of the Mesh data of the reference model and mark them as the key feature point set K f ; S52, mesh data of other polyhedron models and key feature point set K of the reference model f Perform matching analysis to determine the mesh data that can be shared. For the incompletely matched parts, use the adaptive geometry reconstruction algorithm to generate the missing mesh data. S53, in the generated Mesh data, adopting a vertex merging strategy based on geometric features, where the vertex merging strategy based on geometric features analyzes the similarity of geometric features between vertices and merges similar vertices to reduce redundant data; S54. For the generated and merged Mesh data, a topology-preserving surface optimization algorithm is used. The topology-preserving surface optimization algorithm maintains the connectivity between all vertices, calculates the surface geometry error for each surface, and determines the priority of surface simplification based on the error value. An optimization strategy based on local geometric features is used to selectively delete redundant vertices and surfaces to reduce the complexity of the model. S55, generating a Node node associated with each polyhedron model, wherein the Node node includes Mesh data, vertex attribute information, and a geometric feature identifier, and is combined with a translation matrix T for precise positioning and rendering; S56, compressing the optimized Mesh data to remove redundant data; S57. Integrate the processed Mesh data and Node nodes into the GLTF file structure to form a complete model data structure.
5. The method for generating a three-dimensional building GLTF file based on index compression according to claim 4, characterized in that: The S54 specifically includes: S541, constructing an initial topological structure mapping of the model, wherein the mapping defines the connectivity relationship between vertices, edges, and faces, marked as a topological feature map, and used to record key geometric and topological features of the model; S542, introduce an adaptive geometric error measurement mechanism, which dynamically adjusts the weight factor according to the local complexity and global importance of the model to optimize the geometric error measurement: E = αC + βA + γΔN + δG; Where E is the comprehensive geometric error, C is the curvature of the measuring surface, A is the surface area of the measuring surface, ΔN is the rate of change of the measuring normal on the surface, and α, β and γ are adaptive weight factors; S543, for a face whose comprehensive geometric error evaluation result is lower than a predetermined threshold, using an edge contraction technique based on curvature flow to optimize the number of vertices and the shape, and using a face simplification algorithm based on energy minimization to optimize the vertex positions and reconstruct the face, and for a face whose comprehensive geometric error evaluation result is higher than a predetermined threshold, using a geometric feature preservation algorithm; S544. In the process of model simplification, an adaptive feature point protection algorithm is used, which automatically identifies and protects key feature points and feature edges of the polyhedron; S545. Use topological integrity protection mechanisms when performing geometry simplification and topology optimization operations, including detecting and repairing potential non-manifold structures and topological anomalies; S546, introduce a topology-preserving compression algorithm based on the balance of local and global features, and dynamically adjust the data compression strategy by analyzing the local complexity and global morphological characteristics of the model: Among them, P represents the compression priority, L f Represents the local complexity feature, G f represents the global feature weight, ω is the balancing function that determines the compression processing priority, and λ and μ are weight adjustment factors used to control the impact of local and global features on the compression priority.
6. The method for generating a 3D building GLTF file based on index compression according to claim 1, characterized in that: The S6 specifically includes: S61, perform independent geometric processing on the node index structure of each floor, extract the geometric information of the polyhedron model of each floor, including the topological structure of vertices, edges and faces, and perform a preliminary evaluation of the geometric complexity; S62, apply a multi-level mesh simplification algorithm, according to the geometric complexity and visual importance factor of each floor v Optimize mesh simplification and calculate the overall geometric complexity G c : Among them, G c is the simplified comprehensive geometric complexity, E i represents the geometric error of the ith simplification operation, w i is the corresponding weight factor, I v is the visual importance factor, δ is the visual importance adjustment factor; S63, using spatial consistency maintenance technology, the consistency of geometric and topological features between floors in the multi-story building model during the simplification process, fixing the spatial position of key points through feature point locking technology, and maintaining the length relationship of important edges through constraint edge maintenance method; S64, generate adaptive layer details for each floor, and calculate the detail preservation degree D s , to optimize the visual quality of the model at different resolutions: Among them, D s Indicates the degree of detail preservation. represents the jth geometric feature in the full detail model, represents the corresponding geometric features in the simplified detail model, ∈ is the detail preservation adjustment factor; S65, introduce innovative topology optimization and compression algorithms, combine local geometric features and global topological features, and dynamically adjust vertex indexes and face indexes; S66. Integrate the final Node information of each floor, including optimized Mesh data, vertex attributes, normal direction, material information and animation data, store them in a multi-level organizational structure, and realize GLTF file transmission and rendering; S67. Perform basic integrity check on the final data.
7. The method for generating a 3D building GLTF file based on index compression according to claim 1, characterized in that: The S7 specifically includes: S71. Integrate the node index structure and Mesh data of each floor into a unified GLTF file. Through a multi-level data organization method, organize the data of different floors in a tree structure to ensure orderly storage and access of data. S72, applying a global data optimization algorithm to optimize the geometric data of all floors as a whole, including detecting and deleting redundant nodes; S73. Use innovative compression technology to compress the optimized geometric data, especially use the improved dynamic Huffman coding algorithm to encode the data. The algorithm analyzes the changes in the data stream in real time, dynamically adjusts the coding dictionary, and uses an improved weight adjustment mechanism to optimize the coding efficiency. The formula is: Among them, H d' (x) represents the average code length of the improved dynamic Huffman coding, p i (x) is the probability of occurrence of attribute value x at the i-th moment, ω i A weight adjustment factor for adjusting the encoding dictionary according to dynamic changes in data; S74. In the data compression process, for different types of data, an adaptive attribute coding strategy is adopted, and a coding scheme is selected according to the distribution characteristics of the data; S75, using a hybrid key-based encryption technology, combined with symmetric and asymmetric encryption algorithms, to encrypt the compressed data; S76, integrating and generating a final GLTF file, the file including compressed and encrypted data blocks, and applying a data integrity verification mechanism and using a verification algorithm to verify data consistency when the file is generated; S77. To improve the transmission efficiency of GLTF files, dynamic block transmission technology is used to divide the files into several data blocks, and the transmission order and strategy are dynamically adjusted according to the network conditions; S78. During file transfer, use real-time error detection and correction mechanisms, including forward error correction and automatic retransmission request technology, to promptly detect and repair erroneous data that occurs during the transmission process.
8. The method for generating a three-dimensional building GLTF file based on index compression according to claim 7, characterized in that: The step S73 specifically includes: S731, initializing an improved dynamic Huffman coding algorithm, establishing an initial coding dictionary according to the attribute value distribution in the initial data set, the initial coding dictionary assigning an initial weight to each symbol according to the initial occurrence frequency of the attribute value, and determining a basic coding structure; S732. During the data stream processing, the occurrence frequency of the data attribute value is monitored in real time, and the improved adaptive adjustment mechanism is adopted to dynamically adjust the encoding weight through the weighting factor calculation formula: Among them, ω i is the weight factor at the i-th moment, p i (x) is the probability of occurrence of attribute value x at the i-th moment, α and λ are adjustment factors, κ controls the sensitivity of weight adjustment, and ∈ is a small constant used to avoid the denominator being zero; S733, according to the updated weight factor ω i , dynamically adjust the structure of the Huffman tree, rebuild the encoding dictionary, and adjust the encoding length: l i (x)=-log2(ω i +p i (x) γ ); Among them, l i (x) is the encoding length of the attribute value x at the i-th moment, and γ is the nonlinear adjustment parameter; S734, regularly perform dictionary refresh operations, and when it is detected that the data distribution changes exceed a preset threshold, re-evaluate and adjust the encoding dictionary structure; S735. When processing rare data and abnormal data, adopt a specific extended coding strategy to optimize the negative impact of these data on the overall coding efficiency by adding symbol prefixes or special code words; S736, continuously and adaptively adjust the encoding dictionary and continuously optimize it according to the changes in the data stream; S737, performing secondary optimization processing on the compressed data, further reducing redundant data by integrating multiple entropy coding techniques; S738. After completing data compression, perform data integrity check.
Citation Information
Cited By
Sectioning method and system for complex BIM model of rail transit station
CN120408813A
A sectioning method and system for complex BIM models of rail transit stations
CN120408813B
Intelligent CAD (computer-aided design) primitive recognition method for scribing robot
CN120472489A
A CAD graph element intelligent recognition method for a scribing robot
CN120472489B