Hi,
Is it possible to visualise buildings from Cesium ion on a Unity mesh.
I have no Cesium Terrain but a unity mesh with lat/lon and height. We use our own tiles from wmts-services.
Hi,
Is it possible to visualise buildings from Cesium ion on a Unity mesh.
I have no Cesium Terrain but a unity mesh with lat/lon and height. We use our own tiles from wmts-services.
Hi @Ruediger_Brand,
If you’re trying to visualize something like Cesium OSM Buildings – which only contains buildings, no terrain – then you can stream that from Cesium ion while using your own terrain underneath. But if you’re trying to stream Google Photorealistic 3D Tiles – which is baked into an underlying terrain layer – then I’m afraid there’s no straightforward way to separate the buildings from the terrain.
Let me know if I’ve misunderstood your question.
Hi @janine,
You are Right - I would Like to draw the buildings as Quaders or Polygons on a mesh.
Rüdiger
Hi @janine could you go in more detail - in which way do get the buiding from Cesium ion ?
Rüdiger
Hi @Ruediger_Brand,
It’s not completely clear to me what you’re trying to do. Adding Cesium OSM Buildings to your scene is easy, though. Just sign into Cesium ion using the Cesium panel, and then click the + next to “Cesium OSM Buildings”. That will display just the (untextured) buildings with no underlying terrain.
If that’s not what you’re after, can you please describe it in more detail?
Hi Kevin,
thanks for the tip - I will try.
One question to this - I think to use the whole package for one functionality - is this not an overhead ?
Also if I have a mesh with lat/lon - what coordinates do the buildings have, do I have control to this ?
to clear:
Regards
Rüdiger
Hi Kevin,
I have seen the following:
The **Place Origin Here button** affects more than the orientation. You may have noticed that the **Latitude, Longitude,** and **Height** fields of the georeference have also changed. That is because the button tells the georeference to recenter the Unity origin at those coordinates. In other words, the point **(0, 0, 0)** in Unity will correspond to the real-world position defined by the georeference. It also aligns the Unity axes so that **+X** points from that position to the East, **+Y** points up, and **+Z** points to the North.
The ability to position the Unity world origin at some real-world location globe is very useful. Many things in Unity, from cameras to transforms to physics, prefer a coordinate system with relatively small values. By “georeferencing” the Unity scene in this way, we allow normal Unity objects to be placed in and around Melbourne and act just as they would in any other game.
Do you mean this ?
In my case: I have a dynamic scene and would like to load at runtime, so I cannot put the data in the scene at the beginning. Because I cannot change all concepts of my app: I would like to move the dataset to a unity-position, but not at all (0,0,0), is this possible ?
Hi Kevin,
I have seen the following:
The **Place Origin Here button** affects more than the orientation. You may have noticed that the **Latitude, Longitude,** and **Height** fields of the georeference have also changed. That is because the button tells the georeference to recenter the Unity origin at those coordinates. In other words, the point **(0, 0, 0)** in Unity will correspond to the real-world position defined by the georeference. It also aligns the Unity axes so that **+X** points from that position to the East, **+Y** points up, and **+Z** points to the North.
The ability to position the Unity world origin at some real-world location globe is very useful. Many things in Unity, from cameras to transforms to physics, prefer a coordinate system with relatively small values. By “georeferencing” the Unity scene in this way, we allow normal Unity objects to be placed in and around Melbourne and act just as they would in any other game.
Do you mean this ?
In my case: I have a dynamic scene and would like to load at runtime, so I cannot put the data in the scene at the beginning. Because I cannot change all concepts of my app: I would like to move the dataset to a unity-position, but not at all (0,0,0), is this possible ?
I thought I can use something similar to that code:
using UnityEngine;
using CesiumForUnity;
public class CesiumTilesetManager : MonoBehaviour
{
[Header("Cesium Ion Asset Settings")]
public Cesium3DTileset tileset; // Assign in Inspector or create at runtime
public long ionAssetID = xxx; // Replace with your Cesium ion asset ID
public string ionAccessToken = xxx; // Replace with your token
[Header("Placement Settings")]
public double longitude = 50.0; // Example
public double latitude = 8.0;
public double height = 0.0; // meters above ellipsoid
public Vector3 localOffset = new Vector3(0, 0, 0); // Unity local offset in meters
public Vector3 localRotation = new Vector3(0, 0, 0); // Unity rotation in degrees
private CesiumGeoreference georeference;
void Start()
{
var cesiumIon = GameObject.FindGameObjectWithTag("CesiumIon");
// Ensure we have a CesiumGeoreference in the scene
georeference = FindObjectOfType<CesiumGeoreference>();
if (georeference == null)
{
GameObject geoObj = new GameObject("CesiumGeoreference");
georeference = geoObj.AddComponent<CesiumGeoreference>();
georeference.transform.SetParent(cesiumIon.transform, false);
}
// If no tileset assigned, create one
if (tileset == null)
{
GameObject tilesetObj = new GameObject("My3DTileset");
tileset = tilesetObj.AddComponent<Cesium3DTileset>();
tileset.transform.SetParent(cesiumIon.transform, false);
}
// Configure Cesium ion connection
tileset.ionAssetID = ionAssetID;
tileset.ionAccessToken = ionAccessToken;
// Set the tileset's georeference origin
georeference.SetOriginLongitudeLatitudeHeight(longitude, latitude, height);
// Apply local offset and rotation
tileset.transform.localPosition = localOffset;
tileset.transform.localRotation = Quaternion.Euler(localRotation);
// Optionally adjust scale
tileset.transform.localScale = Vector3.one;
Debug.Log("Cesium 3D Tileset placed at: " + longitude + ", " + latitude + ", " + height);
}
// Example: Move tileset at runtime
public void MoveTileset(double newLon, double newLat, double newHeight)
{
georeference.SetOriginLongitudeLatitudeHeight(newLon, newLat, newHeight);
}
}
But nothing is displayed ! Is one step missing ?
Hi Kevin,
coul dsoleve the problem.
I have to put the 3dTiles Gameobject as child to the GeoReference.
Now my problem is to handle the position/Rotation of the 3d-tiles in relation to my own objects/mesh.
Regards
Rüdiger