Development

Exploring WebVR, Mozilla A-Frame and the limits of mobile VR

Why browser-based Virtual Reality is getting much easier to build with Mozilla's A-Frame, what my experimental VR thesis taught me about performance and motion sickness, and the limits of mobile screens.

I have been excited about Virtual Reality since the very first Oculus Rift Kickstarter and early Dev Kit prototypes, even before Facebook bought Oculus back in 2014. Seeing real consumer headsets like the Rift and the HTC Vive finally hit the market this year feels like watching science fiction turn into actual hardware.

What gets me even more excited as a web designer and developer though is not closed desktop app stores. It is WebVR, the idea that you can open a normal URL in a browser and step straight into a 3D environment without downloading a 4GB native app first.

How Mozilla A-Frame makes WebVR approachable

Until recently, building a 3D or VR experience for the browser meant writing a lot of boilerplate WebGL and Three.js JavaScript, handling stereoscopic cameras, lens distortion, orientation sensors and fallbacks by hand.

That changed fast thanks to Mozilla and their A-Frame library. Built by the MozVR team on top of Three.js and the new WebVR 1.0 API (with A-Frame 0.3.0 just out last month), it lets you describe a VR scene using plain, declarative HTML tags:

<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>

<a-scene>
  <a-box position="0 1.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
  <a-plane position="0 0 -4" rotation="-90 0 0" width="8" height="8" color="#7BC8A4"></a-plane>
  <a-sky color="#ECECEC"></a-sky>
</a-scene>

Drop that into an HTML file, open it in Firefox or on a smartphone, tap the VR goggles icon, and you already have a stereoscopic scene ready for Google Cardboard or a desktop headset. Lowering the barrier to entry this much means designers and front-end developers can finally prototype spatial interfaces in the browser instead of waiting for specialized game engine pipelines.

What my experimental VR thesis taught me about performance

Earlier this year I spent months working on my experimental thesis project, building a browser-based Virtual Reality experience designed to run across everyday devices instead of only high-end gaming PCs. I won't go into all the details of the project here, since it deserves its own dedicated case study, but building it from 3D models and lighting all the way to browser interactions taught me one huge lesson: in VR, performance is everything.

On a normal website, a choppy scroll or a brief frame drop is annoying. In Virtual Reality, dropped frames and input latency immediately cause motion sickness. If your head turns and the scene lags behind by even a fraction of a second, your brain rejects the illusion and you feel nauseous within minutes.

Keeping geometry low-poly, baking lighting into textures instead of calculating heavy real-time shadows, and watching every single draw call stops being a nice optimization and becomes a hard requirement for basic human comfort.

The real limits of mobile screens right now

Testing WebVR across phones and tablets also makes the current hardware limits very clear.

Desktop headsets like the Oculus Rift run at 90Hz with dedicated GPUs and full positional tracking. Most smartphones today are still stuck at 60Hz, have limited mobile GPUs that heat up and throttle after a few minutes of rendering two stereoscopic views at once, and only track head rotation rather than physical movement in space.

Even the screens themselves show their limits once you put two magnifying lenses inches from your eyes. Lower-resolution mobile displays suffer heavily from the "screen-door effect" where you can literally see the grid of pixels, small UI text becomes hard to read without eye strain, and battery drains fast.

Still early, but heading in the right direction

Despite all of those hardware and performance constraints, I am really optimistic about where WebVR is going. Mobile screens are getting sharper every year, browser support for WebVR 1.0 is moving forward quickly, and tools like Mozilla's A-Frame are making spatial web experiments way simpler to build and share with a single link.

VR on the web is still early and imperfect in 2016, just like early HTML5 and mobile web apps were a few years ago. Once hardware catches up and we get better at optimizing 3D performance in the browser, the web is going to be one of the most open and accessible platforms for Virtual Reality.

Get in touch

If you want to chat about Embedded Development, Design Systems, or just say hello, feel free to reach out. I speak English, Italian, Ukrainian, and Russian, and I'm always open to a conversation.

E-mail LinkedIn