Skip to content
Back to projects

Technical project

BIM to Geo Conversion via Voxelisation

C++ pipeline that converts IFC building models into CityJSON by voxelising geometry and extracting semantic room volumes.

  • C++
  • CGAL
  • IFC
  • CityJSON
  • Voxelisation

Overview

Built a voxel-based pipeline in C++ that converts IFC building models into CityJSON 2.0. The pipeline voxelises structural geometry, classifies voxels as filled, exterior, or interior via BFS flood-fill, extracts per-room and envelope shells, and writes a semantically structured output with Building, BuildingStorey, and BuildingRoom hierarchy.

Objective

To convert IFC building models into valid CityJSON by voxelising wall, slab, roof, window, and door geometry; detecting enclosed interior spaces via flood-fill; and filtering spurious volumes using width and size thresholds.

Method

  1. 01

    IFC-to-OBJ conversion using IfcOpenShell's IfcConvert, retaining walls, slabs, roofs, windows and doors while excluding furnishings, openings, stairs and railings

  2. 02

    OBJ parsing into Triangle and Mesh structures; bounding box computed only from retained geometry to avoid inflating the grid

  3. 03

    Voxel grid initialisation with one-voxel padding on all sides, ensuring the corner voxel is guaranteed exterior and the flood fill can move freely around the building

  4. 04

    Solid voxelisation using CGAL triangle-voxel intersection tests (Iso_cuboid_3), marking intersected cells as FILLED

  5. 05

    BFS flood-fill from corner voxel to label exterior; remaining unlabelled voxels seeded individually to assign unique room IDs

  6. 06

    Room filtering by minimum volume (6 m³) and minimum width (0.3 m via erosion passes) to remove wall cavities and thin gaps

  7. 07

    Surface extraction by checking all six face-neighbours of each FILLED voxel, generating quads where adjacent to exterior or room voxels, split into triangles with consistent winding

  8. 08

    CityJSON 2.0 serialisation with Building → BuildingStorey → BuildingRoom hierarchy; storeys grouped by minimum z-coordinate with voxel-size tolerance

Visuals

Horizontal Z-slice of the voxel grid for the Sama Wellness Centre. Room labels assigned by flood-fill are visible as distinct numeric regions separated by filled wall voxels.
Comparison between the original IFC model and the voxel-based CityJSON reconstruction. The envelope and room subdivisions are preserved, with characteristic boxy artefacts from the discrete voxel grid.

Analysis

  • Room count is highly unstable with respect to voxel size — no plateau was found, disproving the initial stability hypothesis
  • Volume-based filtering (min_volume = 6 m³) pushed room counts below ground truth in most cases, making results worse rather than better
  • Width-based filtering (min_width = 0.3 m) at fine resolutions brought counts closer to reality — e.g. ~50 rooms at 0.25 m for the Wellness Centre vs ground truth of 50
  • No single parameter setting generalises across buildings: the voxel size that works for the Wellness Centre does not work for the Duplex

Results

  • Pipeline produces valid CityJSON 2.0 output confirmed with cjval, with full Building → BuildingStorey → BuildingRoom semantic hierarchy
  • Tested on two IFC models: Sama Wellness Centre (50 rooms ground truth) and Duplex (20 rooms ground truth)
  • Width-based filtering at voxel size 0.25 m recovered ~50 rooms for the Wellness Centre, closely matching ground truth
  • Room count remains chaotic across voxel sizes with no universally optimal parameter — explicit inspection of input and output remains necessary
Voxel size sweep showing recovered room count for the Wellness Centre and Duplex. Room count is unstable across resolutions, disproving the plateau hypothesis.
Effect of min_width = 0.3 m filtering at fine resolutions. Width-based filtering brings the room count substantially closer to ground truth compared to no thresholding.

Reflection

  • Compile-time filter constants (min_volume, min_width) require a full rebuild to change — runtime parameters would significantly improve iteration speed during experiments
  • The pipeline assumes watertight OBJ geometry; IFC models with missing or incomplete elements caused ray-casting artefacts and spurious room detections
  • Boxy voxel artefacts in the CityJSON output could be reduced with post-processing methods such as Marching Cubes, Dual Contouring, or mesh simplification
  • Parameter sweeps should be extended to multiple axes (voxel size, min_volume, min_width simultaneously) for a more complete stability analysis