This is a post about Vrui

I just released version 3.0 of the Vrui VR toolkit. One of the major new features is native support for the Oculus Rift head-mounted display, including its low-latency inertial 3-DOF (orientation-only) tracker, and post-rendering lens distortion correction. So I thought it’s time for the first (really?) Vrui post in this venue.

What is Vrui, and why should I care?

Glad you’re asking. In a nutshell, Vrui (pronounced to start with vroom, and rhyme with gooey) is a high-level toolkit to develop highly interactive applications aimed at holographic (or fully-immersive, or VR, or whatever you want to call them) display environments. A large selection of videos showing many Vrui applications running in a wide variety of environments can be found on my YouTube channel. To you as a developer, this means you write your application once, and users can run it in any kind of environment without you having to worry about it. If new input or output hardware comes along, it’s Vrui’s responsibility to support it, not yours.

In more detail, Vrui’s core idea is to fully separate applications from the details of the underlying environments, including what output devices there are (2D monitors, 3D monitors, multi-screen projection systems, head-mounted displays, any mixture thereof, …) and, even more importantly, what input devices there are. Unlike lower-level device abstraction layers such as VRPN, Vrui not only hides differences between different brands or makes of similar devices (such as Polhemus 6-DOF trackers vs. A.R.T. DTrack 6-DOF trackers etc.), but also differences between vastly different input modalities, such as between a regular mouse and a multi-device 6-DOF tracking system. As a result, Vrui applications are truly portable: the exact same application code will appear to run natively on desktop systems as well as CAVEs and anything in-between. To use an analogy from the 2D world: Vrui is to VRPN et al. like Qt is to the X Window System.

In practice, this makes Vrui an excellent testbed for experimenting with new input devices, input device types, or interaction metaphors. By implementing a driver or metaphor only once, it can immediately be tested with the complete suite of existing Vrui applications.

Additionally, Vrui is also great for writing quick test applications for new graphics algorithms and the like, due to its low code overhead and powerful abstractions. To wit, the following is the complete source code (some comments removed) for a small Vrui application that draws a red cube and a blue sphere. The source contains no reference to output or input devices, yet runs in any environment and offers full interaction, including several different viewpoint navigation interfaces, ability to measure 3D positions or distances, draw free-hand in 3D, etc.:

#include <GL/gl.h>
#include <GL/GLMaterialTemplates.h>
#include <GL/GLModels.h>
#include <Vrui/Vrui.h>
#include <Vrui/Application.h>

class VruiDemoSmall:public Vrui::Application
    {
    /* Constructors and destructors: */
    public:
    VruiDemoSmall(int& argc,char**& argv);

    /* Methods from Vrui::Application: */
    virtual void display(GLContextData& contextData) const;
    };

VruiDemoSmall::VruiDemoSmall(int& argc,char**& argv)
    :Vrui::Application(argc,argv)
    {
    /* Set the navigation transformation to show the entire scene: */
    Vrui::setNavigationTransformation(Vrui::Point::origin,Vrui::Scalar(12));
    }

void VruiDemoSmall::display(GLContextData& contextData) const
    {
    /* Draw a red cube and a blue sphere: */
    glPushMatrix();

    glTranslated(-5.0,0.0,0.0);
    glMaterialAmbientAndDiffuse(GLMaterialEnums::FRONT,GLColor<GLfloat,4>(1.0f,0.5f,0.5f));
    glDrawCube(7.5f);

    glTranslated(10.0,0.0,0.0);
    glMaterialAmbientAndDiffuse(GLMaterialEnums::FRONT,GLColor<GLfloat,4>(0.5f,0.5f,1.0f));
    glDrawSphereIcosahedron(4.5f,6);

    glPopMatrix();
    }

/* Create and execute an application object: */
VRUI_APPLICATION_RUN(VruiDemoSmall)

Here’s a video showing what Vrui does with these 28 lines of code: (Video coming soon).

I’m intrigued; what are the requirements to run Vrui?

Most importantly, Vrui runs on UNIX-like operating systems, primarily any version of GNU/Linux, but also Mac OS X. To put it in a different way: Vrui does not run on Windows. As for hardware, you will need a PC with a somewhat decent graphics card (like some model of Nvidia GeForce or ATI/AMD Radeon). As Vrui is meant for high-performance 3D graphics, it doesn’t work well (or, rather, not very fast) on software renderers like Mesa or on-CPU graphics adapters like Intel’s HD Graphics. Under Linux, it is also highly recommended to install vendor-supplied graphics drivers such as Nvidia’s closed-source driver blob.

Vrui also requires several supporting system libraries, and benefits from several optional system libraries that unlock additional features. The full list of libraries and packages, and scripts to automatically download them all and then install Vrui, can be found in versions for Fedora and Ubuntu on the Vrui download page.

Other than that, Vrui doesn’t need anything special. While it supports a wide range of input and output devices, it works perfectly fine on “normal” PCs with only keyboard/mouse and 2D monitors. Of course, to really get the benefits of Vrui’s portability, you want something a little more exotic. Start with a 3D TV, or an Oculus Rift or other head-mounted display, then add a joystick, a spaceball, a Wiimote, or a Razer Hydra 6-DOF tracking device, and now you’ve got a stew going. Or maybe add all of these at once — it works, too. Found a Polhemus Fastrak and a pair of Fakespace Pinch Gloves at a garage sale? No problem.

“Serious” applications are nice and all, but can I develop games on Vrui?

Sure, why not. But you have to keep in mind that Vrui is not a game engine. It’s an infrastructure on which one could develop a game engine. Here’s what’s not built in: support to load 3D geometry in a variety of mesh formats; collision detection; physics simulation; animation; artificial intelligence; scripting; asset management; etc. Conceptually, all of these things would be layered on top of Vrui, and some of them already exist as such extra layers. It would be nice to layer an actual existing game engine on top of Vrui, but that’s typically difficult in practice, as game engines tend to be vertically integrated. This means they want to take care of everything including window management and input devices, and that obviously clashes with Vrui’s responsibilities.

How is Vrui licensed?

Vrui is released as free software under the GNU General Public License, version 2. The bottom line is this: you can do whatever you want with Vrui, but if you build a software product with it and release that software product to third parties, you have to license it to them under the GNU GPL as well, which implies that you have to give them the source code of your product to do with as they please in turn. More information can be found here.

I’m still with you. So, how do I actually build and configure Vrui for my Oculus Rift?

Check out the next post for a detailed how-to guide.

4 thoughts on “This is a post about Vrui

  1. Pingback: Setting up Vrui for Oculus Rift | Doc-Ok.org

  2. Pingback: Gemischte Links 13.08.2013 | 3D/VR/AR

  3. Pingback: Happy birthday, doc-ok.org! | Doc-Ok.org

  4. Pingback: Introductions – CatbirdAR

Please leave a reply!