Home Topic Applications Opening Up Virtual Reality Development with WebVR

Opening Up Virtual Reality Development with WebVR

Opening Up Virtual Reality Development with WebVR

“Virtual reality (VR) is nothing new — people have been experimenting with it for decades. But only recently, we have come to terms with having commercial hardware like Oculus or HTC Vive to experience and enjoy VR content within our home,” says Rabimba Karanjai, a full-time graduate researcher and Mozilla contributor, who will be speaking about virtual reality development at the upcoming Open Networking Summit.

Such commercial devices have transformed how we consume VR experience; however, Karanjai explains, “all of these hardware devices come with their own SDK, their own set of rules to create VR applications and walled gardens in which to actually publish these games, stories, and applications.”

Rabimba Karanjai, full-time graduate researcher and Mozilla contributor
WebVR — an experimental JavaScript API — seeks to address these limitations and open up development by providing interfaces to let developers build VR experiences in the browser. We spoke with Karanjai to learn more.

Linux.com: Can you give our readers some background on WebVR? What’s the current state of development?

Rabimba Karanjai: We needed an open space, open standard to build and shape our virtual reality experience. And what better and mature open platform is out there than the World Wide Web? WebVR is there to make the experience truly global, cross-platform, and easy to approach.

So what is WebVR? Hardware that enables virtual reality applications requires high-precision, low-latency interfaces to deliver an acceptable experience. Other interfaces, such as device orientation events, can be repurposed to surface VR input, but doing so dilutes the interface’s original intent and often does not provide the precision necessary for high-quality VR. The WebVR API provides purpose-built interfaces to VR hardware to allow developers to build compelling, comfortable VR experiences within the browser.

WebVR is an experimental JavaScript API that provides access to virtual reality devices, such as the Oculus Rift, HTC Vive, Samsung Gear VR, or Google Cardboard, in your browser. Suddenly now you can build VR experience and applications which can work inside your browser and hence doesn’t depend on specifically one hardware or software. The WebVR API Spec is still in draft stage and constantly evolving. I encourage you to have a look at it here and also in the W3C working group.

Linux.com: Can you describe some potential applications?

Karanjai: The applications as it stands are limitless. The most common use case we have been watching from the demos and code contributions mostly revolve around creating immersive experience based on VR. We have contributors building immersive stories with it, a virtual world where you can actually experience the story. A very interesting field is we see a lot of game development attempts with immersive content coming up.

Also, we have A-Painter where you can paint in 360 degree virtual world and webVR enables you to share those painting and experiences with others with just a web URL, which you can essentially tweet or share. And the person will be able to immediately immerse and go into the virtual scene. We have A-Blast, a virtual single person shooter game, metaverse, a universe of Web Virtual reality objects, panorama and 360 degree viewers. Use case varies from having realtime virtual reality collaborative classrooms to having immersive meetings in virtual space.

We have applications of VR in ranging from educating people to military and training purposes, too. So what is possible with WebVR is truly limitless. We have a blog at https://aframe.io/blog/ where we showcase the newest creations from our contributors at a weekly basis.

Linux.com: What is A-Frame and how does it facilitate development of VR applications?

Karanjai: A-Frame is a web framework for building virtual reality experiences. It was started by Mozilla VR to make WebVR content creation easier, faster, and more accessible. A-Frame is aimed squarely at the web developer community, the vast majority of whom have been frozen out of WebVR development because they don’t know WebGL, the powerful but complex 3D API that WebVR runs on.

A-Frame lets you build scenes with just HTML while having unlimited access to JavaScript, three.js  and all existing Web APIs. A-Frame uses an entity-component-system pattern that promotes composition and extensibility. It is free and open source with a welcoming community and a thriving ecosystem of tools and components.

The motivation behind A-Frame was to bring the barrier of entry down for creation of more WebVR content. A-Frame essentially makes it very easy to rapidly prototype and create WebVR content without going into the nitty gritty of three.js. Developers can concentrate more on creating content using predefined entity and components and as well as create their own which can be reused later. They can also choose to use components made by community and quickly build their vr experience. We already have a NPM style A-Frame component system in place here, which will be the home of all verified and curated A-Frame components in future.

Linux.com: Are there particular challenges facing the project, or successes that you’d like to share?

Karanjai: WebVR is a living standard and a lot of things are being changed and worked upon. Those changes reflect what gets into A-Frame. We actually had a remarkable number of contributors onboard in such a short amount of time and a lot of very interesting projects, talks and scenes have come up from the awesome community. We try to maintain a curated list of those in a GitHub repository here.

Linux.com: What’s ahead for WebVR?

Karanjai: We have exciting times ahead for WebVR. With Oculus, HTC Vive, and Daydream all supporting interactions, now you can not only experience the virtual reality but also interact with the elements in it. This interaction opens up a universe of possibilities and opportunities. With room-scale VR, we can now track a user’s position as well as movement in a virtual space. And it makes it much exciting to mash up this with the power of open web and APIs we already have at our disposal. We can mash up a VR model with knowledge-based APIs, YouTube APIs, and even a IoT device like Raspberry Pi to have your own virtual living assistant whom you can actually see and can interact with. You can mash these models up with WebRTC based communication or firebase to have real-time interaction and multi-user experience where the users literally need to enter a same URL or chatroom kind of experience.

We already have a lot of users trying to mash up mobile camera overlaying with VR objects to create an augmented reality-like experience as you can see here, and you can see how quickly you can prototype those here. We have just scratched the surface of what is possible. You can see a lot of inspiring and awesome examples of what everyone is imagining and prototyping in the aframe.io/blog. This is the most exciting time to get involved in the WebVR and A-Frame community!

Rabimba Karanjai is a full-time graduate researcher, part-time hacker, and FOSS enthusiast. He used to write code for IBM Watson and do a bunch of other things at their lab. At present, he’s crawling his way toward a PhD at Rice University. He contributes with Mozilla WebVR, Security and Emerging Technologies team and is a Mozilla TechSpeaker. His interests include performance optimization and exploiting parallelization for VR applications, as well as privacy and security.  He generally blogs at blog.rabimba.com and can be contacted @rabimba.

Open Networking Summit April 3-6 in Santa Clara, CA features over 75 sessions, workshops, and free training! Get in-depth training on up-and-coming technologies including AR/VR/IoT, orchestration, containers, and more.

Linux.com readers can register now with code LINUXRD5 for 5% off the attendee registration. Register now!