ARDK-Examples

This Unity package provides several examples for many of the ARDK features. You can download the package at ARDK Downloads. You can import this package into your Unity project and build and run any of the following included scenes:

Note

The ARDK-Examples package has not been updated to support the Unity Input System package. Avoid importing ARDK-Examples in projects that have the Unity Input System enabled, as this will cause build problems.

AnchorsWithoutPlanes

This example demonstrates how to set anchors without needing to generate planes first, using ARFrame.HitTest().

ARNetworking

This example is, very simply, a networked augmented reality session. Clients and hosts can map out the environment in order to sync and know each other’s positions, which are indicated by a red rectangular phone w/ gray “antenna”. Once synced, you should be able to see this digital depiction of the phone by looking at one phone with another one synced in the same session.

ARNetworking FAQs/Tips:

  • Does each device need to be held while syncing?

    • Yes, they have to be held and viewing the same object - we are using the camera frame to map the world and attempt to determine where each phone is relative to each other.

  • Does the wait increase per device that is added to the network?

    • No, each phone is doing its mapping/syncing independently - the only caveat is that the first phone in the sessions is the “host“, and actually sending the authoritative map to all other phones, so that is the blocker.

  • Is there some complications with the type of devices?

    • The better the device, the faster the sync. Generally, iPhone 11s can take 5-10 seconds, while iPhone SE (1st gen) will take 40s - minutes.

  • How should I move to sync effectively?

    • It is better to pan around an object (move left and right) than staying still, since it takes multiple views to triangulate a point well.

Depth

Located in the ContextAwareness folder, this example demonstrates how to generate depth data to create immersive AR experiences. For more guidance on usage please see ARDK’s Depth documentation.

Gameboard

Located in the ContextAwareness folder, this example demonstrates how to query the environment for object placement, procedural gameplay and character navigation through an intermediate system called Gameboard. The Gameboard is a high level component that finds playable areas in the environment and provides a developer-friendly interface for gameplay. For more guidance on usage please see ARDK’s Gameboard documentation.

ImageDetection

This example demonstrates how to search for specified images in the real world and surface them as image anchors. This anchor can then be used in a variety of ways to spawn AR content (ex. creating AR effects overlaying a real world mural). For more guidance on usage please see ARDK’s ImageDetection documentation.

LowLevelNetworking

This is an example that demonstrates sending messages between multiple devices in the same networked session. Devices that join the same session (through the user inputted Session ID) will receive notifications that other peers have joined the session, and can send each other messages by pressing the “Send Message” button.

Note

There is no AR visual asset included with this sample.

MarkerSync

The example utilizes a QR code to quickly join and sync multiple players into a multiplayer AR session.

Meshing

Located in the ContextAwareness/Meshing folder, this example is a good starting point for exploring how to set up and configure Meshing. For more guidance on usage please see ARDK’s Meshing documentation.

MeshSaver

Located in the ContextAwareness/Meshing folder, this example demonstrates how to use the MeshSaver class to create a binary file clone of the current generated AR mesh. The saved mesh can then be loaded in the Unity editor through the MockMesh system.

MeshingSemantics

Located in the ContextAwareness folder, this example runs Semantic Segmentation, Occlusion and Meshing at the same time, showing the performance when running all systems at the same time.

Occlusion

Located in the ContextAwareness folder, this example demonstrates how to use generated depth data to place or move content behind real world objects without breaking immersion. For more guidance on usage please see ARDK’s Depth Occlusion documentation.

OcclusionStabilization

Located in the ContextAwareness/Meshing folder, this example demonstrates occluding virtual objects behind real world objects using an experimental depth blending occlusion technique. Make sure the MeshDepthChunk prefab is set to the ARDK_FusedDepth layer (adding the layer if needed) before running this sample.

PersistentKeyValue

This is an example that demonstrates storing data in the server-side persistent key-value store associated with each networked session. By tapping the screen, the device will attempt to store the value representing the upper circle’s color (locally set) on the server side. Upon receiving an updated value (stored by any device in the same session), the bottom circle (only modified through server messages) will change to the new color.

PlaneAnchors

A basic example demonstrating how to set up a minimal AR scene. This includes detecting and displaying planes, displaying feature points, and hit testing against planes.

Pong

This is an example Unity project in which ARDK’s features are used to create an AR Multiplayer version of Pong. Pong has a fully documented tutorial covering all of the Unity steps as well as C# script implementations in order to make the project work. Please note that this implementation uses low level messages to send data between players. Another version of this project, PongHLAPI, demonstrates the setup and use of High Level API objects (HLAPI) to streamline the message sending and receiving process for synchronizing players.

PongHLAPI

This version of Pong uses the same base as the basic Pong AR Multiplayer demo (low level version), but makes some changes to take advantage of ARDK’s High Level Networking API (HLAPI). The first difference is the lack of a MessagingManager. PongHLAPI has a fully documented tutorial covering all of the Unity steps as well as C# script implementations in order to make the project work.

Preloading

This example demonstrates how to use FeaturePreloadManager to pre-download AR assets. Also demonstrates how to stop in-progress downloads and clear the downloaded cache.

SceneSelector

This example doesn’t demonstrate any ARDK feature, but provides basic UI to switch between different examples if the SceneSelector scene is listed as the first scene in your Unity build settings. When this scene is added to your build, you can use a 5-finger tap on your device to exit a running example and return to the SceneSelector menu.

Segmentation

Located in the ContextAwareness folder, this example demonstrates how to access the semantic data in the scene and identify real world features like ground and sky. For more guidance on usage please see ARDK’s Semantic Segmentation documentation. Also demonstrates using semantic confidence masks using the experimental semantic confidence feature.

VirtualStudio - ARDK Remote Feed App

Built and installed on a mobile device, this scene can be used to pipe real world AR data from the device to the Unity Editor. For guidance, see ARDK’s Virtual Studio (Remote) documentation.

Virtual Studio - ExampleMockPlaythrough

Mock AR assets can be used to simulate receiving environmental AR data. For more guidance on usage please see ARDK’s Virtual Studio (Mock) documentation.

VPS Coverage

Located in the VpsCoverage folder, VpsCoverageExample demonstrates how to use the VPS Coverage API to get information for Coverage Areas and Localization Targets.

Also located in the VpsCoverage folder, the VpsCoverageListExample example demonstrates how to use the VPS Coverage API to get Coverage Area and Localization Target information, and how to present this information to the user in a list view with details such as the Localization Target name and “hint image”.

For more details on VPS and the VPS Coverage API, see Lightship VPS and Using the VPS Coverage API.

Wayspot Anchors

Located in the WayspotAnchors folder, the WayspotAnchors example demonstrates how to use the VPS Wayspot Anchors API and the WayspotAnchorsService interface to localize with a VPS-activated Wayspot, and place and restore Wayspot Anchors.

For more details on VPS and the VPS Wayspot Anchors API, see Lightship VPS and Using the Wayspot Anchor API.