Porting A VR Application From Google Cardboard to Oculus Quest

Santiago Peña Mosquera
8 min readJul 25, 2021

--

With the advancement of technology, the developments of applications in virtual reality, become increasingly relevant, this leads to more and more platforms and headsets in which to see and experience virtual reality, therefore it presents a series of challenges for programmers since they can vary from a set of high-end glasses to a mobile phone, making it necessary to write the code of an application for multiple platforms or porting.

In software engineering, porting is the process of adapting software for the purpose of achieving some form of execution in a computing environment that is different from the one that a given program (meant for such execution) was originally designed for (e.g., different CPU, operating system, or third party library). The term is also used when software/hardware is changed to make them usable in different environments.

In other words, porting is the process of adapting code to work on another operating system or architecture that it did not initially work on. Software is considered portable when the cost of porting is less than the cost of writing it from scratch, or the effort required to adapt it to a new environment is less.

In this blog, I will discuss considerations before porting a virtual reality application developed in unity using the Google Cardboard platform to Oculus Quest.

Google Cardboard

It is a virtual reality platform developed by Google based on folding cardboard, hence its name, which works from placing a smart mobile phone with Android or iOS. Its premise is to transform any smartphone into a virtual reality device for less than US $ 5 With just a cut-out folding cardboard and 2 lenses, it is possible to mount the smartphone and take advantage of Android VR applications.

Oculus Quest

Is a high-end virtual reality (VR) headset developed by Oculus, a division of Facebook. It works as a standalone device that can run games and software wirelessly under an Android-based operating system. It supports positional tracking with six degrees of freedom, using internal sensors and a series of cameras on the front of the earbuds. The cameras are also used as part of the “Passthrough” safety feature, which shows when the user leaves their designated boundary area.

Differences Between Cardboard and Quest

Although both platforms support virtual reality, they are extremely different, some say that it is like comparing a Ford Fiesta with a Ford Mustang, they are in completely different leagues, the differences in price and quality are considerable.

Design And Price

Cardboard is a platform designed to cost no more than $ 5 with just a cut-out folding cardboard and 2 lenses, in which a smartphone must be mounted, therefore the final price can vary depending on the characteristics of the phone, which fulfills the requirements The minimum could be around $ 130. On the other hand, Oculus Quest is a headset with a high-resolution display, high-quality lenses, controllers, sensors for hand tracking, and embedded speakers, all integrated into an ergonomic design, with a launch cost of around $ 400.

Hardware

As I had mentioned previously, the hardware for the Cardboard varies depending on the cell phone that the user has but the minimum requirements necessary for it to work correctly are, a 1800p display, 2GB of RAM, and a CPU with a minimum speed of 1.4 GHz. These requirements can run low and medium-level games well, but lags and hick-ups can occur in high-level games.

On the other hand, Oculus Quest uses a Qualcomm Snapdragon 835 system on chip with 4GB of RAM. Three of the chip’s four 2.3 GHz CPU cores are reserved for software, while the remaining core and its four lower-powered cores are reserved for motion tracking and other background functions. It also runs an Android-based operating system, with modifications to improve performance in virtual reality applications. For each eye, a diamond Pentile OLED display is used, with a resolution of 1440 × 1600 and a refresh rate of 72 Hz. The headset uses “next-generation” lens technology, which helps to magnify the sweet spot of the lens. It also has physical interpupillary distance (IPD) adjustment.

Movement

Oculus Quest supports six degrees of freedom, this means that the user can move in 3 axes of rotation (pitch, yaw, roll), and it can translate in 3 perpendicular axes (up/down, left/right, forward/backward), On the contrary, Google Cardboard only supports three degrees of freedom, in the 3 rotation axes (pitch, yaw, roll), which means that it does not allow to fully simulate the movements of the physical environment in virtual environments.

Controllers

Although google cardboard does not come with a controller, it can be paired with different Bluetooth controllers that support the cell phone, which is being used to show the experience in virtual reality. On the other hand, the Oculus has the “Oculus Touch” controllers, which have a ring system to be detected by the cameras, besides Oculus has also incorporated a hand tracking system, using machine learning and “model-based tracking” to recognize the gestures and the position of the hands.

VR Room

The application to port is an escape room type virtual reality game, in which the player must solve some puzzles until the projector of a base located on the planet Mars is activated.

Link to the game repository

This video game was built on the Unity graphics engine using the Google Cardboard SDK, for Android mobile phones. To control the interactions, and because Google Cardboard does not offer any controller, the cell phone must be paired with a wireless controller, the one used for the development of this application was the T-3 wireless controller, very similar to that of a Play Station.

This controller was added so that the user can perform the actions of moving (forward, backward, right, and left), grabbing objects, throwing objects, rotating objects once they are grabbed, and teleporting.

Porting From Cardboard To Oculus

Having understood the difference between the platforms and the operation of the application, we can begin to talk about the considerations for porting it.

To begin with, the great similarity that these platforms have is that both can be developed in Unity, the SDK’s of both can be integrated very easily, it is only a matter of downloading some files, and changing some configurations, which makes it much easier to port the code. On the other hand, the Google Cardboard SDK used in this project is not completely compatible with other plugins and generic standards to develop on multiple platforms such as OpenXR, so the code is very specific for this platform, in fact, it is already obsolete for future versions from Unity. In addition, some assets and scripts that come by default, with this SDK, were used to move the camera and to use the pointer, which could not be ported to Oculus.

One of the main differences that Oculus and Carboard have are the inputs and controllers. Since cardboard only has three degrees of freedom, a controller must be used for the application to add another two degrees of freedom (forward / backward, left/right), the code for this was made from scratch, since no plugin was found or a library to help me to do it. In Oculus this would be much easier since it has 6 degrees of freedom, in addition to controllers and hand tracking, with plugins and libraries, which allow them to be integrated without writing a single line of code. Therefore, in terms of inputs and controllers, you should eliminate the code that was originally written for cardboard, and use the scripts and assets that are predefined for Oculus.

As previously mentioned the Vr room was developed in Unity, using the built-in render pipeline, which offers a medium graphic quality so that the applications can run on smartphones. Therefore it should not be a problem to port it to Oculus since it supports graphics of a higher resolution and quality. In fact, you could use a pipeline with higher graphic quality, and use textures with a higher resolution, to improve the experience, but this may mean more work, and it would even be much better to write the entire application from scratch if necessary.

The Oculus headset is optimized to run virtual reality applications, unlike cell phones that with less powerful hardware, runs more applications in the background, such as WhatsApp calls, messages, etc … This can be a problem, which can cause lags and hick-ups, and become in an unpleasant experience for the user. Porting the application to Oculus would save these and other performance problems that may arise, in fact, much more complex mechanics and interactions could be added.

Finally, all the interactions with the objects were carried out, thinking of using the Bluetooth joystick T-3, this led to modifying the default inputs that Unity has so that they would adapt to it, besides basing part of the logic on it as well. For example, to grab an object the L2 or RightAlt trigger is used, once the object is caught, it can be rotated with the right analog Joystick. Although Oculus has controllers with very similar buttons, before porting the code it must be taken into account if the keys between controllers coincide, also, objects are not normally rotated in Oculus with an analog joystick since the controllers detect the movement of the hand of the user, once the user grabs an object, for which it is only necessary to move the hand and the object will move with it, further, the hand tracking system could also be used to grab the objects, and thus make the most of the platform, and develop a much more immersive experience.

Conclusion

Google Cardboard and Oculus quest are very different headsets, with different SDKs, which can make the code portability between them a bit confusing, although at first glance it seems that it can be ported very easily because it is made from a device less powerful to a more powerful one, certain factors must be considered. Carboard sometimes requires that the code is written for it to be very specific, especially if other types of controllers are added, in addition, we really would like to port a low-requirements application to a device that can run much more complex and immersive experiences? feels like buying a Ferrari to drive around the house. Personally, I think you can port virtual reality applications from Cardboard to Oculus, but to get the most out of the platform, it is better to do it from scratch.

References

--

--