Hi, i want know it’s possible to clamp a 3dtileset(b3dm) to ground when has a terrainProvider(from cesium world terrain)?
It is indeed possible! As you can see in this guide,
b3dm is a supported tiler data format.
Thus, we can use the following guide to set the location of the data and clamp it to the ground, once it is uploaded to Cesium ion.
Let me know if this helps! I am happy to address any lingering questions or concerns
There’s an extended answer to this as well, which is that there’s no property on a tileset to clamp it to ground, but there are ways to transform the viewed tiles into the right place. It’s not straight-forward, of course, but similarily to the guides above you can do it through the Cesium API / code.
So, in short; If you can do it on the processing side (as you create the tileset), that’s the best answer. In code it gets complicated, but it is still doable (look for tileset transforms). It often comes down to how accurate your tileset is (position, rotation, scale, uniformity, etc.), but if it’s reasonably accurate you can do something like this;
Load your tileset, but don’t show it, and find the bounding middle point of your tileset (should be in the root tile), then sample terrain at that point, then show your model on the map and then sample your model at the same point you sampled the terrain. The rest is basically a transform height to the same as the terrain sample. That’s the short version, but give it a stab first. There are some issues with sampling terrains and models unless the camera is looking in the right spot, so make sure the camera is looking at that sampling point from a reasonable distance (but this comes back to your application and design). And if you’re dealing with pointclouds, sampling becomes even more complicated.
If your model isn’t accurate, you’ll see it quickly and all sorts of pain and suffering will follow (unless you’re a math wiz, in which case it should be reasonably easy to follow the traonsformation matrix model). It then becomes an issue of making the model rotate and scale correctly, and then save those parameters somewhere, and apply them every time you add in this model.
Let us know what you’re trying to do.
Thank you very much for adding more details
Thank you very much.I’ll try this in my project