Tabletop version

Hi! First off, Im in love with cesium and what it has to offer, a real arcgis killer in my opinion and I’m close to using it for a commercial project.

However right now cesium does not really have much to show for the XR/VR users in terms of ‘tabletop’, a cutout visible map which is pan- and moveable. I know we can limit the visible area with the Cesium Cartographic Polygon Component (which works great) however getting those functionalities in is not straight forward (or I’m too stupid).

Let’s tackle zooming perhaps, what I’ve tried is making a limit area visible with the Cesium Cartographic Polygon, have a Polygon Raster and inverse that so only that specific area is visible, great.

Now to the zooming, usually those tabletop views work while keeping the viewable physical area the same size, so the polygon shape should not increase/decrease but the actual content inside should zoom in/out.

I tried achieving this effect by scaling the actual 3DTileSet (world) and refreshing that tileset. This ‘kinda’ works but the actual size of the visible area sadly changes slighlty, it’s not ideal.

I also tried messing with the entire Cesium Georeference global scale by changing it and at the same time adjusting the Cesium Cartographic Polygon scale, sadly I could not find a good conversion to make that work.

Any clues/hint? I couldnt find any working examples online, only failed attempts.

I highly suggest creating a new example which includes this type of scene as it’s a huge market!

Thanks a lot! Appreciate any help and looking forward.

After searching some more I came to this PR which looks like what I need!

Hi @JanikCodes, welcome to the community!

Yes, the comments in that PR are a pretty good example for how you can do this sort of thing in Cesium for Unity. Let us know how you go!

We happen to have a level in the Cesium for Unreal Samples project that demonstrates how to do a tabletop-like visualization, but we haven’t added one to the Cesium for Unity Samples project yet. If you get something working that you’re happy with and can share with the community, we would definitely welcome a pull request to add it to the Samples!

Yeah I stumbled across problems others also came across. I’ll try my best to get a sample up n running but I have to figure it out myself first.

My goals for the example will be:

  • tabletop visualisation (Only a specific area is visible)
  • zoom in/out while maintaining roughly the same y axis
  • panning
  • able to move the tabletop visualisation freely in space including rotation

just a quick update. I’ve managed to pretty much implement everything I’ve mentioned. All that is left to do is tidy it up :+1:

I was wondering one thing for visual improvements: Is it possible to somewhat make the terrain have “thickness” which ‘fills’ empty spaces? This would mean the entire ‘tabletop’ view has some thickness to it downwards, being flat at the bottom. Not sure if I explained that correctly what I’m trying to achieve, or atleast wonder.

1 Like

Hey Janik, Id be interested to see your approach to this if you dont mind sharing.

When it comes to the “thickness” as you call it I have not been able to find a suitable solution. Havent had much time to investigate though. Playing around with shaders is probably a way to do this.

1 Like

ill share project files in the next weeks (or make a git PR most likely) but it’s very straight forward.

  • For map pan I simply change the georeference lat/lon.

  • For zooming I’m relying on “CesiumTileExcluder”, most things can be taken from here github.com/CesiumGS/cesium-unity/pull/248

    • Zooming works by changing the georeference scale. I’m also setting the georeference height to the highest altitude found in the tiles.
  • To achieve a nice looking tabletop view with clean edges I’m modifying the default “CesiumDefaultTilesetMaterial" by passing in a bounds vector and a center position vector. This way my entire ‘tabletop’ visualisation can be moved freely in world space while remaining the same geographic picture.

    • One issue I have at the moment is that evertime the tabletop visualisation is moved, the map reloads due to the material property changing which reloads the tiles. This can be fixed by applying the custom material directory via code to the children meshrenderer, just didn’t got around to it yet.

Result looks like this at the moment.

Thanks for sharing. Not sure how you use the CesiumTileExcluder for scaling. Cant you just use the Scale property of a Cesium Georeference component?

As for panning and clipping I chose the same appraoch as you.

What happens when you pan the terrain and a new highest point in the tileset appears? My solution is rather choppy because I apply the sampled height in update and I only sample the center point of the table. So if there is a building suddenly sampled due to panning the height changes abruptly. Would probably be smoother if one would sample multiple points and sets the avarage height

Hi everyone in this thread. I have a question that you might be able to help with. I’m updating my georeference origin (long lat) every second to give the feeling like my tabletop map is scrolling. However, my Cartographic polygon is moving along with it…

I would like my Cartographic polygon to remain static above the origin, while the map moves underneath. The visual I’m looking for is like a vehicle GPS interface. Any help figuring out why my polygon is not staying in the same place would be helpful!

This is one of the few Unity threads I could find here!!!

Some more info:

I am using the following functions to update both my 3D tile georeference. I also have a separate georeference for my cartographic polygon:

georeferenceForTiles.SetOriginLongitudeLatitudeHeight(
gpsLong[currentIndex],
gpsLat[currentIndex],
height);
cesium.MoveOrigin();

georeferenceForPolygon.SetOriginLongitudeLatitudeHeight(
gpsLong[currentIndex],
gpsLat[currentIndex],
height);
polygon.MoveOrigin();

this script is called every second or so, and each new set of coords are very close to the previous ones…

Hi I think we might be able to help you. If you follow this thread a bit from the top you can see I used Cartographic Polygon at first as well but this didnt turn into the desired effect we wanted (and you as well). So we are using something else.

Check out this thread where it explains what you have to do in order to achieve your goal:

github.com/CesiumGS/cesium-unity/pull/248

With that you are able to smoothly scroll your terrain while the actual cutout stays at the same position.

1 Like

Regarding your height issue, I’m simply ignoring everything else besides the raw terrain for height checking. This way any buildings or other coliders dont interfer with my height check.

Thank you, Janik, I’ll check it out :slight_smile: .

1 Like

Hi @JanikCodes

Can you please share how exactly do you ignore everything else besides the terrain for height checking?

Is there a method for this or are you using Raycast? I figured out everything else except for the y offset issue when scaling and now I believe the key to solve this is figuring out the terrain ground level height.

Any help will be great.

Thank you.

No raycast.

I’m using SampleHeightMostDetailed() on a 3D Tileset. Because my buildings are on a seperate 3D Tileset component and my main terrain is also a 3D Tileset component, I can distinguish between those and only hit for example my terrain by calling the methode on that specific tileset.