xeokit / xeokit-convert

Convert various AEC model formats for efficient viewing in the browser with xeokit.
https://xeokit.github.io/xeokit-convert/docs/
Other
49 stars 52 forks source link

glb - [XKTModel.finalize] Failed to encode image: TypeError: BasisEncoderModule is not a function #81

Open DB-EC-Hamburg-BIM opened 2 years ago

DB-EC-Hamburg-BIM commented 2 years ago

When I run the converter on a docker with the latest alpine as baseImage, I get this error

[XKTModel.finalize] Failed to encode image: TypeError: BasisEncoderModule is not a function

I tried with DamagedHelmet.glb

my dockerfile

FROM alpine:latest
RUN apk add docker
RUN apk add --update nodejs npm
# create a sharedfolder for the dockercontainers with read write all
RUN mkdir -p /app/temp
RUN mkdir -p /app/uploads
RUN chmod 777 /app/temp
RUN chmod 777 /app/uploads
# Step 2 (BUILD): set the work directory (where you run all your orders and where you copy all your files)
WORKDIR /app 
# Step 3 (BUILD): Copy package.json to work directory
COPY package.json .
# Step 4 (BUILD): Install package.json
# -> with proxy
RUN npm --proxy http://proxy.de-consult.de:8080 install
# -> without proxy:
#RUN npm install
# Step 5 (BUILD): Copy all needed files from our current directory to work directory
COPY app.js .
COPY converterWorker.js .

# Step 6 (RUN): Tell container what command to run first -> node index.js
CMD ["node", "app.js"]

my package.json

{
  "dependencies": {
    "@xeokit/xeokit-convert": "^1.1.4",
    "commander": "^9.4.0",
    "cors": "^2.8.5",
    "express": "^4.18.1",
    "fs-extra": "^10.1.0",
    "multer": "^1.4.5-lts.1",
    "shelljs": "^0.8.5",
    "worker-thread": "^1.1.0"
  }
}

the command I run

node ./node_modules/@xeokit/xeokit-convert/convert2xkt.js -s " + "temp/kyS7OeMHu8jq/DamagedHelmet.glb" + " -o " + "Helmet.xkt" + " -l

and the log

[convert2xkt] Running convert2xkt v1.1.4...
[convert2xkt] Reading input file: temp/kyS7OeMHu8jq/DamagedHelmet.glb
[convert2xkt] Input file size: 3773.92 kB
[convert2xkt] Using parser: parseGLTFIntoXKTModel
[convert2xkt] Parsing normals: enabled
[convert2xkt] Parsing textures: enabled
[convert2xkt] Input file parsed OK. Building XKT document...
[XKTModel.finalize] Failed to encode image: TypeError: BasisEncoderModule is not a function
[XKTModel.finalize] Failed to encode image: TypeError: BasisEncoderModule is not a function
[XKTModel.finalize] Failed to encode image: TypeError: BasisEncoderModule is not a function
[XKTModel.finalize] Failed to encode image: TypeError: BasisEncoderModule is not a function
[convert2xkt] XKT document built OK. Writing to XKT file...
[convert2xkt] Converted to: XKT v10
[convert2xkt] XKT size: 206.02 kB
[convert2xkt] XKT textures size: 0.01kB
[convert2xkt] Compression ratio: 18.32
[convert2xkt] Conversion time: 3.98 s
[convert2xkt] Converted metaobjects: 0
[convert2xkt] Converted property sets: 0
[convert2xkt] Converted drawable objects: 1
[convert2xkt] Converted geometries: 1
[convert2xkt] Converted textures: 5
[convert2xkt] Converted textureSets: 1
[convert2xkt] Converted triangles: 0
[convert2xkt] Converted vertices: 14556
[convert2xkt] Converted UVs: 14556
[convert2xkt] Converted normals: 14556
[convert2xkt] minTileSize: 200
[convert2xkt] Writing XKT file: Helmet.xkt
[convert2xkt] Done.

gtlf files are working fine

xeolabs commented 2 years ago

Looks like an exception thrown by @loaders.gl/core / @loaders.gl/textures, which is handling the Basis compressed texture encoding for us.