13 April, 2016

VR with AFrame vs Three.js vs Babylon.js
By: Matthew Jackson

It is hard to compare three great evolving libraries. They all grow and change, but it is good to know what is working now and what isn't. 

BabylonJS

This library probably is evolving faster than ThreeJS. It is always hard to tell, but they both don't have that many contributors besides their founders. It does look like Babylon had more updates recently and s more active community. 

It is worth noting that I did try BabylonJs a few months ago with Google Cardboard and it didn't respond to head movements. I am sure others had better luck then me, but I didn't find so much community support when it came to VR. 

AFrame & ThreeJS

It is important to know that AFrame is at its core a wrapper to ThreeJS. It would seem you should favour ThreeJS as you have more control and Documentarion. 

If you are developing a major application and your familiar with ThreeJS this might be the way to go. But getting all of the VR code setup for a small project probably isn't worth it.

AFrame shines in its simplicity to have a full project setup and running with only HTML. 

The best part about AFrame in my opinion is that it is object driven. Events happen in Dom elements. Each object in your world is a Dom element you can interact with. Instead if storing arrays of objects and declaring them in JavaScript, in AFrame it's html and visible for debugging. 

The worst part is the best. Since Dom elements are really wrapped JavaScript. Accessing and manipulating the under architecture can be annoying and tricky. 

Two great reasons to choose AFrame is that the community on slack is Amazing! The next reason is that it is backed by Mozilla which will have more power to affect change than ThreeJS or BabylonJs. 

Conclusion 

AFrame is the simplest and best product to enter the VR programming world. Especially if it is a small demo project, choose AFrame, I think regardless of your familiarity with other libraries.

If you know ThreeJS well, perhaps if it is a large project you might feel more comfortable. I do think ThreeJS as all javascript code gets harder to manage the larger it is; however, if you will split files and organize them well than I think you should use what you know. There might be some code you will be duplicating though, like VR headsets. Keep in mind AFrame will be developing for all of them and testing all of them.

Tags: AFrame