0

I found this (http://www.flipcode.com/voxtut/) example of terrain rendering algorithm based on voxel technology and converted it to "full 3d" renderer. I mean, that in heightmap there is only one z(up) coordinate for a pair (x,y) and in "real 3d" there are many.

I have done this by adding new "z" layer to ordinary x,y map. In example, I have a dataset:

data[x][y][0] = 0;
data[x][y][1] = 10;
data[x][y][2] = 50;
data[x][y][3] = 100;
data[x][y][4] = -1;

That means, what there are visible voxels with coordinates x,y,z where 0<=z<=10 or 50<=z<=100. So I draw this dataset in similar they as it is described on flipcode.

This is my program (pretty slow), and this is final rendering.

I have some problems with this approach.

  1. In this algorithm objects is drawn by long stripes which are parallel to the screen (because we travel through screen by adding 1 to horizontal screen coordinate and constant dd to distance between the camera and a point on the ray). Where we have spaces between drawable objects, there are these ugly zigzags too. Can I easily draw objects with something else (cubes, in example) instead of these stripes? Or maybe there is another way to make better quality?

  2. Since a ray does not draw a column on the screen (it draws vertical line segments instead), it is difficult to determine which pixels on screen are already drawn and which are not. Is there anything to do with it?

Is there any paper on this topic or any ready algorithm described?

  • @EsotericScreenName I'll try to tell in short, how rendering is done. Each column on the screen corresponds to a ray. Renderer travel across the ray and projects it onto my extended heightmap. (As I said, the only difference between my dataset and heightmap is that heightmap has only one z value for pair (x,y) and my dataset can have many z values. -1 in example above is terminator) (x,y,z) -> (x,y,0). Than it looks if there are any visible voxels with such x and y coordinates and gets it heights. Than, knowing distance to voxel, it restores vertical screen coordinate. – shamaz.mazum Aug 24 '12 at 18:04
  • @EsotericScreenName I know, than I am not first, who ask this question, but I'd like to know, how Ken Silverman's voxlap works. Voxels is show by nice cubes in voxlap, not just by rectangles as in my example. Is there some special function, what draws rectangles, or they can be achieved in more natural way? – shamaz.mazum Aug 24 '12 at 18:17
  • Thanks for the explanation. Unfortunately, I don't think I'll be any help with your question. – Esoteric Screen Name Aug 24 '12 at 18:31

0 Answers0