This repository is a collection of code samples and projects that demonstrate the capabilities of Meta Spatial SDK. Meta Spatial SDK is a new way to build immersive apps for Meta Horizon OS. Meta Spatial SDK lets you combine the rich ecosystem of Android development and the unique capabilities of Meta Quest via accessible APIs.
The samples in this repository showcase various features of the SDK, such as spatial anchors, scene understanding, and object recognition. Each sample project includes source code, build scripts, and documentation to help developers understand how to use the SDK to build their own spatially-aware applications.
Whether you're a seasoned developer or just starting out with Meta Quest/Horizon OS, the Meta Spatial SDK Samples are a valuable resource for learning how to leverage the power of spatial computing in your applications.
To try out these sample apps, you will need:
- A Meta Quest device (Quest 2/3/3S/Pro)
- Mac or Windows
- Android Studio Hedgehog or newer
- Meta Spatial Editor
First, ensure that all of the requirements are met.
Then, to build and run a sample:
- Clone this repository to your computer
- Open the specific sample app with Android Studio
- Plug in your Quest device to your computer
- Click the "Run" button in the Android Studio toolbar, the app will now be running on your headset
Notes:
- All samples, except MRUKSample and PremiumMediaSample, require you to install Meta Spatial Editor.
- MediaPlayerSample and PremiumMediaSample contain examples of custom shaders, which requires the NDK to be installed and set up in app/build.gradle.kts (ex.
ndkVersion = "27.0.12077973"
) - Our samples support our custom OVRMetrics integration
We have 11 sample apps, demonstrating various features of Meta Spatial SDK:
- AnimationsSample shows how to play animation clips, create reusable animation drivers, and demonstrates frame-based procedural animation.
- HybridSample shows how to begin with a standard Android-based 2D panel experience and switch between an immersive experience that hosts the same panel.
- CustomComponentsSample shows how to create a custom component that embodies the data shared across various instances of an application.
- PremiumMediaSample shows how to stream DRM-protected content, play 180-degree videos, and cast reflections from panels into the user's spatial setup with MRUK.
- MediaPlayerSample shows how to build an immersive video playback experience.
- MixedRealitySample shows an immersive experience that interacts with the user's physical surroundings.
- MrukSample shows an immersive experience influenced by the user's physical surroundings.
- Object3DSample shows inserting 3D objects into a scene and adjusting their properties in Meta Spatial Editor.
- PhysicsSample shows adding a physics component and adjusting its properties in Meta Spatial Editor.
- SpatialVideoSample shows how to play video with spatialized audio.
- StarterSample is a starter project that is part of Getting Started with Meta Spatial SDK.
We also have a starter app CustomComponentsStarter, which only contains the boilerplate code of CustomComponentsSample. You can download this starter app and follow this tutorial to build a LookAt app with Meta Spatial Editor and SDK.
The Showcases folder contains five apps. These are fully-featured applications built with Meta Spatial SDK, and are open-sourced here in this repository.
The documentation for Meta Spatial SDK can be found here.
Find our official release notes here.
This release is a major version bump, which means some breaking changes were introduced.
- Spatial SDK activity lifecycle
- Add an activity lifecycle callback
onSpatialShutdown
. This lifecycle callback is guaranteed to be called during a Spatial activity’s shutdown process. Spatial resources such as entities and scene objects should be cleaned up here.
- Add an activity lifecycle callback
- Experimental Feature:
childrenOf
query- Add a childrenOf query to query the child entities for an entity.
- Experimental Feature:
changedSince
query- Add a changedSince query to get the changed entities since a certain datamodel version.
- CPU/GPU performance level now defaults to
SUSTAINED_HIGH
, added new performance level controls - Support for compositor layer sharpening and super sampling via
LayerFilters
- Support for Live Edits on Jetpack Compose UIs.
- The Spatial SDK AARs are now built with Kotlin 2.1.0. This is a breaking change, so you will need to update the Kotlin version in your application.
- Components are cached by default now, which reduces access to native C++ data and improves performance.
- The component GLXF’s attribute
uri
is now a UriAttribute. The component Mesh’smesh
attribute is now also a UriAttribute. - Ray intersections with non-BVH meshes now ignore triangle backfaces (consistent with BVH intersections).
- This may break some apps - especially those with panels/buttons. Make sure they are oriented correctly.
- Custom shaders should now import base Spatial SDK shader files prefixed with “data/shaders”, which matches the path to these files from the APK assets directory.
#include <metaSpatialSdkFragmentBase.glsl>
should become#include <data/shaders/metaSpatialSdkFragmentBase.glsl>
- Experimental feature: panel animations
- The PanelAnimation component is removed. Use PanelQuadCylinderAnimation, PanelScaleInAnimation or PanelScaleOutAnimation instead.
- Experimental feature: ISDK
- Rename IsdkToolkitBridgeSystem to IsdkComponentCreationSystem
- Near-field Grabbable entities can be picked up with whole-palm grab
- Interactor type hints added to PointerEvent.
- Panel offsets added to IsdkPanelDimensions.
- Updated sample applications to use IsdkFeature.
- Fixed issue with glTF Animation Pointer node transformations getting applied to the wrong nodes
- Experimental feature: ISDK
- Input now works via Cast Input Forwarding
- Entities can now be selected in the Data Model Inspector via in-game controllers or Cast Input Forwarding
- IsdkGrabbable billboarding now supports mesh direction offsets.
- Fix locomotion / IsdkSystem dependency ordering
- Allow non-uniform scaling on grabbables
- Improved cursor & ray visualizations
- Disabling collision via
Hittable
component now disables Isdk Surfaces. - Visible(false) components now excluded from ISDK
- Animation of Curved/Quad panels now correctly updates IsdkPanelDimensions
The samples all include the Spatial SDK Gradle Plugin in their build files. This plugin is used for the Spatial Editor integration and for build-related features like custom shaders.
Meta collects telemetry data from the Spatial SDK Gradle Plugin to help improve MPT Products. You can read the Supplemental Meta Platforms Technologies Privacy Policy to learn more.
The Meta Spatial SDK Samples package is multi-licensed.
The majority of the project is licensed under the MIT License, as found in the LICENSE file.
The Meta Platform Technologies SDK license applies to the Meta Spatial SDK and supporting material, and to the assets used in the Meta Spatial SDK Samples package. The MPT SDK license can be found in the asset folder of each sample.
Specifically, all the supporting materials in each sample's app/src/main/res/raw
and app/src/main/assets
folders including 3D models, videos, sounds, and others, are licensed under the MPT SDK license.