A three-dimensional model universal format conversion and optimization method
By splitting the IFC format 3D model into JSON and OBJ formats, and then converting them into glTF and the final 3D tiles format, the problems of high cost and platform incompatibility in large-scale urban 3D model applications are solved, achieving efficient format conversion and optimization.
Patent Information
- Application Number
- CN202310965807.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2043-08-02
AI Technical Summary
Existing technologies for converting urban 3D models suffer from problems such as high usage costs, platform and data incompatibility, and slow model rendering and loading. Furthermore, commercial conversion software is expensive and commercially driven, and significant information loss occurs during the conversion process.
Using open-source software and tools, the 3D model in IFC format is split into JSON and OBJ format files, further converted to glTF format, and finally converted to 3D tiles format. Graph theory methods are used to query and decompose parts, complete coordinate transformation, spatial index construction, and view culling to ensure information integrity.
It effectively reduces conversion costs, avoids information loss, solves the problem of platform and data incompatibility, improves model loading and rendering efficiency, and is suitable for large-scale applications.
Smart Images

Figure CN117033475B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computer application technology, three-dimensional model and format conversion, in particular to a three-dimensional model universal format conversion and optimization method, through programming algorithm, using open source software, converting three-dimensional model IFC format containing geometric information and semantic information into universal format 3D tiles format, and optimizing model visualization, solving the problems of high use cost, platform and data incompatibility and the like existing in large-scale application of urban three-dimensional model. BACKGROUND
[0002] With the rapid development of science and technology, urban three-dimensional model gradually develops towards semanticization and topologization, not only increasingly becomes an important work of smart city construction, but also is an important part of constructing natural resource three-dimensional space-time database, and plays an important role in the application fields of three-dimensional real estate, two-three-dimensional integration and real scene three-dimensional. Urban three-dimensional model data contains two types of information: geometric information (stores the components of buildings) and semantic attribute information. IFC (Industry Foundation Classes) standard can better support the expression of entity semantic description, spatial positioning, geometric shape, attribute characteristics, element mutual relationship and evolution in building object layer of model. 3D tiles used by Cesium is based on WebGL rendering mechanism, and can realize rapid loading of massive three-dimensional data, so as to be one of the standardized formats and universal formats of OGC (Open Geospatial Consortium) organization as the target format of urban three-dimensional model data conversion.
[0003] In the process of three-dimensional model modeling, the 3D tiles format cannot be directly obtained, so many domestic and foreign units and researchers have explored and practiced the conversion and optimization of the general format of three-dimensional models, which mainly have the following three characteristics: (1) Taking the Cesium Sandcastle function package developed by Bentley Company as an example, after realizing the conversion of the three-dimensional format, the 3D tiles format file is encapsulated with a URL address, the conversion process is completely "black box", and the price is relatively expensive; (2) The commercial format factory software FormItConverter developed by AutoDesk Company has problems such as reduction of rendering effect of three-dimensional model and change of geometric texture of original model in the conversion process; (3) The open source conversion scheme in the prior art needs to know the structure information of the model in advance. The model data in Obj, IFC, glTF and other formats are obviously different from the 3D tiles format in terms of geometric expression, attribute information, display range, and coordinate system, which makes the current city three-dimensional model have great limitations in large-scale application. In order to solve the problems of high use cost, platform and data incompatibility, slow model rendering and loading of city three-dimensional model in large-scale application.
[0004] At present, no effective solution has been proposed for the problems in the related art. SUMMARY
[0005] In view of the problems in the related art, the present application proposes a general format conversion and optimization method for three-dimensional models to overcome the above technical problems existing in the prior art.
[0006] To this end, the specific technical solutions adopted by the present application are as follows:
[0007] A general format conversion and optimization method for three-dimensional models, the method comprising the following steps:
[0008] S1, split the source model in IFC2x3tc format according to the actual building components to obtain a JSON format file containing model component attributes and an IFC file containing component geometric shape information, and decompose the IFC file.
[0009] S2, convert the IFC file to an OBJ format file.
[0010]
[0010] S3, convert the OBJ format file to a glTF format file.
[0011] S4, convert the glTF format file to a 3D tiles format file, and complete coordinate conversion, spatial index construction and view rejection.
[0012] Further, the decomposing of the IFC file comprises the following steps:
[0013] S11, converting the IFC file into a directed graph according to the relationship of each component, and obtaining a target object;
[0014] S12, introducing a relationship main graph, a relationship subgraph set, and a model query graph;
[0015] S13, obtaining the name and corresponding ID of each component of the IFC file.
[0016] Further, when the relationship main graph, the relationship subgraph set, and the model query graph are introduced, the relationship main graph is composed of all vertices of the model and their relationships;
[0017] The model query graph is the union set of the main graph and all relationship subgraphs;
[0018] The relationship subgraph set contains several relationship subgraphs, and each relationship subgraph is composed of vertices representing IFC model objectization, corresponding relationship attributes, and edges.
[0019] Further, the obtaining of the name and corresponding ID of each component of the IFC file includes the following steps:
[0020] S131, querying the IFC file based on the shortest path algorithm;
[0021] S132, determining the shortest path of the IFCWall and IFCMaterial objects and the attributes of the IFCMaterial;
[0022] S133, using the model query graph to traverse in turn, and finally obtaining the name and corresponding ID of each component of the IFC file.
[0023] Further, the conversion of the IFC file into an OBJ format file includes the following steps:
[0024] Building a conversion framework for processing the conversion of the IFC file into the OBJ format file;
[0025] Using the IfcConvert tool to batch convert the decomposed IFC file into an OBJ format file, and generating material information of each component in the MLF format.
[0026] Further, when the OBJ format file is converted into a glTF format file, the OBJ format is converted into the glTF format through the obj2gltf tool.
[0027] Further, the conversion of the glTF format file into a 3D tiles format file includes the following steps:
[0028] An instance is created for each glTF format file by the 3D tiles generator, and each glTF format file is parsed and its corresponding JSON file is found;
[0029] Remaining attributes are extracted by querying the name in each glTF format file;
[0030] The instance is contained in the b3dm header file in the batch table hierarchy;
[0031] The converted b3dm data of the glTF format file and the tile dataset file together constitute a 3D tiles format file.
[0032] Further, the completion of coordinate conversion, construction of spatial index and view culling includes the following steps:
[0033] The coordinate origin position in the IFC model is converted to (x1, y1, z1) in the world coordinate system of the 3D tiles format, the Z axis is vertically upward, the Y axis points north, and the conversion matrix corresponding to each coordinate axis is R x , R y , R z , θ x , θ y , θ z is the included angle of the conversion vector and the X axis, the Y axis and the Z axis;
[0034] The calculation formula of the conversion matrix T t between the two coordinate systems is:
[0035] ;
[0036] The octree structure is selected to construct the spatial index, and the tile is divided into eight sub-levels and the quadtree is expanded using three orthogonal split planes;
[0037] On the basis of the establishment of the spatial index, the view culling of other data is carried out, and the view culling includes the view frustum culling and the back culling.
[0038] Further, the view frustum culling includes the following steps:
[0039] Data that does not intersect the bounding box and the view frustum is removed, and the view frustum culling formula is:
[0040] In the formula, (x, y) is the coordinate of the viewpoint;
[0041] h is the view range radius;
[0042] α is the included angle;
[0043] h is constructed by the following geometric relationship;
[0044] If h < r, the node in the view frustum is not loaded; if h > r, the node in the view frustum is loaded, and r is a geometric error.
[0045] Further, the back surface culling utilizes the interface function provided by WebGL to cull the dashed surface.
[0046] The present application has the following beneficial effects:
[0047] (1) The present application can save the cost of purchasing commercial software, and the conversion into 3D tiles format can save the cost of purchasing a visualization platform, solving the problems of high price of currently marketed conversion software and bundled visualization platform, a series of update and upgrade costs in later period, and complex use process.
[0048] (2) The method provided by the present application can effectively avoid the problem of information loss, avoiding the missing of parts of the model and the missing of attribute information of the model in the format conversion process of some commercial conversion software, and avoiding the complete "black box" in the conversion process of the prior art, the obvious commercial tendency, and the deficiency that the conversion format is not what the user wants.
[0049] (3) The present application is based on open source language and tools, explores a set of solutions for converting urban three-dimensional models (IFC format) into general format 3D tiles and visualization optimization research, completes coordinate conversion, spatial index construction, and view culling, to solve the problems of high use cost, platform and data incompatibility, and the like in large-scale application of urban three-dimensional models. BRIEF DESCRIPTION OF DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings in the following description only constitute some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0051] Figure 1 is a flowchart of a three-dimensional model general format conversion and optimization method according to an embodiment of the present application;
[0052] Figure 2 is an IFC to 3D tiles format conversion flowchart;
[0053] Figure 3 is a schematic diagram of converting an IFC model into a directed graph;
[0054] Figure 4 is a model search graph generated by using a relationship subgraph and a main graph;
[0055] Figure 5is a back face culling schematic diagram;
[0056] Figure 6 is a back face culling schematic diagram;
[0057] Figure 7 is an IFC decomposition time comparison diagram;
[0058] Figure 8 is a frame number comparison diagram before and after optimization;
[0059] Figure 9 is an IFC original model slab (IFC slab) information diagram. Embodiments
[0060] To further illustrate the embodiments, the present application provides accompanying drawings which form a part of the disclosure, which mainly serve to illustrate the embodiments, and can be used to explain the operating principles of the embodiments in conjunction with the relevant descriptions in the specification. Those skilled in the art should understand other possible implementations and advantages of the present application by referring to these contents. The components in the drawings are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0061] According to an embodiment of the present application, a three-dimensional model universal format conversion and optimization method is provided.
[0062] The present application will be further described in conjunction with the accompanying drawings and specific embodiments. As shown in the drawings, according to the three-dimensional model universal format conversion and optimization method of the embodiment of the present application, the method comprises the following steps: Figures 1-2
[0063] S1, split the source model in IFC2x3tc format according to the actual building components to obtain a JSON format file containing model component attributes and an IFC file containing component geometric shape information, and decompose the IFC file.
[0064] Directly converting larger IFC model into OBJ format will cause the loss of attribute information, so it is necessary to decompose IFC model according to components. In practice, firstly, the problem of IFC component query needs to be solved, secondly, information needs to be preserved without loss during the decomposition process, and thirdly, the integrity and relevance of the attributes of each component need to be preserved. Existing conversion tools can directly convert larger IFC files into single, smaller OBJ format files according to components, such as Open 3D Model Viewer software and BIMServer. The former has problems such as loss of component information and inability to associate during the conversion process. The latter is an open source development project used to store and manage BIM models, has functions such as model checking, version control, merging and filtering BIM models, and dynamically outputting IFC files. Generally, IFC files are uploaded to BIMServer, and then decomposed according to building components. All objects in the IFC file are traversed, and objects containing geometric information are decomposed into smaller IFC files according to the model and exported, while the attribute information of the objects is preserved in the JSON file. This is one of the more commonly used methods, but this method requires prior knowledge of IFC object model patterns and structures, and there may be a loss of components during the query process. In view of the above, the present application combines graph theory method to implement query and decomposition of IFC model, matches the obtained IFC component information with the component information in BIMServer, and obtains the corresponding JSON file.
[0065] In one embodiment, the decomposition of the IFC file comprises the following steps:
[0066] S11, converting the IFC file into a directed graph according to the relationship of each component G V, E As shown in Figure 2 , and obtaining target objects from IFCRelationship, IFCRelAssigns, IFCRelDecomposes, IFCRelAssociates, IFCRelDefines, and IFCRelConnects types, for example, the material information of IFCWall marked as wal#1 needs to be obtained, and the shortest distance between wal#1 and IFCMaterial is calculated; wherein Figure 2 Walls, Doors, Columns, Stairs, Windows, etc. in
[0067] S12, to avoid incorrect semantic result output, introduce relationship main graph, relationship subgraph set and model query graph, wherein V is the vertex set, E is the node set, and the main graph, relationship subgraph set and model query graph corresponding to each target object are as shown in Figure 3 ; whereinFigure 3 IFCWall, IFCRelAssociatesMaterial, IFCMaterialList, IFCMaterial in IFC model respectively represent wall, the relationship between the component and the component type using this material, the list of using different materials, and the material of the component. wal#1, relm#1, mil#1, mat#1, mat#2 represent the first object of IFCWall, the first object of IFCRelAssociatesMaterial, the first object of IFCMaterialList, and the first and second objects of IFCMaterial respectively.
[0068] S13, obtaining the name and corresponding ID of each component of the IFC file.
[0069] In one embodiment, when the relationship main graph, the relationship subgraph set and the model query graph are introduced, the relationship main graph G M As the basis of IFC model query, the vertex V M and its relationship are composed of, without knowing the format of IFC model and without predefinition;
[0070] The model query graph G S For actual query, the union set of the main graph and all relationship subgraphs is defined as follows:
[0071] In the formula, G S is the model query graph, Vs , E S is the vertex and node set of the model respectively, G M is the relationship main graph, G R is the relationship subgraph set, G R is composed of all vertices V sub,i and its inherited vertices V sub,j and the relationship between them.
[0072] The relationship subgraph set contains several relationship subgraphs, and each relationship subgraph G Sub is composed of vertices representing IFC model objectization, corresponding relationship attributes and edges. The definition of the relationship subgraph is G R {G Sub,1 (V Sub,1 , E Sub,1 )…G Sub,n (VSub,n , E Sub,n )}. Figure 4 relationship subgraph G Sub(IfcRelAssociatesMaterial) is defined as follows:
[0073] wherein, Vs , E S are the vertex and node sets of the model, respectively, relm#1, wal#1, mlsu#1, relm#2, wal#2, mat#3 are the first object of IFCRelAssociatesMaterial class, the first object of IFCWall class, the first object of IfcMaterialLayerSetUsage class, the second object of IFCRelAssociatesMaterial class, the second object of IFCWall class, the third object of IfcMaterial class, respectively. IfcRelAssociatesMaterial defines the objectified relationship between the elements or element types applicable for the material definition of the model. G Sub(IfcRelAssociatesMaterial) is the relationship subgraph IfcRelAssociatesMaterial of 。
[0074] wherein:
[0075] wherein, Vs , E S are the vertex and node sets of the model, respectively, relm#1, wal#1, mlsu#1, relm#2, wal#2, mat#3 are the first object of IFCRelAssociatesMaterial class, the first object of IFCWall class, the first object of IfcMaterialLayerSetUsage class, the second object of IFCRelAssociatesMaterial class, the second object of IFCWall class, the third object of IfcMaterial class, respectively.
[0076] Figure 4 in G sub , IFCRelConInSpstr , G Sub , IFCRelAssMat are the relationship subgraphs of IFCRelContainedInSpatialStructure (spatial structure relationship of IFC parts) and IFCRelAssociatesMaterial (relationship between parts and part types to which this material is applied), respectively; relm#1, relm#2 are the first and second objects of IFCRelAssociatesMaterial, respectively.
[0077] In one embodiment, the step of obtaining the names and corresponding IDs of each part of the IFC file comprises the following steps:
[0078] S131, querying the IFC file based on the shortest path algorithm, which refers to Dijkstra;
[0079] S132, determine the shortest path of IFCWall and IFCMaterial object and the attribute of IFCMaterial; for example, "gypsum board", so it is known that all IFCWall objects are composed of gypsum board.
[0080] S133, use model query graph to traverse in turn, finally get the name and corresponding ID of each component of IFC file.
[0081] JGraphT is a free Java library that provides mathematical graph theory objects and algorithms. The application utilizes JGraphT software to perform IFC model query and decomposition.
[0082] S2, convert the IFC file into an OBJ format file.
[0083] IFC and OBJ files, because they are common data formats. As mentioned earlier, IFC contains three-dimensional models and a large amount of semantic information about buildings. OBJ files only contain geometric information and materials, so they can be used as a medium for converting 3D building models.
[0084] In one embodiment, the conversion of the IFC file into an OBJ format file includes the following steps:
[0085] Construct a conversion framework for processing IFC files to OBJ format files;
[0086] Use the IfcConvert tool to batch convert the decomposed IFC file into an OBJ format file, while generating material information for each component in MLF format.
[0087] IfcOpenShell is an open source (LGPL) software library for processing IFC file format to OBJ format conversion framework, using IfcConvert tool to batch convert the decomposed IFC file into each OBJ format file, while generating material information for each component in MLF format.
[0088] Due to the large amount of data for each component after splitting, in order to ensure efficient operation of the conversion, the application is based on R language, shell statement is written, IfcConvet.exe program of IfcConvert tool is executed, batch implementation of IFC format to OBJ format conversion processing.
[0089] S3, convert the OBJ format file into a glTF format file.
[0090] glTF represents GL Transmission Format, which is open source, and the attribute information of the model, including material, node level, etc., is stored in a JSON format file, and the bin file contains metadata information and coordinates of the model; glsl contains shading information. The obj2gltf tool developed by the Cesium team is a tool for converting OBJ format to glTF format.
[0091] In one embodiment, when converting the OBJ format file to the glTF format file, the OBJ format is converted to the glTF format by the obj2gltf tool.
[0092] S4, converting the glTF format file to a 3D tiles format file, and completing coordinate conversion, constructing a space index, and view culling.
[0093] In one embodiment, converting the glTF format file to the 3D tiles format file includes the following steps:
[0094] The binary glTF (glb) is embedded in the 3D tiles data, and a 3D tiles generator creates an instance for each glTF format file, and parses each glTF format file and finds its corresponding JSON file;
[0095] Since the class name of the instance is the same as the file name without an extension, and its attributes are extracted from the JSON file, the first JSON object in each component file contains information such as "object name", "IFC type", "GUID" and "BATID", and the remaining attributes are extracted by querying the IFCPropertySets with names "Dimensions" and "Constraints" in each glTF format file;
[0096] The instance is contained in the b3dm header file in the batch table hierarchy;
[0097] The b3dm data converted from the glTF format file and the tile dataset file (Tileset.json) together constitute the 3D tiles format file.
[0098] The present application uses the "3D-tiles-tool Sample Generator" open source tool published by Cesium to group glTF and JSON (Streaming) files into b3dm files with a batch table hierarchy, and since the geometry and attribute information of each component have a one-to-one correspondence, there is no information loss during the conversion process.
[0099] Due to the different data ranges, the IFC model and the 3D tiles display data have different coordinate problems, so it is necessary to convert the geometric information of the IFC to the world coordinate system corresponding to the three-dimensional digital earth.
[0100] In one embodiment, the completion of coordinate conversion, construction of spatial index and view frustum culling includes the following steps:
[0101] The coordinate origin position in the IFC model is converted to (x1, y1, z1) in the world coordinate system of the 3D tiles format, the Z axis is vertically upward, the Y axis is north, and the conversion matrix corresponding to each coordinate axis is R x , R y , R z , θ x , θ y , θ z is the included angle of the conversion vector and the X axis, the Y axis and the Z axis.
[0102] The conversion matrix T t between the two coordinate systems is calculated as follows:
[0103] ;
[0104] Through the construction of the spatial index, the tile data set has reasonable LOD level division, ensuring the loading efficiency of the three-dimensional model data while improving the model rendering rate. Since the 3D tiles spatial index structure can exist interactively between the same levels and can be irregularly distributed, the octree structure is selected to construct the spatial index, and the tile is divided into eight sub-levels by using three orthogonal split planes to expand the quadtree.
[0105] When the three-dimensional model is loaded and rendered, only a small part of the data is used for display. On the basis of the spatial index, the other data is view frustum culled to reduce the interference during rendering and improve the data loading rate. The view frustum culling includes view frustum culling and back face culling.
[0106] In one embodiment, the view frustum culling includes the following steps:
[0107] The data that does not intersect the bounding box and the view frustum is culled, as shown in Figure 5 , and the view frustum culling formula is:
[0108] In the formula, (x, y) is the coordinate of the viewpoint;
[0109] h is the view range radius;
[0110] α is the included angle;
[0111] h is constructed by the following geometric relationship;
[0112] If h < r, the node in the view frustum is not loaded; if h > r, the node in the view frustum is loaded, and r is a geometric error.
[0113] In one embodiment, during model loading and rendering, the solid surface of the object A is visible, as shown in Figure 6 , and the dashed surface is invisible. The back face culling is used to cull the dashed surface by using the interface function provided by WebGL. Figure 6 In the embodiment, the view surface is a view surface. A
[0114] The present application takes a county-level city commercial residential area in China as an example, and explores a set of conversion technical process and visualization optimization method from city three-dimensional model format to 3D tiles based on open source language and tool. Three three-dimensional BIM models in IFC format of five buildings, 13 buildings and 15 buildings are selected as test data, and the performance of the test computer is tested: processor Intel(R) Core(TM) I7-11800H@2.30GHz, memory: 16GB, operating system: Windows10 64-bit professional edition.
[0115] The query and decomposition of the IFC model are performed, and this step mainly completes the splitting of three types of components. Firstly, the IFC component category includes IfcWindow, IfcDoor, IfcColumn, IfcBuildingElementProxy, IfcBeam, IfcCovering, IfcRailing, IfcFlowTerminal and IfcFurnishingElement. Secondly, the wall information of the component includes IfcSlab and IfcWall. Thirdly, the combined components of the component include IfcStair and IfcSite, and part of the execution code is as follows:
[0116] #1 = IFCWALL ('2kdjgs2dDDfGGFD7dfjg3D', #41, 'drywall', $, 'STD16.0:3918', #457, #90);
[0117] #2 = ICRELASSOCIATESMATERIAL ('3DKFdgdkfdg34DFldfdg', #4, $, $, (#43303), #91);
[0118] #3 = IFCMATERIALLAYER (#930, 0.02, $);
[0119] #4 = IFCMATERIALLAYER (#, 0.5, $); ...
[0120] #20=IFCMATERIALLAYERSET((#925, #921, #956), $);
[0121] #21=IFCMATERIAL('plasterboard');
[0122] #22=IFCMATERIAL('plaster');
[0123] The names and corresponding IDs of the components of the IFC model are obtained, and the IFC component files are named according to the IDs and saved to the local, for use in the next step of conversion.
[0124] The component information in the BIMServer is matched, and the attribute information in JSON format corresponding to each component is obtained. Figure 7
[0125] The names and quantities of the decomposed IFC components are shown in Table 1.
[0126] Table 1: IFC component names and quantity statistics
[0127]
[0128] The IFC file is decomposed, and the conversion from IFC format to OBJ format is batch-processed.The time required for IFC file decomposition and format conversion, and the file size are shown in Table 2. The decomposition and conversion of 5 IFC files are shown in Table 3.
[0129] Table 2: Time required for IFC file decomposition and format conversion, and file size
[0130]
[0131] Table 3: Decomposition and conversion of 5 IFC files
[0132]
[0133] The converted results are loaded and rendered for testing by using the WebGL visualization software to visualize the model after removing the view frustum and the back surface. Figure 8The frame number of loading before and after optimization is about 55 fps taking 5 buildings as an example. After visual optimization, the loading frame number is stable and the loading time is shorter. When the model is larger, the unstable frame number and the longer loading time will result in poor user experience. The size of the model does not change before and after optimization. Compared with the traditional lightweight method using geometric algorithm to reduce the size of the three-dimensional model, the method is more suitable for the loading and rendering of the larger model on the Web.
[0134] In the Cesium environment, a Tileset.json tile set file is added to the converted b3dm file, and the URL address is directly accessed under the Chrome browser.
[0135] Taking the Slab (thick plate) information of 5 buildings as an example, the original model geometry and attribute information in IFC format are as shown in the drawings. Figure 9 After the decomposition and conversion of the above IFC, the 3D tiles format is finally generated. In the Cesium environment, the thick plate information is queried, and the returned attribute information is the same as that of the original model, so that the attribute information of each component is maintained.
[0136] 1. Querying and decomposing the IFC model by graph theory
[0137] The JGraphT software is used to query and decompose the IFC model according to each component by graph theory. In order to avoid semantic errors, three parts of a relationship master graph GM, a relationship subgraph GR and a model query graph GS are introduced in this step, and the shortest path algorithm is used to traverse the model query graph in turn, so that the name and corresponding ID of each component of the IFC model are obtained, and the attribute information of each component in JSON format is obtained.
[0138] 2. Batch conversion to OBJ format by programming
[0139] Since the data of each component after splitting is large, in order to ensure the efficient operation of conversion, the present application is based on R language, a shell statement is written, an IfcConvert.exe program of IfcConvert tool is executed, and batch conversion of IFC format to OBJ format is realized, and material information of each component in MIF format is generated.
[0140] 3. Conversion of OBJ to glTF format
[0141] The obj2gltf tool is used to convert the OBJ format file generated in the above step to glTF format.
[0142] 4. Conversion of glTF to 3D tiles format
[0143] The glTF and JSON files are grouped into b3dm files with a batch table hierarchy using the "3D-tiles-tool Sample Generator" open source tool published by Cesium, ensuring that there is no information loss during the conversion process. The b3dm data and the Tileset.json file together constitute the 3D tiles data.
[0144] 5. Visualization optimization
[0145] The converted model is loaded and rendered by the WebGL visualization software after the occlusion frustum and back face are removed. After visualization optimization, the loading frame rate is stable and the loading time is shorter. The size of the model does not change before and after optimization, and it is suitable for Web-side loading and rendering of large models. In the Cesium environment, the Chrome browser is used to access the three-dimensional model directly using the URL address, and the attribute information of each component of the model can be completely preserved.
[0146] In summary, the present application can save the cost of purchasing commercial software, and converting to 3d tiles format can save the cost of purchasing visualization platform, solving the problem of expensive conversion software and bundled visualization platform on the market, a series of update and upgrade costs in the later period, and a more complex use process. The method provided by the present application can effectively avoid the problem of information loss, avoid the missing of parts of the model and the missing of attribute information of the model during the format conversion process of some commercial conversion software, and avoid the "black box" during the conversion process, obvious commercial tendency, and the conversion format is not what the user wants. The present application is based on open source language and tools, and explores a set of solutions for converting urban three-dimensional models (IFC format) to general format 3D tiles and visualization optimization research, completes coordinate conversion, spatial index construction, and view removal, to solve the problems of high use cost, platform and data incompatibility, etc. of urban three-dimensional models in large-scale applications.
[0147] The above only describes the preferred embodiments of the present application and does not limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for converting and optimizing a three-dimensional model universal format, characterized by, The method comprises the following steps: S1, split the source model in IFC2x3tc format according to the actual building components, obtain a JSON format file containing model component attributes and an IFC file containing component geometric shape information, and decompose the IFC file; S2, convert the IFC file into an OBJ format file; S3, convert the OBJ format file into a glTF format file; S4, convert the glTF format file into a 3D tiles format file, and complete coordinate conversion, spatial index construction and view culling; The decomposition of the IFC file comprises the following steps: S11, convert the IFC file into a directed graph according to the relationship of each component, and obtain a target object; S12, introduce a relationship main graph, a relationship subgraph set and a model query graph; S13, obtain the name and corresponding ID of each component of the IFC file; When the relationship main graph, the relationship subgraph set and the model query graph are introduced, the relationship main graph is composed of all vertices of the model and their relationships; the model query graph is the union set of the main graph and all relationship subgraphs; the relationship subgraph set comprises a plurality of relationship subgraphs, and each relationship subgraph is composed of vertices representing IFC model objectization, corresponding relationship attributes and edges; The obtaining of the name and corresponding ID of each component of the IFC file comprises the following steps: S131, query the IFC file based on a shortest path algorithm; S132, determine the shortest path of IFCWall and IFCMaterial objects and the attributes of IFCMaterial; S133, traverse in turn using the model query graph, and finally obtain the name and corresponding ID of each component of the IFC file.
2. The method according to claim 1, wherein, The conversion of the IFC file into an OBJ format file comprises the following steps: Construct a conversion framework for converting the IFC file into an OBJ format file; Use the IfcConvert tool to batch convert the decomposed IFC file into an OBJ format file, and generate material information of each component in MLF format.
3. The method of claim 2, wherein, When the OBJ format file is converted into a glTF format file, the OBJ format is converted into a glTF format by an obj2gltf tool.
4. The method of claim 3, wherein, The conversion of the glTF format file into a 3D tiles format file comprises the following steps: Create an instance for each glTF format file by a 3D tiles generator, and parse each glTF format file and find its corresponding JSON file; Extract the remaining attributes by querying the name in each glTF format file; Include the instance in the b3dm header file in the batch table hierarchy; The b3dm data converted from the glTF format file and the tile data set file jointly constitute a 3D tiles format file.
5. The method of claim 4, wherein, The completion of coordinate conversion, spatial index construction and view culling comprises the following steps: The position of the coordinate origin in the IFC model is converted to (x1, y1, z1) in the world coordinate system of the 3D tiles format, the Z axis is vertically upward, the Y axis is north, and the conversion matrix corresponding to each coordinate axis is R x , R y , R z , θ x , θ y , θ z is the angle between the conversion vector and the X axis, the Y axis and the Z axis; The conversion matrix T between the two coordinate systems t The calculation formula is: ; ; ; ; ; Select an octree structure to construct a spatial index, and use three orthogonal split planes to subdivide the tile into eight child levels and expand a quadtree; On the basis of the space index establishment, other data is view culled, and the view culling includes a view frustum culling and a back culling.
6. The method of claim 5, wherein, The view frustum culling includes the following steps: Data whose bounding box is not intersected with the view frustum is culled, and a view frustum culling formula is: ; In the formula, (x, y) is the coordinate of a view point; h is a view range radius; Alpha is an included angle; h is constructed by the following geometric relation: If h < r, the node in the view frustum is not loaded; if h > r, the node in the view frustum is loaded, and r is a geometric error.
7. The method of claim 6, wherein the method further comprises: In the back culling, an interface function provided by WebGL is used to cull a dashed surface.
Citation Information
Patent Citations
Fusion method of building BIM model and live-action three-dimensional model
CN110807835A
BIM data processing system for BIM data format conversion
KR101465481B1