Coder Social home page Coder Social logo

xbimgltf's Introduction

XbimGltf - Workflows and tools for the distributed representation of building asset via open standards

Claudio Benghi, Northumbria university at Newcastle, UK

26th September, 2020

Abstract

When working with Building Information Models across diverse platforms there can be an advantage in the storage of the model geometry in a format that is well supported across a variety of 3D viewers.

The glTF format has been identified as a candidate for such portable format, however it lacks the ability to retain meaningful semantic properties of the geometries exported that are necessary for most business workflows in the built environment; consequently a second format is developed to enable such workflows.

The presented solution supports production workflows under these scenarios; it allows the conversion of building geometries from the IFC format to glTF assets, establishes methods for identity management of such elements, and provide an extendable approach for the reconciliation of any semantic property lost in the conversion process.

[pre-print working copy]

Methodology

The development of this library has followed a fast-tracked version of the Design Science Methodology described by Wieringa 1, which promotes the equilibrium between technical and theoretical concerns that affect research and development projects in the Information Technology (IT) domain.

In accordance, the project was executed along the following stages:

  1. identification of the problem and motivation,
  2. definition of the objectives of the solution,
  3. execution of the design and development cycle, and finally a
  4. demonstration and evaluation stage.

1. Identification of the problem

The IFC4x1 format defines 126 different concrete classes that inherit from IfcRepresentationItem for the purpose of model representation, some of which (for example IfcSurfaceCurveSweptAreaSolid, IfcRevolvedAreaSolidTapered, IfcBooleanClippingResult, and many more) can only be converted for 3D rendering using computationally complex and time consuming algorithms.

This makes the IFC format unsuitable for the transmission of geometries for visualization purposes, particularly for devices with limited computational power and storage capacity, which can not be discounted in mobile and web deployment scenarios.

Consequently, it is common practice to convert the geometric content of IFC models into simpler schemas that, albeit dropping the powerful descriptive power of IFC, require minimal or null data transformation ahead of the 3D representation process, lowering the bar for the adoption of a variety of 3D visualization components. This conversion process is generally performed once in the controlled environment of a custom server where performance and resources can be balanced to guarantee reasonable user experiences, with the simplified geometry being retained on the servers, next to the original IFC source, to prevent information loss.

While transfer of the simplified geometry would be sufficient for the mere visualization of the model to any network client, it would lack any semantic property that is needed for most use cases2 in the management of building assets. While this limitation would be conceptually surpassed with the transfer of the associated IFC source, this has clear drawbacks. First and foremost, it would obviously result in duplicate data transfer; second, it would still require relatively complex algorithms on the client, given the complexity of the IFC format.

2. Aim and Objectives

The analysis of the problems, resulted in the formalisation of the following research aim: "Develop and test a sustainable workflow for the distributed representation and management of built assets across a platform-agnostic information technology stack."

2.1 Objectives

The proposed aim was later specialised with the definition of the following Objectives:

  1. O1 the identification of a geometry transfer format (GTF) that enabled deployment across a wide range of client environments,
  2. O2 a strategy for efficient transfer of non-geometric data for a range of business workflows, and
  3. O3 a software solution supporting the implementation of the identified format and strategy.

2.1. Approach

Furthermore, a list of guiding criteria were enumerated to support decision making in consideration of the nature of the industrial sector and the technical landscape:

  1. C1: a preference for open standard and open source algorithms. The long lasting nature of assets in the Built Environment and its stark contrast with fast obsolescence of digital solutions, determined a preference for open and accessible IT workflows as a way to mitigate the risks of technological lock-in as well as enhance the chance and reduce the cost of digital content preservation.
  2. C2: exact content experience. When dealing with diverse software environments it is often impossible to retain the same user interface on all platform; while this is acceptable, and sometimes beneficial, it is important that the identical content remains available across them.
  3. C3: Following current practice the research aims at a solution that can be integrated in a RESTful infrastructure that favours storage over computation on the service side.

3. Development cycle

3.1 Format selection

An initial review has been performed to select a long-list of suitable 3D formats; which has led to the following candidates: COLLADA, FBX, glTF, PLY, PRC, STL, Universal 3D, VRML (X3D), and Wavefront Obj.

  • Collada: Format maintained by Chronos Group published ad ISO/PAS 17506, initial release 2004, last release 2008. XML format with public XSD schema definition and good coverage of loaders (also known as DAE).
  • FBX: Format acquired and maintained by Autodesk, which regularly publishes a C++ SDK with bindings for Python; includes motion, with 2D, 3D, audio, and video data. Most popular in the gaming domain.
  • glTF: Format maintained by Chronos Group, started in 2013 and still active. Reference implementation is available as well as ports to several languages and environments.
  • PLY: Flexible 3D format specified by Greg Turk; excluded since it does not allow the definition of multiple objects.
  • PRC: Highly compressed 3D file developed by Adobe Systems. Last updated 2008. Powerful ability to describe alternative representation levels. Allows embedding of tri-dimensional models within PDF files.
  • STL: Widely popular format for triangulated meshes; excluded since it does not allow the definition of multiple objects.
  • Universal 3D: Accepted as ECMA-363 standard in August 2005. 3D PDF documents support U3D objects embedding and can be viewed in Adobe Reader. Provides definitions for higher order primitives (curved surfaces) and custom blocks.
  • VRML (X3D):
  • Wavefront Obj:
minimizes both the size of 3D assets, and the runtime processing needed to unpack and use those assets
it is an ecosystem of tools, documentation, and extensions contributed by the community

3.2 Model reduction

3.3 Flexible architecture

Evaluation and Demonstration

{>> TODO: present evaluation criteria <<}

Xbim.GLTF.IO

This library supports the export of coherent geometry and data from selected parts of an IFC file for consumption in other environments.

Geometry is exported in glTF format and the relative data in json. References exist between the two export sets in order restore their associations in any consuming workflow.

XbimPlugin.Gltf.IO

This project provides a UI to consume the function of Xbim.GLTF.IO within the XbimXplorer application, via the plugin system.

Usage

For most scenarios you will want to use nuget to reference the library in your project. You can do this by issuing the following command in the package manager command line:

Install-Package Xbim.Gltf.IO -Source https://www.myget.org/F/xbim-master/api/v3/index.json

Library authors

See also the list of contributors who participated in this project.

License

The library is published under the terms of the CDDL 1.0, alternative license agreements can be arranged contacting the author.

References

[1] Wieringa, R. J., 2014. Design Science Methodology for Information Systems and Software Engineering. Springer-Verlag, Berlin Heidelberg. ISBN 978-3-662-43838-1. URL http://www.springer.com/gb/book/9783662438381 (accessed 5.17.2018). ↩

[2] Assistant Secretary for Public Affairs, 2013. Use Cases [WWW Document]. Usability.gov. URL https://www.usability.gov/how-to-and-tools/methods/use-cases.html (accessed 9.26.20).↩

xbimgltf's People

Contributors

cbenghi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xbimgltf's Issues

Reduce GLTF generation time to 40%

Following pieces of code...

_coordinatesBuffer.Capacity = startingBufferPoisition + values.Count * sizeof(float);

Positions.Capacity += pts.Count;
Normals.Capacity += pts.Count;
Indices.Capacity += idx.Count;

... are setting the Capacity property of some List objects by hand.

As stated on https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.capacity?view=netframework-4.8:

When the value of Capacity is set explicitly, the internal array is also reallocated to accommodate the specified capacity, and all the elements are copied.

This means that setting the list Capacity by hand implies a memory reallocation+copy.

If, instead the referenced lines are simply removed, the List automatically increases its capacity (as more space for items is needed) in a much more efficient way (maybe doubling its Capacity whenever it needs more space (which would save many calls to increase it by hand), but not sure).

The result is that removing previous lines of code reduces the execution time for the GLTF generation part of the export process to 40% of the original time, in case of a relatively small xBIMfile (18MB) file (from 9.7s to 3.8s on a quick test scenario) πŸ˜ƒ

Material

Hi,

As you know, an element in Revit can have multiple material. for example, a wall can have two different materials on the Exterior sides. but when i convert the IFC file to GLTF format, an element(Mesh) only have a primitive. I would be thankful if you help me how to fix this.
IFC file save the materials of an element in IFCMaterialLayerSet though.

Bellow figure shows an example of a mesh in GLTF file with three different materials.

Mesh

thank you.

Export IFC GUID as mesh name (instead of IfcName + EntityLabel)

Currently the GLTF file creates meshes and populates the 'name' property with the IfcName of the element + the IfcEntityLabel of the element (the "row number" in the IFC file)

since names don't follow any convention, I believe it is more robust to use the IfcGUID instead.
IfcGUID is unique per element, and doesn't change in cases of minor changes to the IFC file (i.e. authoring or editing), while the name can change (i.e. changing the convention, translating) and entity labels can also change.

Also IfcGUID is mandatory for all elements and objects.

Rework of the GLTF converter

Hi @CBenghi,

Due to the need of a GTLF converter that supports separate primitive node hierarchies (issue #10),
I began to rewrite the current one here: dn9090/XbimGltf (with most work done in this commit).

The current status is that the new implementation is a lot faster (35%) because of multi-threading
and is restructured so that it allows for an easier implementation of new features like the separate node hierarchies.
I noticed some things in the original implementation that I cannot understand or that are unnecessary in my view but
stayed in the implementation to ensure compatibility.
Also I reimplemented the original Builder API to use the new XbimGltfBuilder under the hood.

I would be glad if you could take a look at the project.
In the next steps I will try to support the hierarchy feature.

Thanks!

Parts missing in converted IFC

Hello,
I converted an IFC representing a concrete column with longitudinal rebars and stirrups.
The problem is that stirrups are not displayed except the first one. I suspect an error in coordinates (RelativeTo placement vectors).

Please find attached IFC model - I tried also to check code but in vain - and (wrong) .gltf output I get.
singleCol.zip

can't export gltf andjson file

Hi,i just download the code and run Maintests,but the two files don't exsit in bin/debug/net472/Files ,what happened?Hope your reply!

Unable to install using nuget

Hi, trying to install using nuget on Ubuntu 16.04 LTS, per the README:

nuget install Xbim.Gltf.IO -Version 4.0.1-V0007 -Source https://www.myget.org/F/xbim-develop/api/v3/index.json

nuget's not able to find the version from those instructions:

Unable to find version '4.0.1-V0007' of package 'Xbim.Gltf.IO'.

Can I lower the quality of export model?

There is an IFC file, in which there are many tube, the conversion of gltf file is very large.
Is there a way to reduce the quality of the model, such as reducing the number of triangles?

IfcCurtainWall not exported

I have an IFC file with curtain walls within, which I'm using to export to gLTF. For some reasons, curtain walls are decomposed into mullions and panels so I cannot rely on entity label because curtain walls as elements are completely lost during conversion. Is there any setting to change this or I'm not exporting appropriate IFC file from Revit? I can provide IFC file upon request.

"Expected value to be greater than or equal to 1" in Accessor.set_Count - probably corrupted element...

Hi,
I got this "Expected value to be greater than or equal to 1"
when trying to generate a GLTF from an IFC file I have.
I think this element is corrupted since Revit (and other IFC viewers) cannot load this element.

I debugged it and saw that it happens when it one of the elements XbimShapeInstances has an empty bounding box.

Would you consider to add a filtering condition in 'GetShapeInstancesToRender' in the Builder class to avoid this crash (since we anyway can't get the GLTF for this shape) or will it lead to other problems?


    private static IEnumerable<XbimShapeInstance> GetShapeInstancesToRender(IGeometryStoreReader geomReader, HashSet<short> excludedTypes, HashSet<int> EntityLebels = null)
        {
            if (EntityLebels == null)
            {
                var shapeInstances = geomReader.ShapeInstances
                    .Where(s =>
                        s.RepresentationType == XbimGeometryRepresentationType.OpeningsAndAdditionsIncluded
                        &&
                        !excludedTypes.Contains(s.IfcTypeId));
                return shapeInstances;
            }
            var entityFilter = geomReader.ShapeInstances
                    .Where(s =>
                        s.RepresentationType == XbimGeometryRepresentationType.OpeningsAndAdditionsIncluded
                        &&
                        !excludedTypes.Contains(s.IfcTypeId)
                        &&
                        EntityLebels.Contains(s.IfcProductLabel)
                        && (s.BoundingBox.IsEmpty == false) //  <====== Maybe this check is required to filter corrupted shapes?    
                        );
            return entityFilter;
        }
    }

Work with command line

Hello,

Could you please explain how to work with Xbim Xplorer in cmd? I want to convert ifc to gltf via Gltf Explorer, can I make convertion without using UI, only with commands in terminal?

Thanks in advance.

the gltf file is unreadable

Hi,
I try to convert a file proxy.zip with XbimGltf.
but the gltf file is only 1kb and unreadable with message "Cannot read property 'asset' of null".
dont know if this is a file problem?

thank you.

Linux compatibility

Hello,

I saw others also opened this topic. I have basically two questions.

  • When are you planning to release XbimGltf?
  • Are you planning to make compatible with .NET 5.0 on linux? I know the package relies on XbimGeometry, which is not yet compatible, but are there any windows dependencies that prevents compiling on linux? xBimTeam/XbimGeometry#306

Thanks very much your answer in advance.

Cheers

NuGet Feed Not Updated

It seems that the latest version for Xbim.Gltf.IO is V0008, but NuGet feed is still stuck at V0007 (based on command below from official documentation):
Install-Package Xbim.Gltf.IO -Version 4.0.1-V0007 -Source https://www.myget.org/F/xbim-develop/api/v3/index.json

Can you please check for the latest version since we need the latest updated which resolves null handling in certain scenarios?

Thanks

Clarification of "what is this number" comment

In the following piece of code:

_coordinatesBv.ByteStride = 12; // todo: what is this number?

There is the following comment:

// todo: what is this number?

The stride (https://en.wikipedia.org/wiki/Stride_of_an_array), is the distance in bytes from one element to the next in a in-memory buffer.

Each coordinate is a float32 (4 bytes), and each position has 3 coordinates (X, Y, Z).

So the distance in bytes in glTFLoader.Schema.BufferView between each consecutive position:

(4 bytes / coordinate) * (3 coordinates / position) = 12 bytes / position = stride

Just a silly issue to be created, I know, but hopefully can get rid of that todo: what is this number comment πŸ™ƒ

weird to my ifc file

I successfully use XbimGltf as a class library in my project.
1. I found that for the demo "OneWallTwoWindows.ifc", the out gltf & json
ifc.zip
data is good. However, for my own .ifc file, the out .gltf & .json file is only 1kb.
2. In previous version, I can get .bin file. But right now I can not get one, what may be my problem?

Entity Labels are not unique / Entities cannot be indentified

Hi @CBenghi ,

my team is using the GLTF converter to load IFC models into Unity3d.
While working on the implementation we noticed that there can be duplicate entity labels or that some entity labels belong to the parent and not to the actual entity.
I looked at the GLTF JSON data and noticed that the issue lies in the xBimGltf converter.

{
	"mesh": 348,
	"name": "Basic Roof:Live Roof over Wood Joist Flat Roof:184483 #4229"
},
{
	"mesh": 349,
	"name": "Stair:Residential - 200mm Max Riser 250mm Tread:151086:1 #5984"
},
{
	"mesh": 350,
	"name": "Stair:Residential - 200mm Max Riser 250mm Tread:151086:1 #5984"
},
{
	"mesh": 351,
	"name": "Stair:Residential - 200mm Max Riser 250mm Tread:151086:1 #5984"
},
{
	"mesh": 352,
	"name": "Stair:Residential - 200mm Max Riser 250mm Tread:151086:1 #5984"
},
{
	"mesh": 353,
	"name": "Stair:Residential - 200mm Max Riser 250mm Tread:151086:1 #5984"
},

The name is always the same with the same entity label (#5984) only with different mesh ids.
Gltf
In unity the mesh id gets added to the entity label because otherwise the name is not unique.
Our problem is that we need the actual entity ids to match them with existing IFC data.

For example we have a table with different mesh components that have different surface styles but due to the converter issue we get the same entity id for every mesh and therefore cannot match the surface styles to the entity label.

While looking at your code I also noticed some strange lines like

if (productLabel != shapeInstance.IfcProductLabel)

in Builder.cs#375 because you never change the productLabel after initializing it to zero in Builder.cs#348.

Is it possible to fix these issues?
I would be willing to fix parts of it myself, if you can tell me where exactly our issue is located.

Thanks for reading.

Permissions changes

Hi @andyward,

after your comment on the xplorer plugins compatibility issue I've been going through the various repositories to update the binaries and I seem to have lost access to this one, as I have an updated that I need to push.

I wonder if you know of any permission changes that might have affected this.

I've noticed that I'm not listed as a maintainer on the xbimteam, while Steve, Martin and you are.
Might that be the reason?

Thanks,
Claudio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.