Fisheye OpenGL Quake

Fisheye view mode for QuakeForge in OpenGL.

1024x768, 250 degrees FFOV. More screenshots.
Original idea and software renderer implementation by Wouter van Oortmerssen.
OpenGL and software Fisheye is merged into QuakeForge CVS 2003.01.15.
Source patch against QuakeForge 0.5.2 - quakeforge-0.5.2-qlfisheye.diff + correction fisheye-cube-map-clamp.diff.
Fisheye implementation using vertex program (shader), much faster, need more work.

Quake2 version of gl_rmain.c.

Operating Fisheye

Change to fisheye mode with "fisheye 1" command in console. Set field of view with "ffov VALUE". Set number of views (left/right/top/bottom/behind) with "fviews NUMBER" where NUMBER is in 1-6 interval. Additional optimization performed when setting ffov:
if ffov < 130
    fviews = 3
else if ffov < 220
    fviews = 5
else
    fviews = 6
You can always force fviews to value you like after setting ffov, there are no restrictions.

Notes

  • OpenGL card should be capable of GL_ARB_texture_cube_map extension. Watch for console message after enabling fisheye.
  • As cube map suggests every view should be rendered square and both FOVs (X and Y) are set to 90 degrees. Texture side size should be power of two. The size is chosen as maximal number which is a power of two but less than max(screen width, height). Theoretically we can render with GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB texture size, but if texture is bigger than screen, it seems that part of it is missing. For optimal performance/quality we should take in account FFOV and estimate required dimension. Smaller FFOV require bigger texture, because only front, left and right box surfaces contribute to final image. Bigger FFOV relax size requirements cause top, bottom and even behind surfaces come to play. In general, 512x512 texture is good in 1024x768 and 800x600 with FFOV 200+ degrees. 640x480 looks blurred cause 256x256 texture is used and require FFOV at least 250 degrees to become acceptable.
  • Player roll is disabled, proper implementation without visual artifacts require more sophisticated approach to modelview rotation.

Fisheye OpenGL Cube

Fisheye view mode for Cube (1).

More screenshots, 5 views, 260 degrees fov.
Source patch against Cube source released 2002.10.20 - cube_2002_10_20-fisheye.diff. Optional patches: cube_2002_10_20-fisheye-Makefile.diff - UNIX Makefile with more optimization flags and static binaries; cube_2002_10_20-fisheye-new-h.diff - use #include <new> instead of new.h (gcc complains); cube_2002_10_20-fisheye-autoexec-cfg.diff - additional autoexec.cfg options to enable and tune fisheye.
This Fisheye implementation is different from Quake Fisheye. While Quake use OpenGL cube map extension, this one does not. Instead of mapping screen coordinates to cube, it performs reverse transformation. For every cube side, it iterates through texture with fixed step and calculate on-screen coordinates, then draw polygon.

Applying patches

Get Cube source and unpack. Go to source directory and unpack src.zip. Files have DOS style \r\n end of lines, you need to correct this or patches won't apply. In Linux do something like the following (bash type shell):
for f in *.cpp *.h; do tr -d \\r < $f >f; /bin/mv -f f $f; done
Apply fisheye.diff:
cd src
patch -p1 < path/to/cube_2002_10_20-fisheye.diff
Optional patches are, well, optional, but you need new commands in autoexec.cfg anyway:
fisheye 1          // enable fisheye view
ffov 260           // default fisheye field of view
// number of views, 1-6
// set to 4 to enable top
// set to 5 to enable top and bottom
// set to 6 if ffov > 270 to enable behind view
fviews 3
// 'distance' to fisheye view in 'percents'
// 40 is suitable for standard 100 fov in 4x3 videomodes
// in general bigger ffov and smaller fov require bigger
// distance
fdistance 40
// use OpenGL extension if available
// in this texture mode edges between box surfaces will
// be invisible
// benchmark to find do you need it
// should be set before switching to fisheye mode
fisheye_rect_nv_ext 1
Build Cube, move cube_client to your cube/bin_unix/ directory and try it.

Panoramic OpenGL Quake

A port of PanQuake to QuakeForge.
Source patch against QuakeForge 0.5.2 - quakeforge-0.5.2-panorama.diff.
Original readme and diff.
Change to panorama mode with "pan 1" command in console. "slices 20" sets the number of screen subdivisions.

Fisheye software Quake

A port of Fisheye Quake to QuakeForge.
8bpp software renderer. Source patch against QuakeForge 0.5.2 - quakeforge-0.5.2-fisheye.diff.
Original readme and diff.


Arkadi.Shishlov at gmail.com