View on GitHub Sample viewer app

Change the appearance of a 3D object scene layer with different renderers.

Screenshot of apply renderers to scene layer sample

Use case

A scene layer of 3D buildings hosted on ArcGIS Online comes with a preset renderer that defines how the buildings are displayed in the application. However, the fill color may sometimes blend into the basemap, making the buildings difficult to distinguish. To enhance visualization, you can apply a custom renderer with a more contrasting fill color, helping the 3D buildings stand out more clearly. Additionally, you can use a unique value renderer to represent different building uses, or a class breaks renderer to visualize building ages - valuable insights for urban planning and analysis.

How to use the sample

Wait for the scene layer to load. The original scene layer displays 3D textured buildings. Tap on the “Select Renderer” dropdown menu and choose a different renderer to change how the buildings are visualized. Each renderer applies different symbology to the scene layer. Setting the renderer to null will remove any applied symbology, reverting the buildings to their original textured appearance.

How it works

  1. Create an ArcGISSceneLayer from a service URL.
  2. Add the scene layer to an ArcGISScene and display it in a SceneView.
  3. Create different renderers:
    • A SimpleRenderer with a MultilayerMeshSymbol and a fill color and edges.
    • A UniqueValueRenderer using a string field and different MultilayerMeshSymbol for each unique value of the building usage.
    • A ClassBreaksRenderer using a numeric field and different MultilayerMeshSymbol for each value range of the year the building was completed.
  4. Set the scene layer’s renderer property to the selected renderer.
  5. Set the scene layer’s renderer property to null, resulting in displaying the original texture of the buildings.

Relevant API

  • ArcGISSceneLayer
  • ClassBreaksRenderer
  • MaterialFillSymbolLayer
  • MultilayerMeshSymbol
  • SceneView
  • SimpleRenderer
  • SymbolLayerEdges3D
  • UniqueValueRenderer

About the data

This sample displays a Helsinki 3D buildings scene hosted on ArcGIS Online, showing 3D textured buildings in Helsinki, Finland.

Tags

3D, buildings, renderer, scene layer, symbology, visualization

Sample Code

MainActivity.kt MainActivity.kt ApplyRenderersToSceneLayerViewModel.kt ApplyRenderersToSceneLayerScreen.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.applyrendererstoscenelayer
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.applyrendererstoscenelayer.screens.ApplyRenderersToSceneLayerScreen
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme
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 {
ApplyRenderersToSceneLayerApp()
}
}
}
@Composable
private fun ApplyRenderersToSceneLayerApp() {
Surface(color = MaterialTheme.colorScheme.background) {
ApplyRenderersToSceneLayerScreen(
sampleName = getString(R.string.apply_renderers_to_scene_layer_app_name)
)
}
}
}