Select to view content in your preferred language

Crash on iOS trying to run .slpk 3D building layer

709
14
05-21-2024 02:17 PM
StarrLong
New Contributor

We have built a large scale Active Digital Twin of the Port of Corpus Christi that includes base layers and a 3D building layer using .slpk files. 

We are using the Unity Maps Plugin.

When we run a 3D building layer / .slpk  above 50mb the application crashes instantly on an iOS device (10th generation iPad Pro). 

For reference on windows we can run a 500mb + file with no instability of any kind.

I have attached a screenshot of the windows version and the crash logs from TestFlight. 

 

0 Kudos
14 Replies
AShahbaz
Esri Contributor

Hi there, a few clarifying questionns:
Does the crash happen with any building scene layer slpk or only this particular one (or only ones that are above 50mb)?

Does this happen if you stream the building scene layer instead of a local slpk?

Are you using the streaming assets folder for copying the slpk to the device? And can you verify that the app finds the file?

 

I tried to search for the reason of exception information further up in the log (SIGNAL 5 Trace/BPT trap) and it seems like it can be a number of issues (out of index array, accessing null or invalid references, ...).

0 Kudos
StarrLong
New Contributor

Thank you so much for replying!

We see the error when we try to use any large-ish slpk (60+mb) that works fine on desktop.

Our .slpk is stored locally (in StreamingAssets) but it doesn't seem to matter if it is streamed.

We do not copy the file to local storage. It stays in StreamingAssets (Except on Android, but that isn’t currently one of our target platforms.)

Yes it finds the file.

0 Kudos
AShahbaz
Esri Contributor

Thanks for the additional information.
We tested a couple different building scene layers (BSL) on an ipad and did not experience any crashes. We tested both streaming and local data, with the largest slpk being almost 1.5GB.
One thing to keep in mind is that in the process of loading a local file, the slpk is unpacked in the momery, occupying more momory than the file itself. However, this should not have any effect while streaming the data, and with a file size of 60mb, I don't really expect the effect to be significant enough. But you might want to look into how full the memory is without the BSL. For reference, the device we tested on has 8GB of memory.
 
I would try loading the BSL in an empty project on the ipad to rule out other parts of the project as the cause of the crash. You may also want to test with a completely different BSL.

Are you adding the layer at runtime or in the editor? This is an example of creating and adding a local BSL layer.

var buildingLayer = new Esri.GameEngine.Layers.ArcGISBuildingSceneLayer(
    Application.streamingAssetPath + $"/{BSL_File_Name}", "Layer Name", 1.0f, true, "");

arcGISMapComponent.View.Map.Layers.Add(buildingLayer);
0 Kudos
StarrLong
New Contributor

My apologies. I do not think I was clear enough in my description before. We are not using a BSL. Ours is a "3d Object Scene Layer" that we are adding at runtime. You can see this video of it running on windows here: https://www.dropbox.com/scl/fi/57vajbzy5nctqf5of02wk/OPTICS-2024-05-21-15-24-44.mp4?rlkey=bdx0umeofs...

0 Kudos
AShahbaz
Esri Contributor

We could not reproduce the crash with a 3D object scene layer either. File size ~360mb, placed in StreamingAssets and loaded with the following code:

using Esri.ArcGISMapsSDK.Components;
using Esri.GameEngine.Layers;
using Esri.GameEngine.Layers.BuildingScene;
using Esri.Unity;
using System.Collections.Generic;
using UnityEngine;
public class LoadData : MonoBehaviour
{
    [SerializeField] private ArcGISMapComponent arcGISMapComponent;
    private ArcGIS3DObjectSceneLayer sceneLayer;
    private const string fileName = "sandiego.slpk";
    private void Awake()
    {
        arcGISMapComponent = GetComponent<ArcGISMapComponent>();
    }
    private void Start()
    {
        // Make layers:
        sceneLayer = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer(
            Application.streamingAssetsPath + $"/{fileName}", "San Diego", 1.0f, true, "");
        // Add layers:
        arcGISMapComponent.View.Map.Layers.Add(sceneLayer);
    }

 

0 Kudos
StarrLong
New Contributor

Would it be possible to get a version of your sample 3D building layer so we could better understand possible differences between the assets? 

0 Kudos
StarrLong
New Contributor

Here is a dropbox link to a section of our 3d building layer that reliably causes the crash (note this is not even the complete file just a section along the main channel): https://www.dropbox.com/scl/fi/9lhwva4qpta21womth7ye/CorpusChristi_BUILDINGS_channel_area.slpk?rlkey...

We were also able to get the crash to happen with files we generated from blender (a completely different pipeline). I can send that file as well

0 Kudos
AShahbaz
Esri Contributor

We did a test run with your data. Although we didn't get a full-on crash, we did notice missing meshes that are likely related to running out of memory.
It seems like your data has no or very limited level of detail information, which means that even far-away meshes are loaded with great detail. I was able to notice minor changes to the appearance of the ship (close to the aquarium) as the camera moved away, but the geometry remained at a pretty high resolution. I couldn't really notice any changes to the surrounding buildings until they disappeared once the camera was too far. I suspect this is the reason for running out of memory on a mobile device.

You could test this by adding a small extent to the ArcGISMap (map needs to be local) and checking if it still crashes.

If this is in fact the issue, your layer needs to be updated with finer levels of detail and/or less content.

0 Kudos
StarrLong
New Contributor

This is definitely helping us get closer to a solution I think!

Can you please share a few data points to assist?

1. How are you able to diagnose that there were missing meshes in the file? Is there a tool in ArcGIS Pro for that? Did you read that in an error message somewhere? If so can you point us to some documentation?

2. You mention updating our .slpk with LODs. Can you point us to some documentation on how to do that? My cursory search could only find a mention of it as a feature but not how to use it. 

3. While I understand how not having LODs or missing meshes might cause us to run out of memory at runtime I am confused because it feels a little counterintuitive because at initial load won't it actually increase the memory size due to the need to have the multiple assets to support the LODs? For us the crash happens as soon as we load the building layer.

4. You mention above that you were able to run an .slpk that is actually larger than the one that crashes for us. Your San Diego one is 360 mb while the one we sent you is only 204 mb. Am I to understand that if LODs are present the initial load in will be smaller and it will then dynamically stream in the rest of the file therefore preventing running out of memory?

0 Kudos