nytimes / three-loader-3dtiles

This is a Three.js loader module for handling OGC 3D Tiles, created by Cesium. It currently supports the two main formats, Batched 3D Model (b3dm) - based on glTF Point cloud.
Other
478 stars 65 forks source link

TypeError: Failed to execute 'createImageBitmap' on 'Window': The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'. #11

Closed 2226174644 closed 2 years ago

2226174644 commented 2 years ago

When I loaded a 3DTiles with images ,it logged this error. image The error is likely from here: image image image Also,I have tried to load it in Cesium, it works. Hope for your help.

2226174644 commented 2 years ago

I have sent the 3DTiles to your gmail @Avnerus .Hope it can help solve the problem.

Avnerus commented 2 years ago

Hey there! Thank you for reporting this and also thank you for your email with the tiles. I will look into them shortly. In the meantime, could you tell me what you used to create the tileset? Was it tiled on Cesium ION? It looks a bit different than the format I usually worked with. Please also specify any settings that you used to create the tileset. Thank you! /Avner

2226174644 commented 2 years ago

Thanks for your reply. For the tileset ,we used our own program to create it .And it wasn't tiled on Cesium ION . It can be loaded in the Cesium without Cesium ION. image

After tracing the source,I logged the tile in the contentLoader and compared the example 3dtiles with mine in the tiles.content.gltf.image. The Detail info : image It looks like the function contentLoader which is in the options of Tileset3D cann't provide the correct 'tile' ? Is the root of the problem from loaders.gl?

Avnerus commented 2 years ago

Hi @2226174644, thanks again for the detailed info. Are you able to try the current build that's in dev? I pushed a patch which should resolve the problem (has to do with resolving texture paths when they are external to the glTF). However, please use loadersGlGltf: false. In the next release, I am leaning toward removing the hybrid mode of processing glTFs in both loaders.gl and Three.js, as it is getting difficult to maintain. Let me know if it works! PS. Are you planning to open-source your custom tiler? /Avner

2226174644 commented 2 years ago

yeah,I have tried your current build that's in dev and used loadersGlGltf: false. It can load these images and models with without any error. However, the final result is not very good... just like-- image It's really confusing...Can you load the complete model there? For open-source,I'm not sure.Because modeling is the work of other colleagues and the tiler is like an earlier versions without some functions, such as KTX2 .I'll let you know if there's any news.

Avnerus commented 2 years ago

Hi, I ran this quickly with debug (debug: true in options, and scene.add(runtime.getTileBoxes()) ), it seems there is mismatch between the tile's bounding volume and model's transform, something that I haven't yet come across in models tiled by Cesium ION or RealityCapture. If you can see this properly in CesiumJS, could you check how the bounding volumes appear there? It might be there is a difference in how to transformations apply in loaders.gl and CesiumJS.

image

Avnerus commented 2 years ago

Hi, I ran this quickly with debug (debug: true in options, and scene.add(runtime.getTileBoxes()) ), it seems there is mismatch between the tile's bounding volume and model's transform, something that I haven't yet come across in models tiled by Cesium ION or RealityCapture. If you can see this properly in CesiumJS, could you check how the bounding volumes appear there? It might be there is a difference in how to transformations apply in loaders.gl and CesiumJS.

image

2226174644 commented 2 years ago

Hi~ I used the options(debug: true) ,it likely has no Tile the you circled in my scene? image About the bounding volumes In CesiumJS: image Excuse me for giving you so much trouble, thanks.

Avnerus commented 2 years ago

Got it, thank you and no worries! I suspect there might be a problem in the way the library handles the tile transforms back to three.js, but it is specific to the way the transforms are applied in your custom tileset since the issue does not occur in tilesets from RealityCapture and Cesium ION. It is anyway in the roadmap to re-visit the transform logic, so hopefully this could be fixed soon. In the meantime I could ask you to run a few more tests:

  1. Have you tried loading the 3d tiles using deck.gl?
  2. Is it possible that you could reset the transforms/geo-locations in your tiler?

Thanks!

2226174644 commented 2 years ago

Because I've never used deck.gl ,It took me some time to learn it but couldn't load the 3dtiles in the end.I also tried using mapbox-3dtiles to load and log it,it could be loaded without error,but there is nothing at the same latitude and longitude as cesium (sorry...). And because the 3dtiles are transformed from real scenes,so I can't reset the transforms At this stage.I can gmail another part of the whole data . May it can help you? PS. According to my colleague, the 3dtiles is handled according to the cesium 3dtiles standard, and no special content is added .The coordinate system of the 3dtiles is the standard ellipsoidal coordinate system of ENU (The ellipsoidal coordinate system of cesium). It used to be mainly used Cesium for UE to Parse. Also it can be parsed by CesiumJS as we can see.

Avnerus commented 2 years ago

@2226174644 Thank you again for the input. I haven't tried the new data yet, but I just pushed some updates, two of which help with the loading of your tileset. It looks now pretty good on my end: Screenshot from 2021-12-06 16-57-45

Let me know how it works for you.

2226174644 commented 2 years ago

Fantastic! It also works very well here with me. image Thank you very much again for your help!

By the way,have you ever encountered this problem when running? Although it has no impact on the operation of the program, why does it report such an error? image

2226174644 commented 2 years ago

And I found another issue. if the quantity of child node is more than 2 in the tileset.json(Combination of the first two models),for example: image there seems to be something wrong with its texture mapping and boundingVolume.Just like: Snipaste_2021-12-07_15-53-08 image I will email the new file which contains the two-part model so that you can have a try. Thanks!

Avnerus commented 2 years ago

Hi @2226174644, Yes I see there is another issue here. So far I have worked only with tilesets that have just one transformation matrix at the top (root or first child), and then everything under that is in relation to that. I will look into this further and let you know.

Avnerus commented 2 years ago

@2226174644 I have been doing some work with handling tile transforms and tried also to support your case. Could you please try the recent version? Thanks.

2226174644 commented 2 years ago

Excellent! It works very well.Thank you very mush!

Avnerus commented 2 years ago

Great! Regarding math.gl assertion, it occurs when the camera has some invalid data. Might be a race condition when the update occurs before the camera object has all of its properties. I opened a separate issue for that, so I am now closing this one. Thank you for the cooperation and please let us know if you get a chance to open-source some of your work, or are interested to in contributing new features to the loader!