ebeaufay / threedtiles

3DTiles viewer for three.js
MIT License
270 stars 32 forks source link

Lod issue for 3dtile with height using threebox logic #19

Closed skywalkershen closed 5 months ago

skywalkershen commented 1 year ago

Overview

I'm using mapbox with threejs to put 3d assets at certain geolocation. Yet, if height is set with threebox logic, the metric calculated for each tile for the tileset will be off, and detailed lod cannot be rendered.

Description

I'm using logics taken from threebox to put threejs objects at geolocation in mapbox. The way it syncs threejs scene and mapbox can be found in src/useCameraSync.js.

Basiclly, it puts everything in a group called world, then add groups called site to certain position. When mapbox camera moves, it modifies both camera and world to make threejs scene consistent with mapbox.

However, when putting 3dtile into site, the lod doesn't work well for those with a y transform off the ground. After debugging with sourcecode, I found it was the issue with the calculation for metric(method calculateUpdateMetric) . Yet I have no clue why an offset in y axis leads to this issue. I can only adjust the geometricError to make the detailed lod load, yet it simply load the leaf tiles and leads to large memory cost.

Screenshots image image image

Other suggestions

  1. Whether it is possible to publish the source code instead of the bundled and minimized js file for npm package? If there is a need for customizing source code, people can simply use patch-package to modify source code in node_modules without forking and making another package. But it doesn't work for bundled npm package. Also, debugging source code would be easier.
  2. Whether it is possible to allow using self created draco/k2x loader or allow users to define resource files path?

I'm sending in the code with detailed description in README.md for replicating the issue. Hope you can help me with this issue.

Thank you.

ebeaufay commented 9 months ago

hi @skywalkershen, sorry if I haven't replied to this. It's been a while, we fixed this offline right?