Display scenes in tabletop AR

View iniOSAndroid
View on GitHub

Use augmented reality (AR) to pin a scene to a table or desk for easy exploration.

Scene content shown sitting on a surface, as if it were a 3D printed model

Use case

Tabletop scenes allow you to use your device to interact with scenes as if they are 3D-printed model models sitting on your desk. You could use this to virtually explore a proposed development without needing to create a physical model.

How to use the sample

You'll see a feed from the camera when you open the sample. Tap on any flat, horizontal surface (like a desk or table) to place the scene. With the scene placed, you can move the camera around the scene to explore. You can also pan and zoom with touch to adjust the position of the scene.

How it works

  1. Create an ARSceneView and add it to the view.

    • Note: this sample uses content in the WGS 84 geographic tiling scheme, rather than the web mercator tiling scheme. Once a scene has been displayed, the scene view cannot display another scene with a non-matching tiling scheme. To avoid that, the sample starts by showing a blank scene with an invisible base surface. Touch events will not be raised for the scene view unless a scene is displayed.
  2. Wait for plane detection using arView.PlanesDetectedChanged before allowing the user to tap to place the scene.
  3. Wait for the user to tap the view, then use arView.SetInitialTransforamtion(tappedPoint) to set the initial transformation, which allows you to place the scene. This method uses ARKit's built-in plane detection.
  4. If the call to SetInitialTransformation returns true, proceed to load the scene and display it.
  5. To enable looking at the scene from below, set scene.BaseSurface.NavigationConstraint to 0.
  6. Set the origin camera to the point in the scene where it should be anchored to the real-world surface you tapped. Typically that is the point at the center of the scene, with the altitude of the lowest point in the scene.
  7. Set arView.TranslationFactor such that the user can view the entire scene by moving the device around it. The translation factor defines how far the virtual camera moves when the physical camera moves.

    • A good formula for determining translation factor to use in a tabletop map experience is translationFactor = sceneWidth / tableTopWidth. The scene width is the width/length of the scene content you wish to display in meters. The tabletop width is the length of the area on the physical surface that you want the scene content to fill. For simplicity, the sample assumes a scene width of 800 meters and physical size of 1 meter.

Relevant API

  • ARSceneView
  • Surface

Offline data

This sample uses offline data, available as an item on ArcGIS Online.

About the data

This sample uses the Philadelphia Mobile Scene Package. It was chosen because it is a compact scene ideal for tabletop use. Note that tabletop mapping experiences work best with small, focused scenes. The small, focused area with basemap tiles defines a clear boundary for the scene.

Additional information

Tabletop AR is one of three main patterns for working with geographic information in augmented reality. See Display scenes in augmented reality in the guide for more information.

This sample uses the ArcGIS Runtime Toolkit. See Display scenes in augmented reality in the guide to learn about the toolkit and how to add it to your app.

Tags

augmented reality, drop, mixed reality, model, pin, place, table-top, tabletop

Sample Code

DisplayScenesInTabletopAR.axmlDisplayScenesInTabletopAR.cs
                                     
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.esri.arcgisruntime.navigateinar.RoutePlanActivity">

    <Esri.ArcGISRuntime.ARToolkit.ARSceneView
        android:id="@+id/arSceneView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/helpLabel"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="#99000000"
        android:paddingStart="0dp"
        android:paddingTop="5dp"
        android:paddingEnd="0dp"
        android:paddingBottom="5dp"
        android:text="When you see dots, tap to place."
        android:textAlignment="center"
        android:textAllCaps="false"
        android:textColor="#FFFFFF"
        android:textSize="18sp"
        android:gravity="center_horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.