Alright, everyone think back two months, before I discussed landscapes and "fixed" VOXEL.BAS, long, long ago when I gave you the voxel-editing program to create your own voxels. Well, a lot has ahppened. Syn9 has released his voxel viewer. His uses a very similar format to the one I gave out two months ago, and with only a few changes they are interchangeable. In fact, there is a program that can change them, load them, save them, edit, and do a lot of other cool stuff! The downside is that it uses a totally different palette from the program I gave you at first.
Interpolation for Dummies =)
Now I'm getting ahead of myself, I haven't even defined a list voxel yet! Silly me. Well, you remember that editor that I presented in the first part, it saved and viewed images in a 3D grid. This allows for wonderful detail and very level performance, but the voxels are limited in size. The only way around this without creating humongous arrays is to switch to a list voxel - that is, instead of storing whether there is a voxel at a given location, you store every location that there is a voxel.
OK, now that we understand what a list voxel is, we can draw it. The image viewer that Syn9 released is fully capable of that - fire the puppy up with your favorite voxelmap and watch it go! Now look at it: the detail, the power of creating whatever you want, and look at how fast it is! On my Pentium 90, I get just about 6 fps for most voxels. For any kind of cumputer that's NOT obsolete like mine, voxels are playable, even in QBasic. Also keep in mind that this is a fairly crude implementation - by Syn9's estimates, the new version should run about 10 times as fast. That's fast.
A little information about the voxel formats before I let you loose: there are 3 different QB voxel formats in existence: the SVF format used by the voxel editor in part 1, which is the same as the .tmp files that you get from it (you can actually rename and interchange them, you just have to change the extention to SVF. There's VXF, which supports up to 22 x 22 x 22 voxelmaps and is also based on a 3D grid, and XVG, which is a list voxel format that is changeable in size, so long as ((xsize^2 + ysize) * ysize + zsize) < 13000.
A pic of syn nine's Editor
|Now that we have list
voxels I want to discuss twhat you can do with them. First, the pros:
list voxels can be larger, more elaborate, take less space, and in many
cases are faster to draw than their grid-based counterparts. They are
generally more versatile, lending themselves to particle physics and
path-based movement better, and animation methods not frame-based. The
cons: they typically have a larger data set, they're nigh impossible to
change, defining a definite limit is difficult, they can be slower, and
debugging them is a true nightmare. Case in point: the other example
program for this month was to be a list voxel loader that loaded a list
voxel and then exploded it... I couldn't get it to work. Apparently
either the loading or conversion code is screwy and I couldn't get
anyone to help me. I am hopeful that within a week I will be able to
release it as an addendum to the article. And now I want to discuss the
things you can do with list voxels: You can blow them up. I'm serious:
a particle explosion never looked so good. When the program is released
load up your favorite voxel character or madel and let her rip - you
can try your favorite character, object, powerup, villain, or whatever.
You can use the effect for more than death sequences though - (*LEAK
AHEAD*) One of the weapons from my upcoming game, Attack of the
Blobeteers, will be the Discumbobulator, which makes the enemy turn
into a bunch of pixels that kind of flutter away in all directions for
a minute before re-cumbobulating.
There are more things you can do. You could have something melt, or catch fire, or swirl into oblivion, or even change into a liquid that changes shape to match its container! The really exciting part it not necessarily the way to deform it but to animate it in more useful ways. Biped motion is one. It's possible to have heirarchial voxels, and if done right, one or more voxels could 'stick' to the floor while the rest of the voxel moves.... I'll save this for my series on physics though! No point spoiling everything!
In particular, I want to discuss interpolated model animation, which is a new technique aimed at smoothing out animation. Anyone who's played Quake on a really killer machine (>200 mhz) may have noticed that the models tend to jerk as they switch from one frame to the next. Because there are only a limited number of frames you can fit in and the FPS rate is really high, each frame is used several times in a row. This makes it appear choppy. However, if you you a frame that is "between" two frames that the current scene is between, rather than one or the other, you can make things much smoother. Smoother still, use a weighted average based on how far off this frame is from the scene and it appears smoothest of all - if you can pull it off. By this time you're probably using lots of math to do all this and for large models it can slow down a lot, bringing the framerate down to where it's no longer advantageous to use interpolation, that is, unless you have it optimized properly. In the new Vampira engine, developed by Syn9, it is actually fast enough that for even a lower-end pentium (>100 mhz) it's smoother than any frame-based animation out there. So, if you want to see this in action, wait for the new release of Vampira - it will no doubt rock the QB world.
Well, we covered a lot today, list voxels, file formats, and stunning new forms of animation. Join me next time to cover particles, and alternate methods of 3D projection.
Download syn nine's voxel editing program
Back to Top