Skip to content

IFC4 loses element colors compared to IFC2x3 #1793

@hwrdyen

Description

@hwrdyen

Describe the bug 📝

*The IFC2x3 and IFC4 files used to reproduce this issue were shared directly with antonio@thatopen.com

What happened:
I have two IFC files generated from the same Revit model:

  • One exported as IFC2x3
  • One exported as IFC4

When loading the generated fragment binaries in a self-built viewer using @thatopen/fragments:

  • ✅ The IFC2x3 → .frag file renders all element colors correctly
  • ❌ The IFC4 → .frag file renders only some elements correctly (e.g. wood beams), while most other elements appear dark grey
  • Both files are processed and loaded using the same fragment pipeline and viewer code.

What I expect:

  • The IFC4 export should display the same element colors as the IFC2x3 export, since both originate from the same Revit file.

What actually happens:

  • In the IFC4 version of .frag, many elements lose their colors and fall back to the default dark grey material, while a subset of elements (e.g. wood beams) still retain their colors.

Assumption:

  • When converting IFC4 to .frag, the structure changes compared to IFC2x3. For example, IFC4 uses a different structure and does not have the IFCPRESENTATIONSTYLEASSIGNMENT entity to directly link IFCMATERIAL with the corresponding IFCCOLOURRGB. As a result, the “color–element” relationship may not be fully preserved in .frag, causing the colors to default to grey.

Test:

Image
  • To rule out its related to my setup or configuration issues on my side, I also tested running the same file through engine_fragments example IFC importer locally, and observed the same missing color behavior there as well:
Image

Screenshot Demo:

  • IFC2x3 → .frag (correct color):
Image
  • IFC4 → .frag conversion (some loses colors and becomes dark grey):
Image

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

System:
    OS: Linux 5.15 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (16) x64 Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
    Memory: 13.25 GB / 15.50 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.14.0 - /home/hwrdpvt/.nvm/versions/node/v22.14.0/bin/node
    Yarn: 4.9.2 - /home/hwrdpvt/.nvm/versions/node/v22.14.0/bin/yarn
    npm: 10.9.2 - /home/hwrdpvt/.nvm/versions/node/v22.14.0/bin/npm

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Community.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions