xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
738 stars 291 forks source link

XKTLoaderPlugin & GLTFLoaderPlugin not using original IFC colors correctly #233

Closed xeolabs closed 4 years ago

xeolabs commented 4 years ago

To make XKTLoaderPlugin use the colors from the original IFC file, we configure XKTLoaderPlugin to not use the per-IFC-type colors specified in objectDefaults.

However, those colors don't look so good, because the xeokit-gltf-to-xkt pipeline tool seems to be parsing the glTF colors incorrectly.

An example is the windows on the Duplex model, which should be transparent:

Screenshot from 2020-01-22 09-24-29

Cause

WIP

Amoki commented 4 years ago

I don't think there is a problem with the windows there. The gray comes from spaces. Windows are 100% transparent, but spaces are gray without transparency. Screenshot from 2020-01-22 10-09-22 And without spaces: Screenshot from 2020-01-22 10-09-29

xeolabs commented 4 years ago

Good catch - I just confirmed that the pipeline is actually handling colors OK, and XKT is loading them OK as well.

xeolabs commented 4 years ago

So, XKTLoaderPlugin & GLTFLoaderPlugin are using original IFC colors correctly, it's just that the IfcSpace elements were making it look like there was a colors bug.

By configuring objectDefaults to make IfcSpace elements 0.2 opacity (or just invisible), we see the original IFC colors coming through:

const xktLoader = new XKTLoaderPlugin(viewer, {
    objectDefaults: {
        IfcSpace: {
            pickable: false,
            opacity: 0.2
        }
    }
});

where Duplex seems to show all colors parsed correctly (within the IFC->COLLADA->glTF->XKT pipeline) - see screenshot.

Screenshot from 2020-01-22 10-23-56

xeolabs commented 4 years ago

Not an issue, all works nicely - verified by: https://github.com/xeokit/xeokit-sdk/commit/50dacbcd6180a2eaeae3948d7c61b13eeff27876

Live example: https://xeokit.github.io/xeokit-sdk/examples/#BIMOffline_XKT_Duplex_originalIFCColors