Select to view content in your preferred language

3D object from Mobile Scene Package disappear in Android

406
14
Jump to solution
11-08-2024 02:02 AM
Labels (2)
Marco_Foi
Emerging Contributor

I am building a MAUI app on .NET 8 using Esri.ArcGISRuntime.Maui 200.5.0

I created a Mobile Scene Package file in ArcGIS Pro and embedded it in the app as a Resource.

I created TWO version of the file: one WITH end one WITHOUT "Reference online content"

reference online content.png

If I use the one WITH BASEMAP get the expected result in Windows BUT NOT in Android (14):

WINDOWS: windows_with_basemap.png

ANDROID 14: android_with_basemap.png

Sometimes, at start, the 3D model appeard but is somehow "wiped out" by the basemap drawing event 

If I use the one WITHOUT I get the expected result both in Android (14) and Windows:

WINDOWS:windows_no_basemaps.png

ANDROID: android_no_basemaps.png

All this tells me there is no issue with my data.. ..and it looks like a Runtime BUG.

Is it?

(I am attaching the two MobileScenePackage .mspk files)

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

The maui dependency will automatically include the dependencies that gives you access to this. Here's a bit of code I was able to write in a blank maui app that adds just the Esri.ArcGISRuntime.Maui package:

 

dotMorten_esri_0-1734629379523.png

 

View solution in original post

0 Kudos
14 Replies
dotMorten_esri
Esri Notable Contributor

This is unfortunately an android quirk: The files you deploy with android aren't directly accessible with a file path, whereas on iOS and Windows you can just give it the relative path. On Android you'll need to copy the deployed data out into a local folder instead and use that path to open the data.

Also instead of using "Resource", use "Content" for the build action.

0 Kudos
Marco_Foi
Emerging Contributor

What you say is right but has nothing to do with the exposed issue.. ..or, at least, it does not took having relations.
You are right in the terms that the app has to copy the emebedded file from resources to App private storage before accesing it.. 

..but once there, the file is perfectly reachable using the file path.

The proof this is true is the fact that in the 4th picture the 3D model from the local .mspk file is displayed in Android:

android_no_basemaps.png

The file is accessed and displayed.. ..unless I ALSO enable the Base map!

0 Kudos
dotMorten_esri
Esri Notable Contributor

aaah gotcha. I misunderstood that bit. So adding online basemap makes it so it doesn't render?
I'll have someone investigate. Thank you for sharing the data.

I'd be curious what happens if you manually add the basemap programmatically after loading the mspk. 

0 Kudos
Marco_Foi
Emerging Contributor

You got the point!

Sometime, using the .mspk referencing online basemap, it happens that when the scene is rendering, for the first second, second-and-hal, the 3D object is shown.. ..then the "tide" of the basemap-rendering comes.. ..and the 3D object disappears all at once.

As for your other curiosity (adding Basemap by code) I also tried that way.

I created a Basemap object;
new Basemap(BasemapStyle.ArcGISTopographicBase)

and added to the Scene after 4 seconds of delay using an async Task and then repushing the change on MainThread.
The result is EXACTLY the same! 😞

UPDATE: the following sentences are wrong

I also tested with an ElevationSources injected by code after the Scene has rendered

scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));

The result is EXACTLY the same! 😞..the 3D model disappears.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Oh did you try without elevation? I wonder if it is just ending up underground. That would match the behavior of sometimes briefly seeing it before the elevation data loads.

0 Kudos
Marco_Foi
Emerging Contributor

ANDROID & Elevation Source & 3D-Model

I have to correct myself: ADDING an ElevationSurface to a Mobile Scene Pakage does NOT prevent a 3D model from being correctly displayed on Android devices.

This is also true if the ArcGISTiledElevationSource is added to Scene ElevationSources programmatically.

The model, if correctly placed in the Z-coordinate, is displayed in both Android and Windows:

android_with_elevationsource.png

Of course, it can also disappear underground if not correctly geolocated using ArcGIS Pro.

0 Kudos
KoushikHajra
Esri Contributor

Hello @Marco_Foi,

Thank you for reaching out to us and sorry for the problem you're having on Android. I think I might have an idea on what is going on here. Can you please try something really quickly and see if this solves the problem for you? 

SceneView has a method to override the default memory limit. If you can increase it to 2 or 4GB based on the type of device you have and try to render the mspk, does the model render then? I suspect this because that's the reason why when you have the basemap it uses more memory and thus prevents the layer from rendering.

Please let us know what you find. I hope this helps.

Regards,

Koushik

Marco_Foi
Emerging Contributor

I feel tweaking with memory available to SceneView is possible just in SDK for JS.

I cannot find any reference to this feature in SDK for .NET : can you please check?

Despite this, the issue might be related to a memoy issue indeed!

0 Kudos
KoushikHajra
Esri Contributor