hypar-io / Elements

The smallest useful BIM.
https://www.hypar.io
MIT License
349 stars 74 forks source link

ifc -> gltf? #401

Open bertt opened 3 years ago

bertt commented 3 years ago

Hi,

I'm converting a ifc 4 model (AC-20-Smiley-West-10-Bldg.ifc from this repository) to glTF using this code:

            var newModel = IFCModelExtensions.FromIFC("AC-20-Smiley-West-10-Bldg.ifc");
            newModel.ToGlTF("test.glb");

I'm using 0.8.0-alpha.9 of Hypar.Elements.Serialization.IFC.

In the result it looks like there are missing colors and geometries. Is there something possible to improve the output?

Ifc model:

image

glTF:

image

ikeough commented 3 years ago

There is still much improvement needed on the ifc->gltf pipeline. There are a number of ways which color can be prescribed in IFC. We haven't settled on which one we want to support for colors and material support. Depending on where the IFC is coming from, you may or may not see material colors. You can read a post about this here. Windows and doors are missing because we don't yet support boolean operations for openings. This will come soon as we add CSG support to our solids kernel.

bertt commented 3 years ago

ok good to know this is work in progress. About the geometry: I'm wondering why the ifc has 3 building levels, the glTF has 4?

ikeough commented 3 years ago

I believe the confusion is that in the gltf you're seeing the porch slab as if it were the porch roof. The porch roof and posts are missing, which is interesting because I believe we use this same model in our testing setup. The building has a basement (I assume) which you can't see under the topography in the IFC.

ikeough commented 3 years ago

The work we're doing in #406 get us here: image Most of what you don't see there is stuff that we don't explicitly support yet: doors, windows, topography. Support for all of these types will come in future tasks as we add the ability to generically handle any IfcBuildingElement.

Moult commented 3 years ago

Have you considered using the IFC to gltf workflow used by IfcOpenShell's IfcConvert?

bertt commented 3 years ago

@Moult yes works very well IfcConvert, just investigating alternatives for more custom solutions.