Hacker News
Voxel Space
nine_k
|next
[-]
For 1992, this was mind-boggling though.
cubefox
|root
|parent
[-]
bastawhiz
|root
|parent
[-]
In fact, an octree for this approach would be _meaningfully worse_ because finding "the topmost voxel" in each column is O(logn)—or maybe worse?—versus O(1) for a height map. With no benefits, because you never look at any other voxels.
binarymax
|next
|previous
[-]
totetsu
|next
|previous
[-]
mondainx
|next
|previous
[-]
karmakaze
|next
|previous
[-]
a1o
|next
|previous
[-]
tdeck
|next
|previous
[-]
blaze33
|next
|previous
[-]
mthoms
|next
|previous
[-]
I remember figuring all this out as a self-taught teenager (pre-internet) with some books, a whole lot of time, and only a high-school level understanding of trigonometry. I built different versions - first in Pascal, then C, then Assembly.
Figuring out the algorithm was hard, but one of the optimizations I was most proud of was inventing (or so I thought) lookup tables to get around the slow floating point multiplication of my 16MHz 80286 CPU. I also remember "inventing" (ha!) the old bit shift + add technique.
There was something immensely satisfying about squeezing every last drop of performance out of a machine.
Nothing ever came of it. It was more or less a demo, but man did it make me feel like I accomplished something magical. I'd give anything to have a look at that source code today, but this post is the next best thing. So thanks for sharing. This made my day.
Jare
|next
|previous
[-]
Wait why do they say painter's algorithm. Comanche and other such voxel terrain engines went front to back and never had overdraw.
s-macke
|root
|parent
|next
[-]
swiftcoder
|root
|parent
|previous
[-]
knome
|root
|parent
[-]
swiftcoder
|root
|parent
[-]
knome
|root
|parent
[-]
it tracks how tall each columns write is so you can use it to only write the diff between it and the voxel behind it, skipping writing anything at all if the voxel behind is shorter than the current height.
So once you're done rendering front-to-back, you've got a y-buffer of highest-writes you can slap your blue sky across from highest-to-screentop on each line, avoiding the need to clear by write the sky to the full screen before starting the render.
esafak
|next
|previous
[-]
davrosthedalek
|next
|previous
[-]
taneq
|next
|previous
[-]
mthoms
|root
|parent
|previous
[-]
I vaguely remember there was something about the VGA architecture of the day that made this approach much slower, but I might be misremembering. My recollection of it is fuzzy. I'm hoping someone will chime in to remind me what I might be thinking of.
It might also just have been that this approach didn't work well with my lookup table optimization (see my other post).