How to use Unity to visualize data from a Session

From Tygron Support wiki
Jump to navigation Jump to search
Data from a Tygron Session visualized in Unity.

Depending on use-cases or the intended audiences for the results of calculations in the Tygron Platform, it may be desirable to have external tooling or applications read data from a running Session for visualization. One environment which forms a powerful framework for a variety of use-cases is Unity. Using the Cesium plugin for Unity, it is possible to directly connect to a Session and obtain visualization data from it, so that it can be viewed as a complete 3D world in Unity.

How to set up Cesium components to read data from a Tygron Session:
  1. Ensure you have a 3D Unity Project with a Universal Rendering Pipeline (URP), or HDRP.
  2. Add the Unity registry to the Unity Project's package manager.[1]
  3. From the Unity registry, install Cesium for Unity.[1]
  4. Add a GameObject. Name it "Cesium Georeference".
  5. To the "Cesium Georeference", add a "Cesium Georeference" component.
  6. As child of the "Cesium Georeference", add a GameObject. Name it "Tygron 3D Tileset".
  7. To the "Tygron 3D Tileset" add a "Cesium 3D Tileset" component. For that component:
    Set the Tileset Source to "From Url".
    Set the URL to the 3D Tiles endpoint of the intended running Session.
  8. As child of the "Cesium Georeference", add a GameObject. Name it "Tygron WMS".
  9. To the "Tygron WMS" add a "Cesium 3D Tileset" component. For that component:
    Set the Tileset Source to "From Cesium Ion".
    Set the Ion Asset ID to "1".[2]
    Set the Ion Access Token to a valid Cesium Ion account token. (See references for a valid token to the Cesium example assets)[2]
  10. To the "Tygron WMS" add a "Cesium Web Map Service Raster Overlay" component. For that component:
    Set the Base URL to the WMS endpoint of the intended running Session.
    Set the Layer to "0".
  11. Double-click on "Tygron 3D Tileset" to move the camera to the 3D Tiles loaded from the Session.
  12. Select the "Cesium Georeference", and click on Place Origin Here.

Notes

  • Changing the "Layer" value in the Cesium Web Map Service Raster Overlay component to the ID of a different Overlay will display that Overlay.
  • After creating the Scene, additional GameObjects and functionality can be added to the Scene, such as an interactive camera.[3]

See also

References

  1. 1.0 1.1 Cesium for Unity quickstart ∙ Found at: https://cesium.com/learn/unity/unity-quickstart/ ∙ (last visited: 9-6-2023)
  2. 2.0 2.1 Cesium for Unity examples ∙ Found at: https://github.com/CesiumGS/cesium-unity-samples/blob/main/Assets/CesiumSettings/Resources/CesiumRuntimeSettings.asset ∙ (last visited: 9-6-2023)
  3. Controlling Unity Camera Behavior ∙ Found at: https://learn.unity.com/tutorial/controlling-unity-camera-behaviour ∙ (last visited: 9-6-2023)