Python and VR

Python and VR

The Oculus Rift, HTC Vive, and other headsets showcase how far virtual reality (VR) technology has advanced in recent years. Falling prices and increasing performance combine to finally put truly immersive digital experiences within reach of many consumers.

VR requires more than just headsets, as headsets, haptic controllers and all the other hardware are tools for delivering and interacting with VR content. That content needs to be run on, built by, deployed with, and developed by software.

Just as we saw with AI, where advancing technology meets software, you’ll often see Python.

Where Python Currently Fits in

According to an article published last summer by TechRepublic, Python is one of the top 7 programming languages used for VR and augmented reality (AR), coming in at #5.

Given the need to deliver high display resolution at high framerates, process multiple sensor inputs, and provide almost instant response, it’s no surprise that C/C++ ranks higher on that list (#2) since those languages are compiled to machine code and decades of research and investment into C/C++ compilers and other tools have made it easier for that code to run more efficiently (e.g. by employing compiler optimization tricks). That makes C/C++ great for VR game engines.

VR is not just for lower level languages, though. Higher-level languages like C#, Java, JavaScript, and Apple’s Swift appear on that list as well. That’s because VR and augmented reality (AR) require more than just high performance—they also need a robust software ecosystem.

What VR Software Uses Python?

As readers of this blog already know, Python combines an open and transparent development process, an open-source codebase, a rapid learning curve, a robust standard library, and an extensive ecosystem of third-party modules. All of these features make Python extremely attractive as a scripting or interface language for applications, including VR development and research tools.

For starters there’s BlenderVR, which is a project which brings the Blender Game Engine to multiple VR hardware platforms and configurations. Blender VR is written in Python. The Blender Game Engine is a component of the full-featured Blender 3D  content creation software (a VR development tool in its own right), which features a Python API.

The VR research and development platform Vizard utilizes Python (version 2.7) for scripting. Like BlenderVR, Vizard aims to deploy VR content across a wide spectrum of hardware, including 3D displays, motion trackers, gloves, and head mounted displays (HMDs).

Python is also used in industrial applications of VR and augmented reality (AR). Autodesk’s 3D visual prototyping and visualization software, VRED, includes many Python functions for VR use.

Python runs on many different operating systems, and includes bindings for important graphics software like OpenGL. These two facts together may be a large part of the reason why Python is so popular for VR platforms and 3D-related software in general.

So the next time you’re enjoying an awesome AR experience at a world-class museum, or enjoying some quality time with your Legos, just remember that Python may have made it possible.

Copyright © Python People