Select to view content in your preferred language

Rendering of ArcGIS3DObjectSceneLayer on Quest 2

623
1
12-08-2022 03:47 PM
LDD_NW
by
Occasional Contributor

Hello,

I am looking for some assistance in displaying ArcGIS3DObjectSceneLayer remotely on a quest 2. I have been able to successfully import a custom 3D Object Scene Layer. However, when I export a .apk and load using SideQuest, the textures of the layers have glitchy clipping near their edges of where different census tracts meet  (Please see the attached video and forgive the poor quality as I don't know how to screen record on a quest 2 so I just used my phone camera. )

Also noted is that when I run the scene in Unity using oculus link or in scene view on my computer, this glitching/ clipping does not occur.

I also just tested how the layer looks when using the ArcGIS Maps SDK UI Map creator and can report that the clipping between layers also does not occur. So the problem may be isolated to how I have created the map using the API. I need to use the API method as I want to be able to activate and de active layers using buttons in unity. I have attached my map creator script at the bottom of this post.

 

My process for getting the layer visible on quest 2 is:

Following the official ESRI instructions as well as other help on this community, I imported  a ArcGIS3DObjectSceneLayer into unity by using the following:

  1. Convert 2D Field Data into 3D data using the extrusion tool in ArcGIS Pro. 
  2. In ArcGIS Pro, use the Geoprocessing tool "Layer 2D to Feature class" to convert to multipatch.
  3. Used the Geoprocessing tool "Create 3D Object Scene Layer Content" to convert the multipatch to 3D object Scene Layer. This could then be hosted on the living atlas and imported as a layer into Unity.
  4. I created a map using the C# API.

Other Factors to note are:

  • I am Using the Universal Render Pipeline
using Esri.ArcGISMapsSDK.Components;
using Esri.ArcGISMapsSDK.Samples.Components;
using Esri.ArcGISMapsSDK.Utils.GeoCoord;
using Esri.GameEngine.Extent;
using Esri.GameEngine.Geometry;
using Esri.Unity;
using System.Collections;
using System.Collections.Generic;



#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;

using System;


[ExecuteAlways]

public class ArcGISMapCreator : MonoBehaviour


{
    public string APIKey = "AAPK8ef0cfdbda4446cc848a4efe3630e6410dWxnhJ14KM-C7ok0_H1dinWAg7UdTkwp8k2zehwjBYsp5iWfSRg2DN5RVTTL3nW";

    public Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer layer_1;
    public Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer layer_2;
    public Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer layer_3;
    public Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer layer_4;

    public  bool layer_1_visibility = false;
    public  bool layer_2_visibility = false;
    public  bool layer_3_visibility = false;
    public  bool layer_4_visibility = false;





    public Esri.GameEngine.Map.ArcGISMap arcGISMap;

    public ArcGISMapComponent arcGISMapComponent;
	public ArcGISPoint geographicCoordinates = new ArcGISPoint(-118.282390197517, 33.9298048523834, 500, ArcGISSpatialReference.WGS84());

    
    private void Start()
    {
    CreateArcGISMapComponent();
    CreateArcGISCamera();
    CreateArcGISMap();


    Debug.Log("void start is workign");

    }


    private void CreateArcGISMapComponent()
	{
		arcGISMapComponent = FindObjectOfType<ArcGISMapComponent>();

		if (!arcGISMapComponent)
		{
			var arcGISMapGameObject = new GameObject("ArcGISMap");
			arcGISMapComponent = arcGISMapGameObject.AddComponent<ArcGISMapComponent>();
		}

		arcGISMapComponent.OriginPosition = geographicCoordinates;
		arcGISMapComponent.MapType = Esri.GameEngine.Map.ArcGISMapType.Local;
		arcGISMapComponent.MapTypeChanged += new ArcGISMapComponent.MapTypeChangedEventHandler(CreateArcGISMap);
	}



	public void CreateArcGISMap()
	{
		arcGISMap = new Esri.GameEngine.Map.ArcGISMap(arcGISMapComponent.MapType);
        arcGISMap.Basemap = Esri.GameEngine.Map.ArcGISBasemap.CreateImagery(APIKey);
	
        arcGISMap.Elevation = new Esri.GameEngine.Map.ArcGISMapElevation(new Esri.GameEngine.Elevation.ArcGISImageElevationSource("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer", "Elevation", ""));
    

        layer_1 = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer("https://tiles.arcgis.com/tiles/hMKr5amzqrWbbTo8/arcgis/rest/services/IncomePerCap_low_elevation/SceneServer", "Income Per Capita low extrusion", 1.0f, true, "");
        // arcGISMap.Layers.Add(layer_1);
    
        layer_2 = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer("https://tiles.arcgis.com/tiles/hMKr5amzqrWbbTo8/arcgis/rest/services/MostCommonRaceOrEthnicity/SceneServer", "Most Common Race or Ethnicity", 1.0f, true, "");
		// arcGISMap.Layers.Add(layer_2);

        layer_3 = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer("https://tiles.arcgis.com/tiles/hMKr5amzqrWbbTo8/arcgis/rest/services/LA_oilwell_locations/SceneServer", "3D Oil Well Locations", 1.0f, true, "");
		// arcGISMap.Layers.Add(layer_3);

        layer_4 = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer("https://tiles.arcgis.com/tiles/hMKr5amzqrWbbTo8/arcgis/rest/services/CurrentAsthma/SceneServer", "Current Asthma Percentage", 1.0f, true, "");
        
		// arcGISMap.Layers.Add(layer_4);
        
        
       


        var extentCenter = new Esri.GameEngine.Geometry.ArcGISPoint(-118.282390197517, 33.9298048523834, 20, ArcGISSpatialReference.WGS84());
        var extent = new ArcGISExtentCircle(extentCenter, 40000);

        arcGISMap.ClippingArea = extent;

        arcGISMapComponent.View.Map = arcGISMap;

        Debug.Log("Create GIS map running");




    
    }

    private ArcGISCameraComponent cameraComponent;

    private void CreateArcGISCamera()
	{
		cameraComponent = Camera.main.gameObject.GetComponent<ArcGISCameraComponent>();

		if (!cameraComponent)
		{
			var cameraGameObject = Camera.main.gameObject;

			cameraGameObject.transform.SetParent(arcGISMapComponent.transform, false);
			cameraComponent = cameraGameObject.AddComponent<ArcGISCameraComponent>();
			cameraGameObject.AddComponent<ArcGISCameraControllerComponent>();
			cameraGameObject.AddComponent<ArcGISRebaseComponent>();
		}

		var cameraLocationComponent = cameraComponent.GetComponent<ArcGISLocationComponent>();

		if (!cameraLocationComponent)
		{
			cameraLocationComponent = cameraComponent.gameObject.AddComponent<ArcGISLocationComponent>();
			// cameraLocationComponent.Position = geographicCoordinates;
			cameraLocationComponent.Position = geographicCoordinates =new ArcGISPoint(-118.282390197517, 33.9298048523834, 0, ArcGISSpatialReference.WGS84());

            new ArcGISPoint(-118.282390197517, 33.9298048523834, 500, ArcGISSpatialReference.WGS84());
			cameraLocationComponent.Rotation = new ArcGISRotation(0, 43.75782, 0);
		}
	}
    
    public void ToggleIncome()
    {
       
        if (layer_1_visibility == true)
        {
            Debug.Log("Remove Layer 1");
            arcGISMap.Layers.Remove(arcGISMap.Layers.IndexOf(layer_1));
            
            layer_1_visibility = false;

            Debug.Log("layer_1_visibility" + layer_1_visibility);

            return;
        }

        if (layer_1_visibility == false)
        {
            Debug.Log("add Layer 1");
            arcGISMap.Layers.Add(layer_1);
            
            layer_1_visibility = true;

            Debug.Log("layer_1_visibility" + layer_1_visibility);
            
            return;
        }

        
        
    }

    public void MostCommonRace()
    {
       
        if (layer_2_visibility == true)
        {
            Debug.Log("Remove Layer 2");
            arcGISMap.Layers.Remove(arcGISMap.Layers.IndexOf(layer_2));
            
            layer_2_visibility = false;

            return;
        }

        if (layer_2_visibility == false)
        {
            Debug.Log("add Layer 2");
            arcGISMap.Layers.Add(layer_2);
            
            layer_2_visibility = true;


            
            return;
        }

        
        
    }  


    public void WellLocation()
    {
       
        if (layer_3_visibility == true)
        {
            Debug.Log("Remove Layer 3");
            arcGISMap.Layers.Remove(arcGISMap.Layers.IndexOf(layer_3));
            
            layer_3_visibility = false;

            return;
        }

        if (layer_3_visibility == false)
        {
            Debug.Log("add Layer 3");
            arcGISMap.Layers.Add(layer_3);
            
            layer_3_visibility = true;

            
            return;
        }

        
        
    } 


    public void Asthma()
    {
       
        if (layer_4_visibility == true)
        {
            Debug.Log("Remove Layer 4");
            arcGISMap.Layers.Remove(arcGISMap.Layers.IndexOf(layer_4));
            
            layer_4_visibility = false;

            return;
        }

        if (layer_4_visibility == false)
        {
            Debug.Log("add Layer 4");
            arcGISMap.Layers.Add(layer_4);
            
            layer_4_visibility = true;

            
            return;
        }

        
        
    } 


}

 

0 Kudos
1 Reply
WH1981
by
Regular Contributor

And have you found a solution for the glitching? First i used not a URP pipeline but a 3D project. The details was little less but not glitching. Now i also must use a URP project because of the clipping of image layers. Now i also have glitching on my quest 2.

Vector layers didn't have that problem, only the textured (png) parts in my case. Like the leaves of a tree.

0 Kudos