Hello Cesium community.
I have done several tests with clamped polygons in Cesium and I see behavior that I am not sure is desired. Or at least it should have the option to disable it.
I use Viewer with the globe enabled, above 2000 meters high I have a 3D-tile that corresponds to a terrain photogrammetry.
On that 3D-tile I have placed a yellow polygon clamped to ground.
Indeed, the polygon is shown as clamped to the 3d-tile, but it is also shown as duplicate clamped to the globe. See Figure.
Is that a bug or a desired functionality?
In my case it is not desired, I would like to be able to remove the duplicate on the globe.
Any suggestions?
Best
Mose
@Moises_Herrera
Hello! I believe we chatted on Twitter last night
I recommend that you set classificationType: Cesium.ClassificationType.CESIUM_3D_TILE
. Check out the following sandcastle that showcases how this can be implemented.
In general, adding the polygon to the 3D Tileset and the globe is useful if you have a 3D Tileset that is embedded in the terrain.
For use cases where the 3D Tileset is stacked vertically above the globe, there is not much that you can do to only add a polygon to the 3D Tileset. Our implementation of clamping uses a shadow volume. Thus, to draw the polygon, the graphics engine more-or-less extrudes the polygon vertically and renders it on any surface that it intersects with.
I suggest that you try using clipping planes to cut out part of the globe and embed your 3D Tileset into it. This will give your users a more seamless and realistic experience. The following sandcastle demo showcases clipping planes.
Cesium Sandcastle
Let me know if you have any other questions or concerns!
-Sam
Thanks for your answer.
I have studied the use of classification a bit, but I have found that both the use of classification and the clamped implementation do not work properly on mobile phones.
I have raised an issue related to this
issue 9702
To visualize the 3D tools under the terrain I have used depthTestAgainstTerrain but this option does not allow to remove the collision of the camera with the terrain. Ideally, it will collide with the 3D Tile but not with the terrain. Of course I could use clipping planes to cut the globe but I feel that filling the scene with cuts makes it inefficient.
Do you have any advice to disable the camera collisions only with the terrain?
Thanks again
Best
@Moises_Herrera
You are welcome! I am happy to help out.
Regarding the issue you mentioned on GitHub, I will check in with the rest of the Cesium development team and try to determine a timeline for when the issue will be addressed.
opened 12:35PM - 30 Jul 21 UTC
Based on several posts that have been generated during the last few months and c… arrying out new tests with various mobile devices on Android, we have detected a problem with the polygons campled to ground over 3D tiles or Terrain. Polygons don't draw well when viewed on mobile devices.
When approaching (close) you can notice that areas of the polygon disappear.
More details can be seen in @tonycedeno post
[https://community.cesium.com/t/problems-with-clamped-polygons-on-mobile-devices/14627](https://community.cesium.com/t/problems-with-clamped-polygons-on-mobile-devices/14627)
Sandcastle examples:
[Original Sandcastle](https://sandcastle.cesium.com/?src=Clamp%20to%20Terrain.html)
In the following link from sandcastle you can see that when zoom-in near the polygon “Draw Polygon” option also has this erratic behavior
You can see this behavior on this Story hosted in Cesium ION:
[Story](https://cesium.com/ion/stories/viewer/?id=543fab97-f74d-42eb-9368-f772dd50340b)
**Related issues already closed:**
Some posts that could be related and that are closed: #7273 #8953 #6735
On the other hand I have noticed that using 3d-tiles with classification have a similar behavior.
**Browser:** Google Chrome
Operating System: Android 10
**Devices tested:**
- Samsung S20+
- Samsung S20 Ultra
- Huawei P20 Lite
- Samsung Galaxy Tab
**CesiumJS** version 1.83
Any type of help that you can offer us to solve this issue will be very helpful since the functionality of showing clamped to ground entities is one of the main ones to visualize on mobile phones.
Best
Moses
In terms of disabling the camera collisions with the terrain, have you had the chance to check out the following resources?
I would start with these resources. The first thread includes a link to the “Camera underground controls” pull request which was merged last year. This will help you get up to speed on the capabilities of the new feature.
CesiumGS:master
← CesiumGS:camera-underground-controls
opened 04:03PM - 29 Apr 20 UTC
Opening this PR for early testing. There's still some work to be done, especiall… y for panning. While I had the urge to rewrite `ScreenSpaceCameraController` I took the opposite approach and just modified camera behavior when underground. Above ground controls should be the mostly same, for better or for worse.
At a high level the changes include:
- Added ability to zoom into the ground, like submerging below the terrain. This happens by default if `enableCollisionDetection` is false and `minimumZoomDistance` is greater than 0.0. I'm occasionally noticing large jumps which I still need to fix.
- Changed zooming, rotating, and panning behavior when underground. There's a new property in `ScreenSpaceCameraController` called `undergroundSurfaceHeight` which acts as an invisible ellipsoid that's used to improve camera navigation when underground. For best results the height should be set just below the height of underground entities in the scene.
- When underground, the zoom distance is now determined by the position over the mouse's cursor rather than the position at the center of the screen. This should make it a lot easier to navigate to underground datasets.
- Fixed what seemed like a kludge in the camera panning code which had the side effect of panning every other frame. Basically panning felt like 30hz while other camera controls felt like 60hz. Panning feels so much smoother now.
[Local sandcastle for testing](http://localhost:8080/Apps/Sandcastle/index.html#c=5Vptd9s2lv4rXH+xPFVggAABwk4yEzvuNGfcJCdJ29NdzweKgi2e0KQOSTlRd/Lf97mkKJGUnMjZpPNh2p5awsvFxXPfL3QXFd5d4j64wnviZe6Dd+7KZHHLfq3HRlcHcf39PM+qKMlccXUw9v73KvO84+PKFQXGXhf5XTJ1xUm7NS5cVLnf8iKdvmuWjI7GtCUvsOxFNnVzh/9l1bsiysp0EbssXp5411Fauqvs09HpVXaVHR83XLES047dpPnEMZdFk9RdJjezKsluwHBVLFy9/A7XqFdisLvxtJmqt2OqQ6ze1pCtOnyw6wJX/TGK3bN0PovOls+Tsoqy2PXheemi4seoeBtHaVSMFOeMj736f2HzWTBOF9lxwCSK3z+QPoHXnEGf2r/hegSHXWVHayDSPLtJqsWUaD6SLPQDEa6ASKOqnQkkE8L47czMEay0wzc+C0+Pj+s/zeQ8L5MqyTNMrxg8j4oKn6JMEmK3z91N4VxZc7o+vuatPbH+0hzS8Ep0F0UKklcHjB3jv7fR7Tx1z6MqOr7Npy4tj19HRXzpounPUL3eF8hwcnWwvjGUKamWG9nX3xNXsmg6HdXqmkW37oTOq/lo73Oy/lQP16eeNPrtYXGy2fFpvFZNOnCSfyQE8psimidxH5Z6cJbEPWA2oGwQAdSckxBbOPJq5oqz/OPnLtJcxTvxDs/ShSNGDsfN+OZSu5ip8rXIRn3uj1b7MeqtL0//TJNbl5WgWGK8o5wb2Y8EX6n75i+uM97QuIUrKJIo9TZc5WlesLPLXy6aVZ/WwLa6li5valW7F4PVkjWzs8QVUI7Zssfm62bVT+3kqOXqsyr8DB5r+VOtp+XofzYXIUMSgW9Cq63vSxkK07kmGZOvAl8on8vQWqs7k5Ay87kxVllf+b4fBOMBXR3YIODc18JyoYd0gyCwUgX4lwc9sgELg1AqKbUNQGNI1ucisDakI7FWDcn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s0id1rXKt90fUVb6eqKH7fnZKar/1Q0wce/vSOxBBH+FNuJNB8x3TzgXzNswrGN1mg0D+sokmSTR2l14f88OjUOz4G4G7qpl6Ve/NF5V3nMcIC1LeauRXxNa08i8H/ezK4oZ9brah31/2EpqW87hBDHy7u8OEyKStYVDE6fO+W0/xD1nGa3si15Ki76xiWeE+ePPEO40PvX//y6oHznH4Th0FtjjrBtIGCTLMLBX0/7a0pK7Kiw8975avscLOLdvyALft66UPvhxUnrFVqWN0PHkG+Y2p5/9QfNAU1vJed/V15h/ysmds+lhZvjZKT+xIbe7r8nfuhyZ3RGIqfw3Wn+c0IK5pm3yqDORgfPC6rZeqetsv/ltzO86KiX/6NGDuu3O08hX2Xx5MF3G7F4rJcUfAeH3e3Pp4md14yfbLjN7PNbz0wc71I07fJH/BPTx8fY/3W1jSvcXx154o0WtKymXh62Qwyxh4f4+vunevHkfVNHlcUQ55uoujjapJPl50BGip632lk+rT7y1xv9eLw+BgT20v7IxhLMjL4ajl3hATFKqSogGAaVdEj8hPtcPNUtfVy0bnAiuLwYAwUe1zixwg2PVkiIW56yN/lAv029Tfj/S31We/qvmp97nfhvd+7/Xa404OIR016rw57X8U79OIGcHq3SYZv9JyIz9FHfBb1Z/j7eT0hBre7o5eE4avM2KuHf6kb0yjC6qMOt248ZKJyHys6CwaLb8E+J30zFM8Qt//dIA7eir4fhr2DvhmEv2xeQJq3fC/6t0F5z8vO94N054EPhhZfeyED3zsxpRuI/g8)
![underground-controls](https://user-images.githubusercontent.com/915398/80618332-3666b800-8a11-11ea-879c-710301e1b4b3.gif)
@fredj @gberaudo
Let me know if you have any other questions! I am looking forward to learning more about your project.
-Sam
1 Like