View on GitHub Sample viewer app

See through terrain in a scene and move the camera underground.

Image of add elevation source from tile package

Use case

By default, a scene’s terrain is fully opaque, and the camera cannot go underground. To see underground features such as pipes in a utility network, you can lower the opacity of the terrain surface and set the navigation constraint on the surface to allow underground navigation.

How to use the sample

The sample loads a scene with underground features. Pan and zoom to explore the scene. Observe how the opacity of the base surface is reduced and the navigation constraint is removed, allowing you to pan and zoom through the base surface.

How it works

  1. Display a ArcGISScene in a SceneView, which contains layers with underground features.
  2. To see underground, get the scene’s base surface and set its opacity to a value between 0 and 1.
  3. To allow the camera to go underground, set the surface’s navigation constraint to NavigationConstraint.None.

Relevant API

  • NavigationConstraint
  • Surface

About the data

This sample shows an Underground Wellbores and Seismic Events (Point Scene Layer) Webscene hosted on ArcGIS Online. The data displays a point scene layer showing underground wellbore paths (green polylines) and seismic events (orange points).

Tags

3D, subsurface, underground, utilities

Sample Code

MainActivity.kt MainActivity.kt SetSurfaceNavigationConstraintViewModel.kt SetSurfaceNavigationConstraintScreen.kt
/* Copyright 2025 Esri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.esri.arcgismaps.sample.setsurfacenavigationconstraint
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import com.arcgismaps.ApiKey
import com.arcgismaps.ArcGISEnvironment
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme
import com.esri.arcgismaps.sample.setsurfacenavigationconstraint.screens.SetSurfaceNavigationConstraintScreen
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// authentication with an API key or named user is
// required to access basemaps and other location services
ArcGISEnvironment.apiKey = ApiKey.create(BuildConfig.ACCESS_TOKEN)
setContent {
SampleAppTheme {
SetSurfaceNavigationConstraintApp()
}
}
}
@Composable
private fun SetSurfaceNavigationConstraintApp() {
Surface(color = MaterialTheme.colorScheme.background) {
SetSurfaceNavigationConstraintScreen(
sampleName = getString(R.string.set_surface_navigation_constraint_app_name)
)
}
}
}