🚀 Getting Started with Augmented Reality (AR): Build Your First WebAR App

IOFTIOFT
3 min read

🔍 Introduction

Augmented Reality (AR) is no longer just a buzzword—it’s changing the way we interact with digital content. If you’ve already explored the basics of AR, it’s time to get hands-on.

In this article, we’ll walk you through creating a basic WebAR app using 8thWall + A-Frame, or MindAR.js, where you can render a 3D object on top of a real-world marker using just your phone browser—no app needed!

🧠 What You Will Learn

  • How to set up a basic WebAR environment

  • Use marker-based AR to display 3D models

  • Integrate A-Frame and MindAR.js or 8thWall

  • Deploy your AR experience on the web

🛠 Tools & Libraries

Here are the libraries/tools we'll use:

ToolUse
A-FrameWebVR framework (works with WebXR)
MindAR.jsLightweight marker-based AR
8thWall (optional)Powerful commercial WebAR SDK
Glitch/Replit/LocalhostTo run your WebAR project

🧰 Prerequisites

  • Basic knowledge of HTML

  • A smartphone with a camera

  • Code editor (VS Code or Glitch)

  • 3D model (you can get .glb or .gltf from Sketchfab or Poly Pizza)

✨ Project: Display a 3D Object Using Marker-Based WebAR

✅ Step 1: Set Up the Basic HTML

You can use this boilerplate code using MindAR.js and A-Frame:

<!DOCTYPE html>
<html>
  <head>
    <title>My First WebAR App</title>
    <script src="https://cdn.jsdelivr.net/npm/aframe@1.4.1/dist/aframe.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/mind-ar@1.1.5/dist/mindar-image-aframe.prod.js"></script>
    <style>
      body, html { margin: 0; overflow: hidden; }
      #ar-container { width: 100vw; height: 100vh; }
    </style>
  </head>
  <body>
    <div id="ar-container">
      <a-scene mindar-image="imageTargetSrc: ./targets.mind;" embedded color-space="sRGB" renderer="precision: mediump; antialias: true;" vr-mode-ui="enabled: false" device-orientation-permission-ui="enabled: true">
        <a-assets>
          <a-asset-item id="model" src="./model.glb"></a-asset-item>
        </a-assets>

        <a-camera position="0 0 0" look-controls="enabled: false"></a-camera>

        <a-entity mindar-image-target="targetIndex: 0">
          <a-gltf-model src="#model" position="0 0 0" scale="0.1 0.1 0.1"></a-gltf-model>
        </a-entity>
      </a-scene>
    </div>
  </body>
</html>

✅ Step 2: Add the Marker Image

  • Go to MindAR Marker Generator

  • Upload a custom image (like a logo or QR code)

  • It will generate a targets.mind file. Use that in your imageTargetSrc above.

✅ Step 3: Add a 3D Model

  • Download a .glb model from Sketchfab

  • Upload it in your project folder

  • Reference it using <a-asset-item> tag

✅ Step 4: Run Locally or Host

  • Use Live Server extension in VS Code to view the project on your phone

  • OR deploy it using Glitch or GitHub Pages

  • When you scan your marker image with your phone camera in browser, the 3D object should appear over it!

🎯 What You Just Built

You’ve created a WebAR app that works directly in the browser, using:

  • A marker image

  • A 3D model

  • JavaScript-based AR libraries

No need to install any app. This is the foundation for AR posters, business cards, try-on products, and interactive learning materials.

🧪 Next Steps

Now that you have this working:

  • Replace marker image with your brand logo

  • Add animations using A-Frame

  • Load AR videos or interactive buttons

💡 Real-World Use Cases

Use CaseExample
EducationShow 3D anatomy when scanning textbook images
E-commerceShow product preview when scanning catalog
EventsUse AR invitation cards with 3D logos or animations
ResumeAdd AR to resumes with 3D portfolio links

🏁 Conclusion

Augmented Reality doesn't need expensive hardware or complicated apps. With MindAR.js and A-Frame, you can build browser-based AR experiences that work on most smartphones.

This is just the beginning. The possibilities with AR are endless, and the more you experiment, the more powerful and immersive experiences you can create.

🔗 Resources

0
Subscribe to my newsletter

Read articles from IOFT directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

IOFT
IOFT