microsoft / MapsSDK-Unity

This repository contains samples, documentation, and supporting scripts for Maps SDK, a Microsoft Garage project.
MIT License
648 stars 127 forks source link

Adding 3d buildings layer from external source #174

Closed shyamnair3 closed 2 years ago

shyamnair3 commented 2 years ago

Hi,

Is it possible to add a 3d buildings layer from an external source like ArcGIS(https://www.arcgis.com/home/item.html?id=a457834a6cb449cd958502d6e98ba305) for areas that don't have it.

Reag commented 2 years ago

I have a similar problem that I'm approaching. I have some external data for a section of a city that I want to load in to replace the 'Default' tile layer. The wiki doesn't appear to go over how to build custom data for this particular layer, only elevation and texture. If @kircher1 could give us an answer if this is possible, it would be extremely helpful!

kircher1 commented 2 years ago

There isn't a tile-based layer API in the SDK for 3D meshes. And for the ArcGIS data set in the original question, I don't know how to use that or ingest it into Unity.

Generally, if you have a geo-located 3D mesh (an OBJ/GLTF/FBX that has an associated LatLonAlt), then you can pin it to the map using a MapPin.

The issue you may run into is that the default layers will z-fight with your mesh. If that's the case, and nudging the mesh along the altitude axis isn't an option, then you could modify the map shader to discard pixels in the default layer which are covered by an existing model. #166 is related.

Reag commented 2 years ago

@kircher1 How does the project handle the 3D models by default, like in New York? It looks like the system already has a tile based method for loading 3D meshes, even if it isnt exposed in the API. I really want to avoid having to reinvent the wheel to do what this project already does by default.

kircher1 commented 2 years ago

Preparing and tiling large swaths of 3D city data is done offline. The client SDK here is downloading and decoding these tiles to render them. None of that is exposed by the SDK in any way that could be plugged into or extended though.

If you are also trying to stream a large set of geospatial 3D data to a client to render it, maybe take a look at Cesium's 3D tiles: https://cesium.com/why-cesium/3d-tiles/.. I think Esri has some similar format for describing large 3D datasets but I'm less familiar with it.

To be clear, the SDK doesn't have a way to decode these datasets. Maybe there's a Unity decoder for them, I'm not sure. Unity of course can handle decoding many other 3D formats though, so if you have a LatLonAlt associated with the origin of the 3D model you're trying to display, you could always place it on the map using a MapPin.