I guess everyone is familiar with the pictures of Google Street View: they are called 360 degrees pictures, or also panoramic pictures, or VR photos. They can be taken using a dedicated 360 camera, or a modern smartphone (it has to include a gyroscope sensor), or also a regular camera and a tripod, using a photo stitcher program like hugin. Nowadays, the easiest way is with a smartphone and the app Street View (that would basically do on the fly the stitching job, combining multiple pictures in one). Picture can be published immediately on Street View, but it is also possible to download it from the phone on PC: the picture is a regular image in jpeg format, just distorted, since it is in equirectangular projection.
Since OpenB3D handles equirectangular projections to apply textures to spheres, it is very easy to build a simple viewer in FreeBasic:
Code: Select all
#include "openb3d.bi"
screenres 800,600, , , &h10002
Graphics3d 800,600,32,1,1
dim as single pitch, yaw
dim as single zoom=1
var camera=createcamera(0)
var sphere=createsphere(20)
'flipmesh sphere
scalemesh sphere,-30,30,30
AmbientLight 255,255,255
entitytexture sphere, loadtexture(command)
do
if MultiKey(&h48) then pitch+=1
if MultiKey(&h50) then pitch-=1
if MultiKey(&h4b) then yaw+=1
if MultiKey(&h4d) then yaw-=1
if MultiKey(&h51) then zoom-=.01: CameraZoom camera, zoom
if MultiKey(&h49) then zoom+=.01: CameraZoom camera, zoom
RotateEntity camera, pitch, yaw, 0
renderworld
sleep 1
flip
loop until MultiKey(1)
You need OpenB3D to compile and use it. Once compiled, use as argument the panorama file you want. Arrow keys turn the view around, PgUp and PgDown set the zoom