Posts: 1,556
Threads: 298
Joined: Dec 2002
How the heck do you display voxel sprites? I'm sure making an editor to make the voxel information is quite easy, but how the heck are they done?
I have very basic SIN COS and TAN knowledge. (thank goodness I have ANY)...
Posts: 47
Threads: 5
Joined: Dec 2003
voxels are just dots in 3d space. consider them as vertices. standard matrix rotation, scaling and translating can be applied to voxels. check out CosmoX's demo proggies.
the major problem in freeform voxel objects is the hidden surface removal.
you can try to sort them by Z values or code Z-buffering algorithm.
I think it's better to use polygons instead of voxels to describe objects.
ll formed pragma
Posts: 1,556
Threads: 298
Joined: Dec 2002
Quote:the major problem in freeform voxel objects is the hidden surface removal.
THERE, is the problem for me. How the heck do I tell the program which pixels to draw over / not draw at all at different angles? I have no idea how to determine whether or not an object is behind something.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Well, for each frame, you have to take all your voxels and order them according to the distance to the camera. Once you've ordered your voxels you begin drawing from the furthest to the nearest.
Posts: 47
Threads: 5
Joined: Dec 2003
or try z-buffering stuff.
make two layers. the draw layer and Z-buffer. both'll take 64kb.
then round the z-values of voxels in the way they can have values from 1-255. 0 is empty.
- put a pixel to z buffer. the color is the rounded Z-value
when you draw a new voxel, check with CSPoint (or similar) the previous Z-value of the pixel.
if it's zero or greater than the z-value of the voxel which currently about to be drawn, CSPset (or similar) the pixel to the actual draw-layer, and update the z-buffer (with pset) with the new rounded z-value.
this is very efficent (it'll always draw the object in the right way) but it has an overdraw problem. you can for instance use object-based sorting and then use the z-buffer when you draw a single object.
ll formed pragma
Posts: 1,556
Threads: 298
Joined: Dec 2002
Quote:or try z-buffering stuff.
make two layers. the draw layer and Z-buffer. both'll take 64kb.
then round the z-values of voxels in the way they can have values from 1-255. 0 is empty.
- put a pixel to z buffer. the color is the rounded Z-value
when you draw a new voxel, check with CSPoint (or similar) the previous Z-value of the pixel.
if it's zero or greater than the z-value of the voxel which currently about to be drawn, CSPset (or similar) the pixel to the actual draw-layer, and update the z-buffer (with pset) with the new rounded z-value.
this is very efficent (it'll always draw the object in the right way) but it has an overdraw problem. you can for instance use object-based sorting and then use the z-buffer when you draw a single object.
...I will never do voxels.
Ever.