-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial orientation of S2 globe is too sensitive to changes in the boundingVolume value? #11488
Comments
Hi @pmaxarr, thanks for the repot. Would you mind including a brief code snippet or sandcastle example that shows how you are constructing your scene? By default, the home view is oriented relative your timezone. If you are zooming to a bounding sphere, I would not expect such a small difference in the bounding region to cause a difference in orientation. |
Attached is a file with two tilesets, From a quick debug pass, the root cause can (probably) be tracked to this check in the The bounding spheres of the tilesets are computed as follows The In the second case, the center is not Focussing on the problem description: Finding a solution that does not involve discontinuities (in a mathematical sense) could be difficult. When zooming to a sphere with its center at (0.0,,0,0), there is no sensible orientation - so some default has to be used. When the center is at (1.0, 0,0), then there is an orientation. That orientation may be completely different from the default. What about (0.1...)? What about (0.01...)? What about (0.0000001...)? One could try to come up with something that interpolates between the "default" orientation and the "computed" interpolation, based on the distance of the center to the origin (maybe "weighted" by the inverse radius of the sphere). But making sure that it is robust and always yields "nice" results could be tricky... |
Trying to avoid that problem at the producing side could also be tricky. The fact that the values in the bounding region may be the result of some computation (possibly involving deg-to-rad conversions and conversions between CRSes) might make certain rounding errors inevitable. The way how exactly the values are used for computing the initial oprientation is not specified (it might work as expected for a given set of values, because of the One way to imagine the problem could be: Place the bounding shere at the origin, (x=0,y=0,z=0). Now pick it with the mouse, and drag it down the z-axis, slowly, always updating the camera so that it always matches the initial configuration that would be achieved with the
Maybe some maybe some solution can be derived from that... |
For what users can observe here, the problem is that the So the issue is....
In terms of solving this, the question boils down to What is the orientation that should be used when calling This unfolds into several considerations and follow-up questions. One high-level question (although only remotely related to this particular issue) is: Should this depend on whether the I could imagine that this should be taken into account. Imagine you have a glTF model that has a size of 10x10x10, load it with I do have an approach, implemented locally, but just as an experiment. The outline is: When calling
That "weight" is currently computed as
It seems to fix the issue for the given tilesets, but feels a bit shady: What does the ellipsoid have to do with all that? Imagine that the distance is |
The overarching question for fixing this issue is: Under which conditions should the In the meantime, one way of just avoiding the issue could be to not use Applied to a tileset, this could be
Which means that instead of calling |
In addition to the workaround that was described above: Considering that it is known (at the source) that this tileset is supposed to represent the whole globe, one wokaround could also be to not compute the bounding region, but just insert the (known) fixed bounding region (without the epsilon-deviations) into the tileset JSON. Of course, this would be very specific and a bit quirky, and a more general solution has to be found on the CesiumJS side, but maybe the problem could be avoided for this specific case, at least. |
Recently we had a problem that two versions of our internal S2 globe was displayed with different initial orientation by Cesium. After investigating we realized that the boundingVolume of the two version had a small decimal difference (7th decimal of PI).
Cesium seems to be sensitive to the exact value of the boundingVolume when opening our internal globe and selecting what S2 face to display as initial orientation.
Cesium is zooming to different S2 faces when opening our internal globe depending on the root boundingVolume value defined in the tileset.json file .
If the root boundingVolume is as follows then Africa (face 0) shown:
"root": {
"boundingVolume": {
"region": [
-3.141592653589793,
-1.5707963267948966,
3.141592653589793,
1.5707963267948966,
-10881.995181892067,
8805.044281111099
]
},
here -3.141592653589793 is identical to the definition of PI.
If the root boundingVolume is as follows then Antarctica (face 5) is shown:
"boundingVolume": {
"region": [
-3.141592618820418,
-1.5707962986969973,
3.14159264862274,
1.5707962837028416,
-10881.995181892067,
8805.044281111099
]
},
The difference of the bounding volume is:
Is this as expected? Is it required that the boundingVolume must be identical to PI to orient the globe to display Africa (face 0) as its initial orientation?
We were suprised that our small difference in boundingVolume resulted in the dispaly of different initial S2 faces (Africa/Antarctica).
The text was updated successfully, but these errors were encountered: