<?xml version="1.0"?>
<!DOCTYPE content [ <!ENTITY nbsp " "> ]>
<rdf:RDF xml:base="http://snarfed.org/rdf"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/">

<rdf:Description rdf:about="http://snarfed.org">
  <dc:title> snarfed.org  </dc:title>
  <dc:description> draw group stream of consciousness </dc:description>
  <dc:creator> Ryan Barrett &lt;snarfed at ryanb dot org&gt; </dc:creator>
  <dc:language> en </dc:language>
  <dc:format> text/html </dc:format>
  <dc:rights> Copyright 2002-2007 Ryan Barrett </dc:rights>
</rdf:Description>

<rdf:Description rdf:about="http://snarfed.org/space/voxel">
  <dc:title> voxel </dc:title>
  <dc:creator> Ryan Barrett &lt;snarfed at ryanb dot org&gt; </dc:creator>
  <dc:date> 2003-01-01T05:00:00Z </dc:date>
  <dc:language> en </dc:language>
  <dc:format> text/html </dc:format>
  <dc:rights> Copyright 2002-2007 Ryan Barrett </dc:rights>

  <content>
    <p><a href="/space/voxel_hunt_mountain.jpg"><img src="/space/voxel_hunt_mountain_thumb.jpg" alt="/space/voxel_hunt_mountain_thumb.jpg" title="" /></a><a href="/space/voxel_hunt_volcanic.jpg"><img src="/space/voxel_hunt_volcanic_thumb.jpg" alt="/space/voxel_hunt_volcanic_thumb.jpg" title="" /></a></p>

<p><a href="/space/voxel.zip">Download
Voxel Hunt</a></p>

<ul>
<li><strong>Description</strong></li>
</ul>

<p>Voxel Hunt is a voxel landscape engine with a very simple game on top. This page
includes instructions for running, building, and playing Voxel Hunt, as well as
technical information about the engine.</p>

<p>Voxel Hunt is Copyright 2000, Ryan Barrett, and is distributed under the GPL.
See the LICENSE.txt file for more information.</p>

<ul>
<li><strong>Running</strong></li>
</ul>

<p>To play, download <a href="/space/voxel.zip">voxel.zip</a>, unzip it, and run
voxel.exe. You'll need OpenGL drivers for your video card, which you almost
certainly have, and GLUT, which is included in this package.</p>

<ul>
<li><strong>Controls</strong></li>
</ul>

<p><strong>Arrow Keys</strong>: movement (forward/backward and turning) <br />
<strong>Home</strong>: increase altitude <br />
<strong>End</strong>: decrease altitude <br />
<strong>M</strong>: teleport to Mountain planet <br />
<strong>V</strong>: teleport to Volcanic planet <br />
<strong>F</strong>: toggle FPS display <br />
<strong>I</strong>: toggle interpolation (smoother and not much slower) <br />
<strong>A</strong>: toggle autopilot (follow the terrain's altitude) <br />
<strong>Q</strong>: quit the game</p>

<ul>
<li><strong>Known Bugs</strong></li>
</ul>

<p>The renderer shows artifacts occasionally when interpolation is turned on. This
only happens in a few places, but it can easily be seen at the X-shaped islands
on each planet. As a workaround, you can turn interpolation off.</p>

<p>Also, the fps calculation is off. It's not exactly a showstopper, though.</p>

<ul>
<li><strong>Compiling</strong></li>
</ul>

<p>Voxel Hunt should build and run on any OpenGL platform. Unfortunately I
developed and tested only on Windows, so only a Win32 executable and MS Visual
C++ project files are included.</p>

<p>There are no specific build instructions. I only ask that you (please!) turn on
all appropriate compiler optimizations when building Voxel Hunt, since voxel
rendering is CPU intensive. The "inline any suitable function" is especially
good. Also, because of this, Voxel Hunt will run slower on older computers. A PC
with a Pentium II-class processor, 300MHz or faster, is probably the baseline.</p>

<ul>
<li><strong>Technical Info</strong></li>
</ul>

<p>Voxel Hunt uses a voxel renderer to display terrain that is higher resolution
than poly-based terrain on similar hardware. Voxel Hunt uses a heightmap to
generate its height field, and an interpolated color map that is generated from
the heightmap at run time. Each planet has its own interpolated color scheme.
Each planet also has its own sky, which is rotated to match the viewing angle.
Unfortunately, the sky does not scroll in parallax.</p>

<p>The rendering algorithm is a specialized ray surfing algorithm which assumes
convexity on the Y axis. This allows me to use a height map, since each point on
the ground can only have one height. The algorithm casts a ray for each column
of pixels on the screen. The ray is stepped through the scene until it
intersects a voxel column. The ray then surfs up the voxel column, and the
columns behind it, until it reaches a peak. The ray is then stepped until it
intersects another voxel column. This continues until the ray is off the scene
or it has been stepped a maximum number of times.</p>

<p>Since the scene data in Voxel Hunt is made of voxels and not polygonal surfaces,
OpenGL's poly routines cannot be used to rasterize the scene. Therefore, OpenGL
is only used as a graphics library to blit pixels to the screen - I wrote my own
framebuffer and call glDrawPixels only to draw a frame to the screen.</p>

<p>I wrote a number of renderers in the process of writing Voxel Hunt. I first
wrote a poly renderer that draws each voxel as a cube with 6 faces. Needless to
say, this was ass slow. I then wrote a number of raycasting algorithms before
settling on the "look angle" algorithm I use now. Two of the more significant
optimizations I wrote were a special fixed point data type (operations on it are
much faster than floating point), and a lookup table of cosine and sine values
for "look angles."</p>

  </content>

  <rdf:Seq>

<rdf:li>
<rdf:Description rdf:about="#1204736387.17">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> voxel </dc:title>
  <dc:creator> Stephen Whitmore </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Nicely done. I realize this is more than a few years old, but it's still interesting to check out other peoples' voxel renderers. I developed a small one recently (http://skirmish.dreamhosters.com/devlog/?p=77), although I found that -- after more than one attempt -- that ray surfing on a per-column basis doesn't seem to be the fastest algorithm. If one instead takes steps in the Z direction (away from the camera) and traces voxels from the left side of the screen to the right side, you end up with a constant Z distance value, which speeds up the rendering notably (since it's evading extra perspective correction divisions). Your method does, however, have a lot of potential for optimizations via terrain occlusion, since the single ray can be halted outright if occlusion is detected on it.<br />
<br />
In short: excellent work! Looking forward to any other voxel adventures you may choose to undertake. :)
  </content>
</rdf:Description>
</rdf:li>

  </rdf:Seq>
</rdf:Description>
</rdf:RDF>
