At BIMData.io we developed the WebGL-based 3D viewer within our online building information modeling (BIM) platform.
In this article, I’ll describe some of the features that we implemented within the viewer.
Please note : Most of this article is taken from Lindsay Kay’s article, who was kind enough to let me adapt it ! :-)
BIM is a process involving the generation and management of digital representations of physical and functional characteristics of buildings, usually while constructing them.
With IFC visualization, the main challenge is how to engineer a WebGL-based viewer that’s able to render huge quantities of objects within the memory and execution constraints of the browser. After all, IFC models often contain an individual element for every single fire sprinkler, electrical fitting, light panel, and so on.
BIMData.io is a company in Lyon, France that provides a cutting-edge online BIM platform to manage your construction projects, including an all-in-one solution to visualize, check, edit and share building information.
Lindsay Kay is a freelance software engineer developing WebGL-based 3D libraries and apps for visualizing BIM, MedViz and CAD on the Web.
Lindsay implemented the BIMData viewer as a wrapper around xeogl, which is an open source library created by Lindsay Kay for WebGL-based visualization.
xeogl is also used in other commercial projects and is starting to receive contributions from other developers. This means that improvements and optimizations that made to xeogl for those projects will also benefit the BIMData platform.
Being geared to engineering visualization, xeogl supports many of this project’s requirements out-of-the-box. For the more application-specific requirements, Lindsay extended it with proprietary components, for things like custom camera controls and interaction widgets.
For this job Lindsay sub-contracted David Lenaerts, a freelance graphics programmer, to help out with the math for 3D gizmo interactions. I’d recommend David to any developer who needs help with their WebGL projects.
Our viewer is a facade class that wraps xeogl in a set of application-specific functions, with a plugin architecture into which we can incrementally add tools and gizmos.
This plugin architecture enabled us to deploy the core functionality of the viewer as soon as it was ready, then deploy various tools and gizmos incrementally, as we developed them.
glTF gives us options for geometry compression, such as attribute quantization, in which floating-point geometry arrays are compressed into integers, then decompressed on-the-fly within the WebGL vertex shader. This gives us smaller glTF files, a smaller viewer memory footprint and reduced usage of GPU bandwidth.
When the glTF geometry is not quantized, then xeogl automatically quantizes it while loading. At the same time, xeogl also automatically combines geometries from multiple objects into the same vertex buffer objects (VBOs), in order to reduce the number of VBO binds per frame. This enables us to render models up to around 200k+ objects.
For the next version of xeogl (v0.9), Lindsay is currently adding geometry batching in combination with instancing (using the ANGLE_instanced_arrays extension), which will enable BIMData to load millions of objects.
Annotations are notes that users pin to the surface of models. Our annotations are based on xeogl’s experimental Annotation components.
These are able to automatically hide themselves whenever something else occludes them in the 3D view.
Our users can create an unlimited number of cross-section planes, which they can arrange using mouse and touch input.
Under the hood, our cross-section planes use xeogl’s Clip components, which users can interactively arrange using our fancy repositioning gizmo. That was one of the bits that David Lenaerts helped out with.
Our ViewCube is a 3D camera orientation indicator and controller, which works the same as the one by Autodesk Research. Ours is a 3D gizmo Lindsay implemented on xeogl, with clickable hotspots that fly the camera to various vantage points.
xeogl has some built-in emphasis effects, such as ghosting and wireframe. We’re using those for highlighting and revealing BIM objects.
Edge emphasis and ghosting effects for X-ray view:
Our viewer has a bunch of tools to measure distances, angles and areas.
Using the distance measurement tool, users can select a pair of points on the surfaces of objects and get the direct distance between them, as well as the distance on each of the X,Y and Z axis individually. Under the hood, this tool uses xeogl’s 3D picking mechanism, while the distance tool itself is rendered using HTML elements layered over the WebGL canvas.
Camera navigation uses a custom xeogl component that allows users to control the camera with mouse and touch input. With our navigation component, users can orbit a point-of-interest, fly to selected objects, navigate in first-person mode, and “walk” to a point that they click on.
TODO: animated gif
The BIM Collaboration Format (BCF) is an open file format that supports workflow communication in BIM processes.
Our BCF system captures the complete visual state of the viewer as a JSON BCF record, that contains all the relevant viewer state, such as object visibilities and emphasis appearance, camera position, cross-section planes, annotations, as well as PNG snapshot image of the canvas.
Users can capture a BCF record of the viewer state, to indicate an issue within a model, then share that with other users, who can then load that view to see what the problem is.