One of the non game related possibilities that I see for VR devices like the oculus rift, is for example a widget on a real-estate website where you can view rooms in 360 degrees. A case that I also described in my blog post about building an online virtual classroom.

Equirectangular what?

I don’t think that modelling every room in 3D is realistic, especially if you keep time and cost in mind. I do see a future for kinect like devices (like the Occiptal structure sensor) where you will be able to scan complete rooms and that once they can improve the resolution of those kinds of sensors.

But for now the best thing that is available is taking equirectangular photographs and mapping them on a 3D sphere. In that way you don’t need to fiddle with UV mapping as it will map quite naturally. In a sense it’s a lot like how Google Streetview works.

photosphere_3d.jpg

There are numerous ways you can create these kinds of photographs. You can use a DSLR equipped with a fisheye lens, your Android smart phone, Microsoft Photosynth on your WP/iOS device or any of the numerous devices that have been kickstarted or are available on the market.

Everything that can create equirectangular photographs.

Easy as pie

To be honest when I started fiddling I was under the impression that it would take some time to come to a workable solution. But in reality it took me less than an hour to develop a workable viewer. Off course a lot has to do with the fact that BabylonJS does take a lot of work out of my hands.

photosphere_3d.jpg

In essence the only thing you do is create a big textured sphere and you position the camera inside that sphere. The only trickery is that as the babylonjs engine doesn’t support double side faces, you need to enable backface-culling. Scaling with a negative x value of -1 should also work.

Source code & attributions

A working demo can be found here. You can use the mouse and keyboard to rotate in the scene. The source code can be found on my github account.

The photograph that I used and is shown above is taken by a photographer named Klaus Pagel, who shared it under a CC license.