Improve bounding volume — which affects camera fly to, selection indicator — for entities clamped to the ground
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
Initially discussed on the forum here: https://community.cesium.com/t/bounding-sphere-for-polygons-ellipses-on-ground-incorrectly-computed/10662. The summary is that the camera can't always fly to entities clamped to the ground as expected because entities are clamped in the shader, so there isn't a specific "position on the ground" they can be found at (an entity may in fact be half on a cliff wall and half on the ground).
This is a common need and rather difficult to work around on the application side, @lilleyse recommended opening to discuss potential ways to improve this on the CesiumJS side.
[Here's a Sandcastle](https://sandcastle.cesium.com/#c=3VdtT+s2FP4rFl9uIjKn6I4PKwWNcdndJCqQQBdNlA9u4iYWrt3ZTmk69b/v+CVpEt6uti/TCm3x8Xnzc855HNZEoTWjz1ShUyToM7qgmlVL/M3JotlB5tYXUhjCBFWzgwT9NRMIGaoUSG6UXLOcqnFjmClKDL2Xiud3XiWKZ2IXn8zETKwh2kryupDiUhhmagjqo2Nq14xqTPI8chGC4tjHQ6hkVBGVlXUb64IoA38R8RkvlFx+oYWiVJ9D1Dp68EYI/XB0dIxHCfpsP/tCeB19sAGv4+Q1V3bDyx/joLCEgytG+D4/yaXCf1xeXV3f42dmynO+Kkk0wsfeZJe0yNwSkWdEG04tAHdS8jlRv1TGSBF9+pXXyMhPCVpUIjMMRLHDJEC34PWdjHq4Wqff7xnZ3JqKIk2WK05fiQbFU1RX3EDVCmpufMALqBxV5yKfMjElm5d5eMvMqYGld4H9ut1eQuB2Dxb7DbLpbJCN22g2XdPUN1IzmyfodRpDFoqsSpa51mg7JfJxfV5B2x84dOtUavOFQrNzmkcB4EGvJ+ihH/gx9g2ATUlF1MLmk46b/vUpr4LNtfiqZCXy9nAPo0dXL6+apuieokxWPEdQX5QzRTPjq2VKphEnJuVwZls6WRlUaSYK2KKo44KJNdNszmlAKkFzUH2mSFUCNhtf86oYd6xKY1Z6nKYFuK7mOJPL1CP19Tb1dJAyrSuq05+Ojn5sDIcHwyVlRWnQ4Sk6Hp20EHhEM7KEYQ6d2+KDUE61YYJYP+NXi2nkvpTDiHE7qLs4BNw1lZGAjHpmmkaZFFrCMEBNperMSUDc0ZeHZYgeSAmgxziHrlRPzsQCnnFoIJq3CCC5cPIwCQmCCQSLJ7q3cMd3hQ01wA05QlXeI0XKOVtpyXKgxVBpRXLGxl3y3vNi9Hlk+Sp8fEBU97/9fnfZ46mRg2/3b7nEATBE8z9NMFCnKRTMFauTeAN+0xAlWcPhXAUqjeifFVsDb0AFXVUp0mxLg7t+T+AmutXo81a40HQ1N4pkJoKUEpt98kaF4z0EIY/X3C1JIZipchrZiN7ENRtuD4VdI/UfAzpxvPME9b/j/zkft6Q4lesX7RBYQXYri+DXLgvvzXZ+GHNm8J4rLfKr93F6l+qGhNo8A4Dff8B99qeB6bsnz+MI0FxuXKcGFHyiummJVgCn7NnjZhTa5zoMkb8RXtEobrHRzTheyOWqMr4EMHWKFPtgiGi41ICW4RsmJYWRecEKbwzPgB/asFB9nMH9SrsqjineVFlIhSKrZ2dodAJfk70yBlooTAnSw8O2AwM+Paes6TqfOd7YCxS28aYvrxt53ZdvG/k2yAPlM4Ft9lNiSkt/kRMk3nPTMVZWD5Vqr1R3lbZDpa1X2sb9oGTTCQoN5ATDoCCrh0ovgoJsO1TqB901RNQCl56+xL+jUH+ksH1Twb4VNZUScAt77cDRtkd2drAOkoOJNjWnZ1b5Z7ZcSQVPaYpHGKeGAsPBJazTeZU9UbistGPSSdqYTHK2Riw/feUfMPu8oTXsLCrOb+0Nc3A2SUG/Z8Yl8LMormFUOKlBxaYxKY/OrvwGxniSwtIGHdoaf7F3/P4N) showing the workaround I ended up doing in a client application.
* Flying directly to the polygon, you can't see it because the min/max difference in terrain height in this area is very large
* Getting the position and sampling the terrain involves extracting the positions from the polygon entity to get its position and size. So an application would need to do this logic specific for each geometry type. I also ran into this bug doing this: https://github.com/CesiumGS/cesium/issues/9114.
* I ended up creating an invisible sphere entity and having the camera fly there so it automatically flies at a nice distance/angle.
Contributor guide
Research direction
Start with the linked Sandcastle and forum discussion to reproduce the camera fly-to and selection-indicator behavior for ground-clamped entities. Review the workaround and related issue #9114, then define a CesiumJS-side bounding-volume approach that handles entities spanning terrain features and specifies expected camera behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100