tile.__distanceFromCamera is generally Infinity? and tile.__error can be NaN if distance is 0
Description
I was using this as an extra point in the prioritizing, while debugging an issue I'd been seeing I'm noticing that all my tiles have tile.__distanceFromCamera: Infinity
Additionally, if you are inside of a tile, the distance returns 0, it's a divide by 0, ending up with a NaN.
This one comes up a LOT for us, as we're walking inside a tileset, rather than the normal looking down at the earth cases.
Reproduction steps
DistanceFromCamera: Infinity
- open: https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/index.html
- open console
-
[...window.tiles.activeTiles].map(t => t.__distanceFromCamera)
tile.__error: NaN:
- open: https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/index.html
- place the camera inside a tile
- open console
-
[...window.tiles.activeTiles].map(t => t.__error)
Code
// code goes here
Live example
Screenshots & Tile Set
No response
Library Version
master
Three.js Version
176
all my tiles have tile.__distanceFromCamera: Infinity
Do you have a repro of this? I'm seeing that tiles outside the frustum have a "distanceToCamera" of Infinity but are otherwise set correctly. We could change this to always set the distance, though.
Additionally, if you are inside of a tile, the distance returns 0, it's a divide by 0, ending up with a NaN.
Yeah this should be fixed. We can set the error to "Infinity" if the distance is set to 0.
Hmm, I didn't do anything odd to repro, I saw it in the demo index.html linked above, just zoomed in slightly.
I'll take a closer look in the morning.
using: https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/index.html
DISTANCE colorMode is also always white
Thanks - looks like this was a variable name that got changed in one place and not the other. Fixed in https://github.com/NASA-AMMOS/3DTilesRendererJS/commit/a0be772f1e526242b98b7267167b9a01819daf19.