Spatial Computing: AR, VR, MR Developer Guide
In this article
Spatial computing is the umbrella term for technologies that blend digital content with the physical world, and as a developer, your core choice is between Augmented Reality (AR), Virtual Reality (VR), and Mixed Reality (MR). This guide breaks down the technical differences, use cases, and development trade-offs so you can pick the right approach for your next project. You'll learn what each technology actually requires from your code, your hardware, and your user's environment, plus the common pitfalls that trip up new developers.
Background: Where These Terms Came From
The terms AR, VR, and MR are often used interchangeably, but they describe distinct points on a spectrum of immersion. Virtual Reality (VR) fully replaces your vision with a simulated environment, typically through a headset like the Meta Quest or Valve Index. Augmented Reality (AR) overlays digital information onto the real world, usually through a phone screen (like Pokémon GO) or smart glasses. Mixed Reality (MR) is a more advanced form of AR where digital objects are anchored to and interact with the physical environment in real time—for example, a virtual ball that bounces off your real table. The term "spatial computing" was popularized as a broader category that includes all three, emphasizing that the computer understands and responds to 3D space.
The practical difference for developers is not marketing—it's the underlying technology. VR requires full 3D rendering and head tracking, AR requires camera input and image/plane detection, and MR adds persistent spatial mapping and occlusion (where real objects hide virtual ones). Understanding this spectrum helps you choose the right platform from the start.
How Each Technology Works Under the Hood
Each approach has a distinct technical stack, and your choice of platform dictates the tools you'll use.
- Virtual Reality (VR): You render two slightly offset 3D views (one per eye) at high frame rates (ideally 90fps or higher) to avoid motion sickness. You track the headset's position and rotation using inside-out cameras or external sensors, and you map controller movements to virtual hands. Development typically uses Unity or Unreal with XR SDKs like OpenXR.
- Augmented Reality (AR): You access the device camera feed, then use computer vision to detect flat surfaces (planes), images, or faces. You place virtual objects on those detected surfaces, and they stay put as the user moves. On phones, this uses ARKit (iOS) or ARCore (Android); on headsets like HoloLens, it uses the device's depth sensors.
- Mixed Reality (MR): This builds on AR but adds real-time spatial mapping of the entire room, not just a single plane. The system creates a 3D mesh of walls, floors, and furniture, allowing virtual objects to be occluded by real ones and to physically collide with them. MR also supports hand and eye tracking for natural interaction.
In practice, most modern AR headsets (like the Apple Vision Pro or Meta Quest 3 in passthrough mode) are actually MR devices because they map the environment. The line between AR and MR is blurring, but the development approach differs: MR requires more processing power and more complex spatial data handling.
How to Choose: A Decision Framework
Your choice should be driven by three questions: What is the user doing? How much physical movement is involved? And what hardware can you assume they own?
- Fully immersive experience? Choose VR. If the user needs to be transported to a different world—a game, a virtual meeting, a training simulation—VR is the only option that blocks out the real world.
- Interactive with the real world? Choose AR. If the user needs to see their actual surroundings while getting digital help—like furniture placement, navigation arrows, or repair instructions—AR on a phone is the most accessible.
- Digital objects that behave like real ones? Choose MR. If a virtual object must sit on a real table, be hidden behind a real chair, and respond to the user's hand gestures, you need MR.
- What's your target device? Phones are the most common AR platform (billions of devices). Standalone VR headsets are cheaper than MR headsets but less capable. High-end MR headsets (like HoloLens) are expensive and mostly enterprise-focused.
For a quick rule of thumb: if the user is stationary and wants to be elsewhere, pick VR. If the user is moving and wants digital help in their current location, pick AR. If the digital content must physically interact with the room, pick MR.
Common Problems and How to Avoid Them
Every approach has its own failure modes. Here are the most frequent issues developers face:
- Motion sickness (VR): Caused by latency, low frame rates, or artificial locomotion (moving the camera without the user's body moving). Mitigate by keeping frame rates above 90fps, using teleportation instead of smooth movement, and reducing the field of view during movement.
- Poor lighting (AR/MR): AR tracking relies on visible features in the camera feed. In dark rooms, tracking fails. Test in various lighting conditions and provide a fallback message.
- Occlusion errors (AR): Without depth data, virtual objects appear on top of real objects incorrectly. On phones, use ARKit's scene depth (if available) or avoid placing objects near edges.
- Battery drain: Continuous camera and sensor processing is power-hungry. Optimize by reducing the camera resolution when not needed and pausing tracking when the app is in the background.
- Scale and units: Real-world measurements are in meters. A common bug is using Unity's default units (which are meters) but forgetting to convert when using ARCore/ARKit's coordinate system. Always test with a physical ruler.
AR vs. MR: The Real Difference
Many developers ask: "If my AR app can detect a table, isn't that MR?" Not quite. The distinction is in the level of environmental understanding.
AR (on phones) typically detects a single horizontal or vertical plane. It doesn't know about walls, ceilings, or other objects. An AR app can place a virtual chair on the floor, but if you walk behind a real sofa, the virtual chair still renders on top of it—no occlusion.
MR, on the other hand, builds a full 3D mesh of the environment. The system knows where the sofa is, so the virtual chair is correctly hidden when you walk behind it. MR also supports spatial anchors that persist across sessions, so a virtual object stays in the same physical spot even after you close the app and reopen it the next day. This is a significant technical leap because it requires continuous sensor fusion and a more powerful processor.
For a simple AR experience like a measurement tool, a phone's ARKit is sufficient. For an industrial training simulation where a virtual machine must be occluded by real pipes, you need MR.
Costs and Hardware Considerations
Development cost and target hardware are often the deciding factors.
- Phone AR: Lowest cost for users (they already own a phone). Development is straightforward with ARKit/ARCore, but you're limited by the phone's camera and processing power. Good for consumer apps with wide reach.
- Standalone VR: Meta Quest 3 is a common target. Development is more complex (full 3D interactions), but the hardware is relatively affordable (~$500). Users need to own the headset, which limits your audience.
- PC VR: High-end VR (like Valve Index) requires a powerful PC, adding cost and setup friction. Used for high-fidelity simulations or games where visual quality is paramount.
- MR headsets: HoloLens 2 or Apple Vision Pro are expensive (thousands of dollars). Development is the most complex due to spatial mapping and gesture recognition. Usually justified for enterprise or specialized medical/engineering use cases.
As a developer, your budget also matters. Unity and Unreal are free for small teams, but you'll need a capable computer for VR development (a good GPU is essential). For AR, you'll need a physical device to test on—emulators don't accurately simulate camera tracking.
Safety and User Comfort
Safety is a critical concern that's often overlooked in development.
- VR: Users are blind to the real world. Always provide a clear boundary (like Guardian or Chaperone) to prevent collisions. Also, warn users to take breaks every 20-30 minutes to reduce eye strain and motion sickness.
- AR/MR: Users see the real world, but they may be distracted. Avoid placing virtual objects that obscure the user's vision or that move rapidly across the screen. For MR, ensure virtual objects don't encourage users to walk into real obstacles.
- Children: Many headsets have age restrictions (typically 13+ for Quest, 12+ for Vision Pro). Follow these guidelines.
- Photosensitivity: Some users are sensitive to flashing lights or rapid motion. Avoid strobe effects and provide a comfort mode option.
Always include a safety warning in your app's onboarding and allow users to calibrate their interpupillary distance (IPD) for comfortable viewing.
Frequently Asked Questions
Can I use the same code for AR and VR?
Yes, with some caveats. Unity's XR Interaction Toolkit and OpenXR allow you to write code that works across AR and VR devices. However, the interaction logic differs: VR uses controllers, while AR uses touch or hand gestures. You'll need to abstract input handling and environment scanning. In practice, most developers build separate scenes for AR and VR, but share the core business logic.
Is MR just a marketing term for better AR?
No, there is a technical distinction. MR requires real-time 3D reconstruction of the environment, which enables occlusion and physics interactions. AR on phones typically only detects planes. While some modern AR apps use depth sensors (like LiDAR on iPhones) to approximate MR, true MR is a more robust and persistent spatial understanding.
What's the best platform for a beginner?
Start with phone-based AR using Unity with AR Foundation (which wraps ARKit and ARCore). It's the cheapest to test (you have a phone), the learning curve is gentler (no headset setup), and you can later migrate to MR headsets using the same Unity project. VR development requires more 3D math and performance optimization, so it's better after you've built a few AR apps.
How do I handle occlusion in AR without a depth sensor?
You can't do true occlusion without depth data. Workarounds include: using ARKit's built-in scene depth on iPhones with LiDAR, using a pre-scanned 3D model of the environment (for fixed installations), or simply avoiding placing objects behind real-world obstacles. For most consumer apps, plane-based placement is sufficient.
What is the future of spatial computing?
The trend is toward lightweight glasses that do MR, with more advanced eye and hand tracking. Apple's Vision Pro and Meta's Quest 3 are pushing this direction. For developers, this means focusing on cross-platform frameworks (like OpenXR) and designing for natural interactions (hands, eyes, voice) rather than controllers. The core skills—3D math, spatial mapping, and performance optimization—will remain relevant.
Can I build a spatial computing app without a headset?
Yes. Phone-based AR is a form of spatial computing and doesn't require a headset. You can also use a web-based approach with WebXR, which allows AR/VR experiences in a browser. For testing MR features, you can use a phone with ARKit's LiDAR (iPhone Pro models) to simulate some MR capabilities, but you'll eventually need a headset for full testing.