GLB and compressed models
Instead of the OBJ files the card can load a .glb file: a single binary file, faster to load. mtlfile is not needed then.
path: /local/floor3d/objfile: home.glbFrom OBJ to GLB
Section titled “From OBJ to GLB”obj2gltf converts the export of Sweet Home 3D. It needs Node.js:
npm install -g obj2gltfIn the folder of the export (the .obj, the .mtl and the pictures):
obj2gltf --checkTransparency -i home.obj -o home.glbIt takes from a few seconds to a few minutes. Copy home.glb into the folder of the model in Home Assistant.
Compressed models
Section titled “Compressed models”A .glb can be compressed with glTF Transform, often several times smaller:
npx @gltf-transform/cli meshopt home.glb home-meshopt.glbnpx @gltf-transform/cli draco home.glb home-draco.glbThe names of the objects stay the same, so the entities keep working.
- meshopt: the decoder is part of the card, about 25 KB, loaded only by these models. Doors, covers and fans move as in the uncompressed model.
- Draco: usually the smallest file. The decoder (about 250 KB, the glTF build that three.js includes, by Google under the Apache License 2.0) comes with the card, next to its other files, and is loaded only by these models; it works without Internet access.
draco_decoder_pathsets another folder withdraco_wasm_wrapper.jsanddraco_decoder.wasm, for example/local/draco/.
The card reads the file first and loads a decoder only when the model needs it: an uncompressed model loads as before. The idea comes from Steven-D-Morgan/hass-3d-floorplan.