A Roller-Coaster Ride with Google Cardboard and Photosphere

RapidValue

Mar 11, 2015

Share

Google is unveiling big and new consumer products, every now and then. Google, probably, launches a new product, every time people turn on their laptops. Needless to say, these products are incredibly useful and also, bizarre. Google has been acquiring and developing tools, since time immemorial. With Google, introducing a lot of new technologies, let’s obtain some knowledge about the Virtual Reality Applications. There has been an upsurge in the field of Virtual Reality, which we have witnessed in the past few years. It is, basically, an artificial environment, that is created with the help of software and presented to the user. In such a case, the user believes and accepts it as a real environment.

While working on an interesting POC on virtual reality, I got an opportunity to acquire knowledge in this area. The requirement was to create a virtual reality application by combining the technologies, used by Google Streetview and Google Cardboard, to provide a virtual tour of a particular store. This would, in turn, mean that we should be able to load photosphere images, stereoscopically. The development is on Android and iOS device platforms.

Before we get into the details on how the mission was accomplished, it is essential to take a look at some of the technologies, which are involved.

Google Cardboard – It is a new technology that allows developers to build inexpensive VR apps, capable of displaying 3D scenes with binocular rendering, tracking and reacting to head movements, and interacting with app through magnet input. It uses OpenGl technology. More details>>

Google Street View – It is a technology, featured in Google Maps and Google Earth that provides panoramic views from various positions of the streets. More Details>>

Photosphere – It is a 360-degree panorama feature, that Google added in Android 4.2, (and originally with the Nexus 4), that allows you to take immersive pictures with your phone, then share them online. You can pan and zoom, much like the way you can do it with the Street View feature on Google Maps. More Details>>

Our Venture

We, first, installed the Cardboard app and took a look at the demo application via Cardboard. Indeed, it did look great. Everything was good and the next step was for us to create an app. We started our development with Android and tried building the app using OpenGL to render. Photosphere images are different from normal images and loading them needs special handling. We came across two libraries that support loading photosphere images:

We tried both of the above libraries to load the panorama images. We could successfully load them and, also, traverse from an image to another which was one part of the requirement. But we were unable to integrate this, with the Google Cardboard, to render these images, stereoscopically.
We did a lot of Google search to fix this. Our effort went in vain as we found that it has been an open question since December 2014. In a nutshell, we didn’t get much support from the developer forums, either. So, we had to toil all by ourselves for this venture.

Just when we were facing a lot of hurdles and seem to have got lost in an untraveled path, we came across Unity. Google does provide a Cardboard sdk for Unity. It was like finding a Mirage in the desert.

Unity is a cross-platform game creation system, developed by Unity Technologies, including a game engine and integrated development environment (IDE). It helps you to design awesome 3D content. It, also, provides cross-platform publishing, millions of ready-made assets in the Asset Store and online community. More Details>>

We tried using Unity and, to our surprise, it did meet all our requirements. We created a project in Unity by importing the packages in Cardboard sdk. After setting up few properties/materials, dragging and dropping the required images, we were ready to go by coding for few actions. Remaining implementation was addressed by the IDE. Unity supports coding, via languages like C#, JavaScript and Boo.

Unity makes a developer’s life easy because of the following features:

1. While using Unity, we don’t need to code the position of objects as in case of OpenGl. We can simply drag and drop objects to the intended position and the IDE addresses coding for the same.
2. Code once, and the IDE is capable of building the same application for multiple platforms like Android, iOS etc. and, in fact, supports more than 15 platforms.

The Conclusion

We achieved quite a bit, while travelling through this untrodden path and exploring several options. We accomplished our mission of creating a prototype VR app, which sufficed the requirements.

Anyone, who is interested in creating and experiencing virtual reality in an inexpensive way, here is your opportunity to achieve the same. Grab Google Cardboard, install Unity and you are good to go. Other than creating 3D and VR applications, Unity is a popular gaming Engine. If you have, always, wished that you wanted to write a game application, but you are new to it and never tried writing one, then Unity is the right option to start with. This is a good time for you to explore the Unity World!