Render features in a scene statically or dynamically by setting the feature layer rendering mode.

Use case
In dynamic rendering mode, features and graphics are stored on the GPU. As a result, dynamic rendering mode is good for moving objects and for maintaining graphical fidelity during extent changes, since individual graphic changes can be efficiently applied directly to the GPU state. This gives the map or scene a seamless look and feel when interacting with it. The number of features and graphics has a direct impact on GPU resources, so large numbers of features or graphics can affect the responsiveness of maps or scenes to user interaction. Ultimately, the number and complexity of features and graphics that can be rendered in dynamic rendering mode is dependent on the power and memory of the device’s GPU.
In static rendering mode, features and graphics are rendered only when needed (for example, after an extent change) and offloads a significant portion of the graphical processing onto the CPU. As a result, less work is required by the GPU to draw the graphics, and the GPU can spend its resources on keeping the UI interactive. Use this mode for stationary graphics, complex geometries, and very large numbers of features or graphics. The number of features and graphics has little impact on frame render time, meaning it scales well, and pushes a constant GPU payload. However, rendering updates is CPU and system memory intensive, which can have an impact on device battery life.
How to use the sample
Use the ‘Zoom In’/‘Zoom Out’ button to trigger the zoom animation on both static and dynamic scenes.
How it works
- Create a scene with operational layers and set the
FeatureRenderingModefor each layer. - The
FeatureRenderingModecan be set toStatic,Dynamic, orAutomatic.
- In Static rendering mode, the number of features and graphics has little impact on frame render time, meaning it scales well, however points don’t stay screen-aligned and point/polyline/polygon objects are only redrawn once scene view navigation is complete.
- In Dynamic rendering mode, large numbers of features or graphics can affect the responsiveness of scenes to user interaction, however points remain screen-aligned and point/polyline/polygon objects are continually redrawn while the scene view is navigating.
- When left to automatic rendering, points are drawn dynamically and polylines and polygons statically.
Relevant API
- FeatureLayer
- FeatureLayer.RenderingMode
- Scene
- SceneView
Tags
3D, dynamic, feature layer, features, rendering, static
Sample Code
/* Copyright 2026 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.setfeaturelayerrenderingmodeonscene
import android.os.Bundleimport androidx.activity.ComponentActivityimport androidx.activity.compose.setContentimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Surfaceimport androidx.compose.runtime.Composableimport com.arcgismaps.ApiKeyimport com.arcgismaps.ArcGISEnvironmentimport com.esri.arcgismaps.sample.sampleslib.theme.SampleAppThemeimport com.esri.arcgismaps.sample.setfeaturelayerrenderingmodeonscene.screens.SetFeatureLayerRenderingModeOnSceneScreen
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 { SetFeatureLayerRenderingModeOnSceneApp() } } }
@Composable private fun SetFeatureLayerRenderingModeOnSceneApp() { Surface(color = MaterialTheme.colorScheme.background) { SetFeatureLayerRenderingModeOnSceneScreen( sampleName = getString(R.string.set_feature_layer_rendering_mode_on_scene_app_name) ) } }}/* 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.setfeaturelayerrenderingmodeonscene.components
import android.app.Applicationimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.setValueimport androidx.lifecycle.AndroidViewModelimport androidx.lifecycle.viewModelScopeimport com.arcgismaps.data.ServiceFeatureTableimport com.arcgismaps.geometry.Pointimport com.arcgismaps.geometry.SpatialReferenceimport com.arcgismaps.mapping.ArcGISSceneimport com.arcgismaps.mapping.Viewpointimport com.arcgismaps.mapping.layers.FeatureLayerimport com.arcgismaps.mapping.layers.FeatureRenderingModeimport com.arcgismaps.mapping.view.Cameraimport com.arcgismaps.toolkit.geoviewcompose.SceneViewProxyimport com.esri.arcgismaps.sample.sampleslib.components.MessageDialogViewModelimport kotlinx.coroutines.launchimport kotlin.time.Duration.Companion.seconds
/** * ViewModel for the SetFeatureLayerRenderingModeOnScene sample. * * Builds two scenes: one where feature layers are rendered statically and * another where they are rendered dynamically. Exposes Scene objects and * SceneViewProxy instances so the Compose UI can render SceneViews and * interact with them. */class SetFeatureLayerRenderingModeOnSceneViewModel(application: Application) : AndroidViewModel(application) {
// URLs for the sample feature service tables (point, polyline, polygon) private val pointLayerUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/0" private val polylineLayerUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/8" private val polygonLayerUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9"
// Scenes exposed to the UI var staticScene: ArcGISScene = ArcGISScene().apply { initialViewpoint = Viewpoint( center = Point(-118.37, 34.46, SpatialReference.wgs84()), scale = 30000.0 ) }
var dynamicScene: ArcGISScene = ArcGISScene().apply { initialViewpoint = Viewpoint( center = Point(-118.37, 34.46, SpatialReference.wgs84()), scale = 30000.0 ) }
// SceneViewProxy instances used to control each SceneView from the ViewModel val staticSceneViewProxy = SceneViewProxy() val dynamicSceneViewProxy = SceneViewProxy()
var isZoomedIn by mutableStateOf(true) private set
// Message dialog helper to present errors to the user val messageDialogVM = MessageDialogViewModel()
init { // Build the scenes and load them. viewModelScope.launch { try { buildScenes() // Load both scenes; report any failures to the message dialog VM staticScene.load().onFailure { messageDialogVM.showMessageDialog(it) } dynamicScene.load().onFailure { messageDialogVM.showMessageDialog(it) } } catch (ex: Exception) { messageDialogVM.showMessageDialog(ex) } } }
/** * Constructs two scenes. Each scene gets the same set of feature tables but the * rendering mode for the layers is set differently: static vs dynamic. */ private fun buildScenes() { // Create feature layers from the tables val staticPointLayer = FeatureLayer.createWithFeatureTable(ServiceFeatureTable(uri = pointLayerUrl)).apply { renderingMode = FeatureRenderingMode.Static } val staticPolylineLayer = FeatureLayer.createWithFeatureTable(ServiceFeatureTable(uri = polylineLayerUrl)).apply { renderingMode = FeatureRenderingMode.Static } val staticPolygonLayer = FeatureLayer.createWithFeatureTable(ServiceFeatureTable(uri = polygonLayerUrl)).apply { renderingMode = FeatureRenderingMode.Static }
val dynamicPointLayer = FeatureLayer.createWithFeatureTable(ServiceFeatureTable(uri = pointLayerUrl)).apply { // Set rendering mode to Dynamic for the dynamic scene layers renderingMode = FeatureRenderingMode.Dynamic } val dynamicPolylineLayer = FeatureLayer.createWithFeatureTable(ServiceFeatureTable(uri = polylineLayerUrl)).apply { renderingMode = FeatureRenderingMode.Dynamic } val dynamicPolygonLayer = FeatureLayer.createWithFeatureTable(ServiceFeatureTable(uri = polygonLayerUrl)).apply { renderingMode = FeatureRenderingMode.Dynamic }
// Create scenes and add layers staticScene.operationalLayers.addAll(listOf(staticPolygonLayer, staticPolylineLayer, staticPointLayer))
dynamicScene.operationalLayers.addAll(listOf(dynamicPolygonLayer, dynamicPolylineLayer, dynamicPointLayer)) }
/** * Toggle between zoomed-in and zoomed-out cameras for both scenes. */ fun toggleZoom() {
val zoomedIn = isZoomedIn val staticPoint: Point val dynamicPoint: Point val distance: Double val heading: Double val pitch: Double
if (!zoomedIn) { // Zoom in staticPoint = Point(-118.45, 34.395, SpatialReference.wgs84()) dynamicPoint = Point(-118.45, 34.395, SpatialReference.wgs84()) distance = 2500.0 heading = 90.0 pitch = 75.0 } else { // Zoom out staticPoint = Point(-118.37, 34.46, SpatialReference.wgs84()) dynamicPoint = Point(-118.37, 34.46, SpatialReference.wgs84()) distance = 30000.0 heading = 0.0 pitch = 0.0 }
val staticCamera = Camera(staticPoint, distance, heading, pitch, 0.0) val dynamicCamera = Camera(dynamicPoint, distance, heading, pitch, 0.0) viewModelScope.launch { staticSceneViewProxy.setViewpointCameraAnimated(staticCamera,5.seconds) } viewModelScope.launch { dynamicSceneViewProxy.setViewpointCameraAnimated(dynamicCamera, 5.seconds) } isZoomedIn = !isZoomedIn }}/* 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.setfeaturelayerrenderingmodeonscene.screens
import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.paddingimport androidx.compose.material3.Buttonimport androidx.compose.material3.Scaffoldimport androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.lifecycle.viewmodel.compose.viewModelimport androidx.compose.ui.unit.dpimport com.arcgismaps.toolkit.geoviewcompose.SceneViewimport com.esri.arcgismaps.sample.setfeaturelayerrenderingmodeonscene.components.SetFeatureLayerRenderingModeOnSceneViewModelimport com.esri.arcgismaps.sample.sampleslib.components.MessageDialogimport com.esri.arcgismaps.sample.sampleslib.components.SampleTopAppBarimport androidx.compose.material3.MaterialTheme
/** * Main screen for the SetFeatureLayerRenderingModeOnScene sample. * Displays two SceneViews stacked vertically: the top scene renders layers statically, * the bottom scene renders layers dynamically. A FloatingActionButton toggles a zoom * animation on both scenes to demonstrate the rendering differences while animating. */@Composablefun SetFeatureLayerRenderingModeOnSceneScreen(sampleName: String) { val viewModel: SetFeatureLayerRenderingModeOnSceneViewModel = viewModel()
Scaffold( topBar = { SampleTopAppBar(title = sampleName) }, content = { paddingValues -> Column(modifier = Modifier .fillMaxSize() .padding(paddingValues), horizontalAlignment = Alignment.CenterHorizontally) {
// Static SceneView - renders its layers using static rendering Box(modifier = Modifier .weight(1f) .fillMaxWidth()) { SceneView( modifier = Modifier.fillMaxSize(), arcGISScene = viewModel.staticScene, sceneViewProxy = viewModel.staticSceneViewProxy )
// Small overlay label to indicate static scene Box( modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.surface.copy(alpha = 0.5f)) .align(Alignment.TopCenter) ) { Text( text = "Static", color = MaterialTheme.colorScheme.onSurface, modifier = Modifier .align(Alignment.Center) .padding(8.dp) ) } }
// Dynamic SceneView - renders its layers using dynamic rendering Box(modifier = Modifier .weight(1f) .fillMaxWidth()) { SceneView( modifier = Modifier.fillMaxSize(), arcGISScene = viewModel.dynamicScene, sceneViewProxy = viewModel.dynamicSceneViewProxy )
Box( modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.surface.copy(alpha = 0.5f)) .align(Alignment.TopCenter) ) { Text( text = "Dynamic", color = MaterialTheme.colorScheme.onSurface, modifier = Modifier .align(Alignment.Center) .padding(8.dp) ) } }
Button(onClick = viewModel::toggleZoom) { Text(if (viewModel.isZoomedIn) "Zoom Out" else "Zoom In") }
// Display message dialog if an error occurred in the ViewModel viewModel.messageDialogVM.apply { if (dialogStatus) { MessageDialog( title = messageTitle, description = messageDescription, onDismissRequest = ::dismissDialog ) } } } } )}