|
|
By Alias
A L T E R N A T E P R O J E C T I O N |
Wow, since our start 3 months ago we have covered literally most every aspect of voxel animation! There is but one area left I want to cover: translucency. By now, if you have followed us through you may have tried your hand a creating your own voxel program to suit your fancy, and if you've tried transparent things you may have encountered a problem. Because the drawn portions of voxels overlap, the drawing gets uneven and in some places can even look plaid or worse. Problem? You bet. Voxel Render problems
On to alternate projections In the first installment of MA*SNART's 3D series, he gave us this algorithm for 3D projection:
x' = (((x - vx) / z) * 90) + vx
(I will call this FPS projection from now on, as that is what it is primarily used for. That is, ALL FPS games use this formula.) Where x' and y' are the projected coordinates of any point and vx and vy are the coordinates of the pixel in the middle of the screen. (Or they should be at least - if you ever have some free time you can play around with these and have some REAL fun.) The formula for isometric projection goes like this:
x' = (x - y) + vx
As you can see there is only one divide and everything else is add / subtract, making for a very fast algorithm. It's also amenable to all the same deformations FPS projection is - whatever you can do to a point there you can do to a point here and it generally looks just as cool. (The only thing I really miss is having the main character throw a missile right at the screen, and freeze-framing when the tip of the missile is so close to the nose of the player that my pentium's FPU can't tell they're apart at all so the missile is left there waiting to explode, and the player by this time has wet his pants because he _FINALLY_ made that big jump across the canyon and now, before he could hit quicksave, he's being destroyed by a pentium FP bug!!! But I digress.) The problem with this I mentioned earlier - it often makes things appear in the wrong position. Take this example: |
|
That looks, in the isometric world, like a long line of blocks but below is what it really is |
Screenshot taken from Attack of the Blobeteers |
Que? Believe it! The projection model has that one major flaw, that something in one position can appear to be in another. There is a very simple, very elegant way around it though - it's called rotation. Yes, it's true, if you rotate every point around the Z axis -8 degrees, it will make everything unmistakeable. Here's the formula to do that:
x' = cos(-8) * x - sin(-8)
Please note that the -8's in there need to be changed to -8 * (3.14159 / 180) because theta is in a different measure than degrees. Now that you understand projection in Isometric form and everything there is to know about voxels, my work here is done. On the 23d of this month you will see a fine example of isometric perspective, that is, a demo of my game, Attack of the Blobeteers. Thanks for reading and I'll see you on the release date.
|