For multi-platform compatibility, broader hardware reach, and reduced code rewriting, OpenXR holds the edge. If rapid prototyping and immediate visibility of changes are necessary, MRTK shines. Your choice should depend on specific application requirements and target platforms.
Key Differences Between OpenXR and MRTK
- Platform Compatibility: OpenXR provides a universal, open standard for AR/VR while MRTK is primarily directed towards Microsoft’s ecosystem.
- Feature Set: OpenXR aims to standardize AR/VR code, while MRTK offers interactive UX components for spatial interactions.
- Code Efficiency: OpenXR reduces the need for porting or rewriting code, while MRTK encourages modularity by allowing developers to swap out core components.
- Support and Updates: Both receive steady updates, but MRTK provides detailed tutorials for development, while OpenXR is backed by a consortium and aims for more extended capabilities.
Comparison | OpenXR | MRTK (Mixed Reality Toolkit) |
---|---|---|
Initial Release | July 29, 2019 | 2016 |
Primary Purpose | Unify AR/VR software development across diverse hardware | Cross-platform development for Mixed Reality (MR), Augmented Reality (AR), and Virtual Reality (VR) applications |
Key Features | Common APIs, extension mechanism for core features, extensive device compatibility, minimum latency | Cross-platform input system, spatial interactions, UI functionalities, extensible framework |
Portability & Interoperability | Boosts performance, reduces porting/rewriting of codes | Enables easy cross-platform development |
Known For | Distilling VR/AR development under common APIs | Rapid prototyping via in-editor simulation |
SDK Compatibility | Interoperable with various platforms | Compatibility with XR SDK Plugin, Windows XR Plugin, Oculus XR Plugin, ARCore XR Plug-in, ARKit XR Plug-in |
Device Support | Microsoft HoloLens 2, Windows Mixed Reality headsets | Microsoft HoloLens 2, Windows Mixed Reality headsets, Oculus Quest, Android and iOS devices, SteamVR devices via OpenXR |
Developer Support | API aids developers, reduces development and maintenance burden, promotes open platform | Rich tutorials, resourceful documentation, open community interaction on Slack, active contributions encouraged |
Innovation | Supports next-gen graphic technologies | Provides building blocks for spatial interactions and UI functionalities |
Future Proofing | Steady updates and future plans for extended capabilities | Released MRTK3 public preview for next-gen MRTK |
What Is OpenXR and Who’s It For?
OpenXR represents a royalty-free, interoperable access software that bridges the gap between AR/VR hardware and software development, rendering them unified. Expressed in simple terms, it’s meant for anyone seeking to develop AR/VR applications without the hassle of repeatedly re-writing code or performing manual ports for a diverse pool of hardware.
Formally introduced to the public on July 29, 2019, OpenXR takes on the role of harmonizing AR/VR apps and game engines—attributable to its universally accepted standard open APIs. As such, OpenXR gains the applause from software developers, technology corporations, and gaming enthusiasts.
Pros of OpenXR
- Improves performance and minimizes latency for end users.
- Offers comprehensive extension mechanism.
- Ideal for developers targeting various VR/AR hardware.
- Reduces developers’ workload and maintenance.
- Backed by notable tech companies like AMD, Microsoft, and Google.
Cons of OpenXR
- Not an engine in itself, just enables the writing of portable code.
- Coders must keep abreast with steady updates and evolving capabilities.
- Its full potential is yet to be explored as its use is still relatively new.
What Is MRTK and Who’s It For?
MRTK, or the Mixed Reality Toolkit, is a Microsoft-driven extensible framework created to simplify building of Mixed Reality, Augmented Reality, and Virtual Reality applications. Originally designed for HoloLens 1 in 2016, MRTK broadened its horizons to support a variety of platforms, making it suitable for developers across different mixed reality platforms.
MRTK takes the complexity out of interactions and UI functionalities in these platforms. Developers who wish to make quick, visible changes benefit from this tool-kit as MRTK satisfies their need for rapid prototyping through in-editor simulation.
Pros of MRTK
- Enables cross-platform development for MR, AR, and VR applications.
- Robust support for a variety of devices.
- Provides extensive tutorials for Unity-powered Mixed Reality development.
- Open community interaction for robust solutions.
- Continued support offered for critical issues and bug reports.
Cons of MRTK
- Developers may face a steep learning curve.
- MRTK3 is still in the preview stage.
- Dependency on external plugins for cross-functionality.
Code Examples for OpenXR & MRTK
OpenXR
This OpenXR code sample creates a haptic feedback using the XR haptic pulse function. This can be useful in virtual reality applications to provide user feedback. Note that you must first obtain a reference to the XR session and input source. The pulse function is also only available in OpenXR 1.2 and later.
// Haptic feedback with OpenXR
let session, inputSource; // Reference to the XR session and input source
const hapticActuator = new XRDeviceHapticActuator({session, inputSource});
// Check if the actuator can vibrate
if(hapticActuator.supportsVibration) {
// Vibrate at maximum amplitude for 500ms
hapticActuator.vibrate(1.0, 500);
}
MRTK
This MRTK code sample demonstrates how to create a bouncing ball using physics. This can lead to more realistic interactions with the restrained objects in AR/VR scenes. It is assumed you have MRTK configured with Unity and the bouncing ball game object has RigidBody and Collider components defined.
// Bouncing Ball in MRTK
using Microsoft.MixedReality.Toolkit;
using UnityEngine;
public class BouncingBall : MonoBehaviour
{
private Vector3 startPosition;
private Rigidbody rigidbody;
// Start is called before the first frame update
void Start()
{
startPosition = transform.position;
rigidbody = GetComponent<Rigidbody>();
}
// Makes the ball bounce when hit
public void PointerDown(MixedRealityPointerEventData data)
{
rigidbody.AddForce(new Vector3(Random.onUnitSphere.x, Random.onUnitSphere.y, Random.onUnitSphere.z) * 1000);
}
// Resets the ball to the starting position
public void ResetPosition()
{
rigidbody.velocity = Vector3.zero;
transform.position = startPosition;
}
}
OpenXR or MRTK: Deciphering the Matrix of Decision
If you’re neck-deep in AR/VR software development or simply gaze on from the sidelines embracing your tech curiosity, you’re likely questioning which stands taller, OpenXR or MRTK, in terms of compatibility, functionality, and user-friendliness. Fear not, your quest ends here.
FOR CROSS-PLATFORM DEVELOPERS
If the unification of APIs and cross-platform development is the oxygen you breathe, go for OpenXR. Its robust API-centric core, extensive device compatibility, regular upgrades, and open-source nature backed by tech giants make it an irresistible bait. It’s not an engine, but a gearing device aiding engines to create universal code.
FOR ASPIRING AR/VR DEVELOPERS
Starters seeking a foundation for their AR/VR journey, MRTK is your calling. With tutorials, in-editor prototyping, UX building blocks for interactions and UI, debugging tools, and multimedia scene management, it’s the Swiss Army Knife every novice needs. Plus, Microsoft’s footprint ensures continued support and community interaction.
FOR GAME DEVELOPERS
OpenXR unabashedly walks away with the trophy for game developers. With hand and eye tracking, scene understanding, composition layering, reprojection modes, and interop with other SDKs, you get more elbow room for creativity. Unity and Unreal are already fans. What are you waiting for?
For maximum compatibility and cross-platform development, OpenXR reigns supreme. However, if you’re seeking rapid prototyping and a beginner-friendly experience, MRTK is your best bet. Game developers will find a robust ally in OpenXR’s extensive toolkit.