Readme PTViewer3d-rt Fast realtime version of my depthmap-based Stereo-panoramaviewer PTViewer3d, see http://www.hs-furtwangen.de/~dersch . Windows (7, 64bit) and MacOSX (10.6.8) binaries are included and tested on those platforms. This version provides red-cyan Dubois-anaglyph view, other modes will be added. Realtime rendering requires a modest current gpu. My Nvidia GeForce GTX 285 from 2009 easily delivers 60 frames per second on 2K-displays. Usage: Drop the icon of the provided panoramic image "Panorama.jpg" onto the application's icon ("PTViewer3D.exe" for Windows, "PTViewer3D.app" for MacOS), and navigate the view by arrow keys, 'wasdxyz'-keys, zoom using '+-Tt'-keys, etc. A list of controls is displayed by hitting '?'. Notice, that unlike other stereoviewers you can rotate around the z-axis (viewing direction, keys 'xyz') while preserving stereoscopic view. Also, stereoscopic view is provided vertically up and down. Head motion parallax is simulated by a "wiggle" effect (key 'v'). Executing PTViewer3d on the commandline allows the user to set some more options, and see some diagnostics like framerate. On Windows, a command window has to be opened, on MacOS a terminal window. On MacOS use the executable "PTViewer" without ".app" extension. Calling syntax: PTViewer3D [options] -? [showinfo] show help and exit -h [showinfo] show help and exit -g [glinfo] show opengl info and exit -n [no_opencl] do not use opencl -b [no_gltex] if using opencl, do not use glTextures. -f imagefile input panoramic image -d depthfile input depthmap image -s stereobase in pixel, default 50 -w wiggle head motion parallax in pixel, default 4 During execution, the command/ terminal window displays window size and the current render framerate (frames per second, clipped to 60). This is not the display framerate but the rate at which the computer renders images. The actual display framerate is either this, or the screen refresh rate, whichever is smaller. Any equirectangular panoramic image (width/height = 2, formats see below) can be displayed. A depth map is a single-channel greyscale image with the same size as the panoramic image. It is either set on the commandline using the "-d"-option, or it is automatically loaded, if it has the same basename as the panorama extended by "_depth.png". Without depthmap PTViewer3d functions as a fast 2d-panoramaviewer. Depthmaps may also be supplied as alpha channel in the original panorama (RGBA, untested). How it works: PTViewer3d uses opengl to render most of the view. There are three basic steps performed for each frame: 1. A rectilinear 2d-view is generated using a spherical mesh, onto which the equirectangular panorama is applied as texture. A vertexshader calculates positions of mesh intersections, and a fragmentshader calculates rgb and depth values for each pixel position in the 2d-view, thus forming two images, rgb and depth. With the exception of the depth-part, this is the usual implementation of an opengl equirectangular panoramaviewer. All steps are performed on the graphics processor. 2. The depth image from step 1 is used to calculate a displacement map. By shifting the viewpoint to the virtual eye's position, each pixel has to be moved a certain amount. This amount is calculated in this step, and has to be done twice per pixel, for each eye once. In the current implementation, this step is performed in one of three choosable moduls: (a) The fastest method uses OpenCL with OpenGL textures. This is the mode which easily delivers realtime speed, i.e. more than 60 frames per second on 2K displays. This mode is automatically selected if the required resources are available. (b) OpenCL with OpenGL buffers (command line switch '-b'). Much slower, but the only mode available on some older OpenCL platforms (MacOS 10.6.8). (c) No OpenCL, instead do all calculations on the CPU (command line switch '-n'). In most cases similar or slightly faster than (b). 3. Finally, the displacement map has to be applied to the rgb-image calculated in step 1. This is done on the graphics processor by a vertexshader, which projects the image to a flat rectangular screen (quad), and a fragmentshader which applies the displacement twice (left and right) and combines both views to one Dubois-Anaglyph. Helpers and Tools: Programs are written in C, compiled and linked using the GNU-toolchain (Mingw64 on Windows, MacPorts on MacOSX). The Windows binary is linked against libglut.dll, which must always be located in the application's directory, or installed into the Windows system; for details of this library see this link: http://http://freeglut.sourceforge.net/ Image loading is handled by stb_image, see this link https://github.com/nothings/stb It handles the following formats (from the documentation): JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib) PNG 1/2/4/8-bit-per-channel (16 bpc not supported) TGA (not sure what subset, if a subset) BMP non-1bpp, non-RLE PSD (composited view only, no extra channels) GIF (*comp always reports as 4-channel) HDR (radiance rgbE format) PIC (Softimage PIC) PNM (PPM and PGM binary only) Dialogs and message windows are programmed using tinyfiledialogs.c by Guillaume Vareille http://tinyfiledialogs.sourceforge.net. Helmut Dersch der@hs-furtwangen.de Version 0.1: 1. Many more stereoscopic output formats supported. They can be selected upon startup via commandline or during exection using a contextmenu (right-click in viewport). Usage: PTViewer3d [options] -quad [quad] use quad-buffered 3d-display -int [interlace] use interlaced 3d-display, even rows right -int2 [interlace2] use interlaced 3d-display, even rows left -lr [leftright] use left-right 3d-display -rl [rightleft] use right-left 3d-display -lr2 [leftright_2] use left-right squeezed 3d-display -? [showinfo] show help and exit -h [showinfo] show help and exit -g [glinfo] show opengl info and exit -n [no_opencl] do not use opencl -b [no_gltex] if using opencl, do not use glTextures. -nfbo [no_fbo] do not use external framebuffers -db [doublebuffer] use double buffering -f imagefile input panoramic image -d depthfile input depthmap image -s stereobase in pixel, default 50 -w wiggle head motion parallax in pixel, default 4 2. Context menu added, which allows the user to set displaymode, stereobase, wiggle amount and load more images. Please note that switching from and to quadbuffered mode is not possible from the menu and has to be done on startup. 3. Fullscreen-mode added (toggle via 'F'). Fullscreen-mode conflicts with the tinyfiledialog-library I am using. Therefor, dialogs and menus are disabled in this mode. Aside from the 'F' toggle, fullscreenmode can always be left by hitting the escape-key, or exiting via Alt-F4 (Windows) or Cmd-Q (MacOS). 4. There are a few debugging options in case PTViewer3d does not work on a specific platform, The default operation mode is sinngle-buffered, use external framebuffer, use opencl and use opengl-textures, if available. Setting stereobase to 0 or not supplying a depthmap image bypasses all of the 3d-engine, and makes PTViewer3d an ordinary 2d-viewer.