Virtual Umbrality

by Mike Masey

I'm a big believer in Virtual and Augmented Reality, and with Firefox introducing WebVR into their latest update, I started thinking, how could Umbraco be used to power some of these new, out of this world experiences?

The past few years has seen a multitude of technologies go from strength to strength, both in software and hardware. One area that’s starting to push its way into mainstream media is virtual and augmented reality (VR/AR). It’s an area of innovation that’s been worked on for over 20 years and the recent entry into the consumer market is only increasing its progression. The ability to view an alternative reality or add to our existing one in order to enhance our experience of it, in my view, will have a dramatic impact into the way that we interact with computers.

As the technology develops, it’s becoming more accessible to lower-end devices such as mobile phones. Web based VR is also gaining traction with frameworks and tools such as A-Frame.io, PlayCanvasand Three.Js to name a few. The browser vendors are also working on the WebVR spec to make it easier to generate multi-platform, responsive VR content.

What does any of this have to do with Umbraco?

One of the great things about Umbraco is its incredible flexibility. Although commonly used for websites, it has also been used as a headless CMS for numerous non-browser based projects. From IoTand Handlebars.Net integrations to the up coming Umbraco Headless, the ability to use Umbraco in new and interesting ways will continue to evolve.

So with that in mind, how can Umbraco be used to help shape the future of WebVR and/or WebAR? Let’s have a look at a few rough concepts in which Umbraco could be the powerhouse behind a VR/AR application, there might even be a few code samples.

Bringing VR and AR to the web not only makes it far more accessible to more people, it also adopts all of the usual web development principles, such as progressive enhancement. This means those without the right equipment should be able to access the information they need. As AR and VR on the web are still in their infancy from a consumer standpoint, it may be difficult to envisage the potential it has to offer, but as more people start investigating the technology themselves, who knows how our interactions with the internet with change.

Innovating the online shopping experience

The idea of a virtual store that you can put yourself in, or project into your home is already becoming attractive to a number of businesses. IKEA for example has an app that allows you to place furniture from their shop, into your own living room. Amazon has joined the scene with a similar AR app. Shopify has also been experimenting with the medium and released this incredibly useful article about their process of building a VR Shopping Experience.

So let’s say we have our own store that sells magnificent Umbraco sculptures. On our product page, a photo of the sculpture is all fine and dandy, but what if we wanted to really get an idea of scale for it, to get a feeling of what it would be like to stand next to it.

Demo time

Quick heads up, this demo is a very rough and ready implementation to provide a basic idea of how something like this could be achieved. It was built using the Umbraco Starter kit and A-Frame.io (which is constantly being updated and improved).

The Umbraco starter kit already contains some product pages so to start, we’ll create a new “3d Model” tab on our “Product” doctype, that will contain the properties for uploading the necessary files for our virtual statue. In this example the object requires an obj file (this will create the geometry), and an mtl file (this defines what is on the surface of the model).

We’ll need to add the mtl and obj MIME types to the web.config so that IIS can handle them.

Once that’s in place, using ModelsBuilder, we’ll get hold of the files we want and if they exist, create a button that will take the user to a VR version of the page.

At the top of our Product.cshtml, well check for the model files, and also check for a querystring to determine if we should be in VR mode (The link we will create will simple append a `?vr=1` to the url. If they both return true, we want to use a special “VRMaster.cshtml” template

The VRMaster.cshtml template strips out all of the usual code used on a page, and adds a script file which gets the A-Frame.io library. This is going to be a full page experience, but you could make this work on the product page without going to an external page if you wanted.

This should create a 3d scene that can be used whether or not a user has a VR headset. Hooray for progressive enhancement.

Now if a user visits the site and has a VR capable browser and device (Oculus Rift, HTC Vive, Windows Mixed Reality, Daydream etc), they can step into the world we have created by clicking on the icon in the bottom right of the screen. Below is an example of the running code, it's best viewed on a desktop device (iframes ignore orientation changes so it may not work on mobile for you, but you're more than welcome to take the code and play with it yourself). Top tip: ctrl + alt + i

In the grand scheme of things, this demo is fairly basic. The aim is to provide a rough example of how WebVR can be used alongside Umbraco. This could be taken further, perhaps into creating an entire shop.

The possibilities are endless

As I stated previously, Umbraco can work as a CMS for applications outside the browser, thanks to its API Controllers and upcoming headless version on Umbraco Cloud. Using this, we can take a similar approach of the demo above for handling content on iOS/Android apps or more powerful PC based experiences. This also opens up the capabilities of Augmented Reality (a browser based solution is in the works but not quite ready yet). To explain the differences between AR and VR, the VR version of the Umbraco statue provides a sense of scale in relation to the rest of the VR environment we have created, but with AR, we can get an idea of scale in relation to the rest of the real world. I’m sure those with the latest AR capable phones will have undoubtedly already played with this.

Granted, seeing how a glorious Umbraco statue would look in your house may not be everyone's cup of tea, but when you transfer this same concept to an architects website for example, it turns into the tool that can show a client what their house may look like before it’s built. By placing a person inside their new home before it’s been built would give most people a far better understanding of how it would look and feel, compared to viewing a set of flat blueprints.

Imagine logging into the Umbraco backoffice and putting on a headset to start editing content in an Umbraco VR scene. There are already tools available that allow you to have multiple screens all around you (think minority report, but with less Tom Cruise), but how about the actual Umbraco backoffice as its own virtual environment. The media library could surround you with images, when editing a content node you could have all the tabs visible to you at once, maybe even have voice to text integration to get those words out of your head and into the article you’ve been trying to write for a few weeks.

VR and AR are often being touted as the next computing platform, sometimes referred to as MR (Mixed reality) when they are combined. When this it integrated with other computing services such as voice recognition, conversational UIs, image recognition we may one day even step away from our keyboards.

Wrapping up

I could ramble on for ages about how VR/AR could be used alongside Umbraco, but i’m going to leave it here so your brain can start working on how you might use VR or AR. While your at it you should go grab yourself a tasty mince pie as well.

If you want to get in touch to talk about Umbraco/VR/AR/MR or just about anything, you can find my Twitter info below.

If you fancy making some new year's resolutions, maybe also think about coming along to some of the great Umbraco meetups that exist around the world. You can find information about the upcoming events at our.umbraco.org. Maybe even take it a step further and have a go at talking at one.