|See what's going on with flipcode!|
Question submitted by (03 November 1999)
|Return to The Archives|
I'm trying to create my first game and have decided to try making an RTS
(staring off simple, but making it better and better as I learn more about programming
an RTS)... Anyways, what I was wondering, I've never really been busy with 3D graphics, but
I'm always astound by how voxels look, it makes terran look good, etc... But to get to my
real question, all the voxel code examples that I found on the web have a 'horizontal'
view, never from above or from an angle... Is an above view or a view with an angle
possible with voxels ? And would you recommend voxels, if a view from above would be
possible, or would you say go for the 'simple' polygons to generate the terrain?
I could probably figure this out by myself, but if it's not possible, then asking would save me a whole lot of figuring out...
I'm not an expert on this by any shot since for now hardware acceleration
of triangles seems to be the track everything is taking. Perhaps some day
voxels can be revisited since they have some intriguing possibilities, but
I don't think that time is now.
First of all, beauty is in the eye of the beholder. I've never thought that "voxels" looked that good, but others swear by them. Go figure. As far as your question, you've been mislead by terminology. What many games and demos call "voxel rendering" is really just a 2D height field with a custom renderer. A true voxel is a 3D pixel (I seem to recall that the word voxel is the combination of volume and pixel) and they are capable of much more impressive things that the simple height field renderers. True voxels are typically used for medical imaging where they take a CAT scan of a human brain (for example) where they get not only complete description of the outside of the brain, but the inside as well. This allows them to take cross sections through the brain and display them. Other really cool uses would be for real volumetric fog.
You can think of "fake" voxel rendering as taking a 2D (1024x1024 for example) image and looking at it from the side. Each "pixel" in the image works like an offset from the bottom of the display and the rendering algorithms rely on this so they can do things quickly. This is why you can turn left and right, up and down, but can't tilt. Adding that extra dimension would dramatically complicate the rendering routines and slow it to a crawl.
A true 3D voxel uses a 3D map (1024x1024x1024 for example) to represent the volume. This allows a very complex area to be described, but at the cost of enormous memory requirements and non-trivial rendering. These maps can be rendered with polygons through the use of things like the (sadly patented) marching cubes algorithm, or through ray-tracing.
Response provided by Tom Hubina
This article was originally an entry in flipCode's Fountain of Knowledge, an open Question and Answer column that no longer exists.