iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.09k stars 293 forks source link

error THREE.GLTFLoader: setKTX2Loader #2170

Closed vladimir-rybalko closed 1 year ago

vladimir-rybalko commented 1 year ago

Your Environment

Version used: current master Browser Name and version: Chrome and FF Operating System and version (desktop or mobile): Windows Link to your project: https://codesandbox.io/s/itowns-3d-tiles-kt6r4x

Context

When loading 3D tiles, an error occurs - THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures. Data prepared in Agisoft Metashape. image

jailln commented 1 year ago

Some 3D Tiles contains GLTFs with textures compressed with KTX2. To load them, you need to specify to the GLTFLoader a KTXLoader that points to the ktx2 decoder library. I implemented an helper function enableKtx2Loader (similar to enableDracoLoader) to do so in #2172. I tested it with your model and it works

vladimir-rybalko commented 1 year ago

Some 3D Tiles contains GLTFs with textures compressed with KTX2. To load them, you need to specify to the GLTFLoader a KTXLoader that points to the ktx2 decoder library. I implemented an helper function enableKtx2Loader (similar to enableDracoLoader) to do so in #2172. I tested it with your model and it works

Thank you for your quick response. I compiled the code from your repository and fixed some of the code in the my sandbox. The error has fixed, but I don't see the model in the scene. @jailln, сan you attach a working example of the code here so that I can understand what my problem?

jailln commented 1 year ago

I pushed it on this branch. You can clone it, do npm install, npm start and go to http://localhost:8080/examples/vladimir-example.html :

image

It has no roof though :grin: but this may come from the model?

vladimir-rybalko commented 1 year ago

The no roof though is a model problem. Thanks for the help, it works. image