
Pixels and voxels, the long answer - stevetrewick
https://medium.com/retronator-magazine/pixels-and-voxels-the-long-answer-5889ecc18190
======
danbruc
A Pixel Is Not A Little Square, A Pixel Is Not A Little Square, A Pixel Is Not
A Little Square! (And a Voxel is Not a Little Cube) [1]

[1]
[http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf](http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf)

~~~
infogulch
Honest question: If a pixel is a point sample, why do all the down-sampling
algorithms that look good involve some form of averaging the values of
neighboring pixels? Wouldn't it be more accurate to pick one sample and throw
away the rest?

~~~
dahart
It's a good question. The name for that - pick one sample, toss the rest - is
"nearest neighbor sampling". Whether it's accurate depends on what you are
trying to achieve, but the short answer is that in general it is not the most
accurate, and it can cause a lot of problems.

But your intuition isn't wrong. Nearest neighbor can be a bit more "crisp"
feeling on certain images, especially natural photos. A lot of photos have
enough blurriness in the 1-3 pixels range that nearest neighbor sampling is a
good choice if you're just resizing an image by a factor of 2.

But to see why nearest neighbor isn't the best in general, imagine down-
sampling a checkboard and what happens as individual checkers become smaller
than a pixel. You'll get moire patterns if you don't filter. You'd also expect
pixels to turn grey as multiple checkers land there, and maybe not stick to
only black or white.

Interestingly, some "sharpening" and up-sampling algorithms do the opposite -
they subtract the value of surrounding pixels, rather than add. Those are
assuming that some averaging already took place, and trying to un-average, if
you will, to restore the original point sample.

------
artursapek
A couple years ago I went to a small demo of a hologram machine called the
Voxiebox[1] at a bar in Brooklyn. One of the prototype demos[2] was a voxel
game called Voxatron[3] in real 3D. I was in an audience of maybe 5-10 people
and the prototype machine was a little crude, but it felt like I was getting
an early glimpse into the future of computers and gaming. The applications for
this kind of tech are exciting to think about.

Until that night I hadn't even imagined that holograms would ever become a
reality, and I had also never heard of voxels. It really made an impression on
me. I hope they succeed in making their machine viable for consumers because I
could tell how passionate they are about it, and how hard they've been
working.

[1] [http://www.voxiebox.com](http://www.voxiebox.com)

[2]
[https://www.youtube.com/watch?v=vs09W0FMQEo](https://www.youtube.com/watch?v=vs09W0FMQEo)

[3]
[http://www.lexaloffle.com/voxatron.php](http://www.lexaloffle.com/voxatron.php)

~~~
andrewflnr
How does it work? That website is... light on information.

~~~
abstractbeliefs
It's a swept-surface display, which is what you can see as arms blurring at
the edge of the display volume.

Essentially, the object to display is sliced up like you do for 3D printing,
and a screen of some sort is moved to the lowest Z position, and the bottom
slice is projected up onto it.

Then, the screen increments it's Z position, and the next slice is displayed,
repeating until the entire object has been displayed.

Thanks to persistence of vision, it appears as though the image is 3D and
floating.

~~~
artursapek
Good explanation.

------
DocSavage
Yeah, that is a very long answer to the original question of pixels vs voxels.
A pixel is a picture element (2d) and a voxel is a volume element (3d).

Also, it's not necessary to take the displayed path, i.e., triangulate a
voxel-based representation then use vector-oriented rendering methods to get
the displayed image. There have been lots of work rendering a 2d display by
ray tracing through voxel space or even directly splatting voxels into display
space.

A lot of research has been directed into efficient representations for large
collections of voxels. One really cool sparse volume system, OpenVDB, was open
sourced by DreamWorks: [http://www.openvdb.org/](http://www.openvdb.org/).
Nvidia has papers on sparse voxel octrees that work very well on GPUs:
[https://research.nvidia.com/publication/efficient-sparse-
vox...](https://research.nvidia.com/publication/efficient-sparse-voxel-
octrees)

------
bottled_poe
As a software engineer, voxel engine development has unique appeals to me over
traditional 3D game engines. It's something about the power you have to define
the entire game environment so simply but precisely I guess. Shameless plug -
I released a game called Voxelvoid last year which uses a voxel engine
(Voxatron was a significant inspiration). I've been developing the engine a
lot since then, maybe I'll blog about it at some point. It's still a side
project for now though.

~~~
smallnamespace
Wouldn't you have more precision by defining triangles by hand?

For example, voxels can't represent non-right-angle surfaces without adding
jagginess, while a triangle can.

~~~
juliendorra
Voxels can be volumetric, ie. each voxel have physical properties. Also, your
models are full of voxels, inside, each with its own properties. Mesh based
models are empty.

~~~
smallnamespace
Yes, but then you could accomplish the exact same thing with volumetric
polygons, with the added benefit that arbitrary polygons better approximate
any 3D shape.

~~~
dahart
What are volumetric polygons? And do they better approximate cubes? ;)

------
projektir
I can't take my eyes off of that "3D low-poly" racetrack thingy. So pretty.

I wonder how far someone could get with that artstyle in general, I haven't
seen it that often. There was that RTS game that used it, forgot the name..

~~~
Kiro
> I can't take my eyes off of that "3D low-poly" racetrack thingy.

Which one?

~~~
cosarara97
[https://d262ilb51hltx0.cloudfront.net/max/2000/1*MPsZ2w3Ms4i...](https://d262ilb51hltx0.cloudfront.net/max/2000/1*MPsZ2w3Ms4iSsxxXeFaTNA.jpeg)

------
pasta
Pixels and voxels are just coordinates in 2d and 3d space.

They can also contain meta information, like color and transparency.

To represent pixels or voxels on a screen you need to to render and
interpolate them. Because, if you have an image of 4 pixels that you would
like to show on a screen with 1080 leds, you need to interpolate the meta data
between those pixels.

------
devindotcom
Great article and nicely selected illustrations, super glad I read this. Nice
trip down memory lane (Delta Force!), and also looking forward to some of
these upcoming games.

------
wrong_variable
In my younger days, I used to play around with software like maya.

The best thing about voxels is what you can do with fluid simulations.

In Maya you could create a cube made up of voxels, each voxel had a fuel,
temperature etc variables.

You could start a fire from a single voxel, and watch is spread ! Changing the
values could make the fire behave differently.

I wish front-end javascript was that cool :( fire simulation on a computer is
so much more fun.

~~~
scsilver
Hey, Fire Engineer turned Software Engineer here, check this out.
[https://pages.nist.gov/fds-smv/](https://pages.nist.gov/fds-smv/)

FDS and SmokeView, are the defacto fire simulator tools used by fire
protection researchers/engineers around the world. Not only can you manipulate
the fuel sources, you can manipulate the environments and rooms and watch the
fluid and thermodynamics dynamics happen. Radiation, convection, conduction,
flow gradiants, for you to see and play around with.

[http://www.thunderheadeng.com/pyrosim/](http://www.thunderheadeng.com/pyrosim/)

Is a nice gui layer for FDS allowing you to import CAD files for your
simulations and gives you some visual control rather than programming in
Fortan for FDS.

~~~
wrong_variable
Fire Engineer sounds way cooler than software engineer !

~~~
scsilver
Well I hope to swing back into it in a decade or 2 after learning the software
buisness. The goal is to modernize the current tools and leverage advancements
in machine learning to help the industry.

------
fryguy
I would say the only thing this slightly misses is the pseudo-3d models that
Wolfenstein/Doom used. It got the terrain part, but not the somewhat clever
thing where the characters were a series of 8 or so sprites that changed which
one it displayed based on orientation.

~~~
shahar2k
If you want a neat / more advanced version of that technique, check out an old
game by looking glass software called terra nova, it uses a skeletal animation
system but with sprites for each bone in the skeleton.

~~~
digi_owl
Damn i played a demo of that game to death back in the day. Was never able to
get a copy of the full game.

The control scheme was a weird mix of simulator and shooter.

------
erikb
So, would you say Minecraft is a Polygon based game or a Voxel based game?

~~~
cosarara97
The map data is voxel based, but it's transformed to polygons when rendering.

------
mgalka
Great post! Clear, thorough explanation and fun read.

------
acz
They mentioned Vangers!

------
Joof
Why did I stop pursuing game dev?

~~~
kelvin0
Yeah, as a side project it's fun! As a job for some AAA title ... not so much
... (crunch,crunch,crunch)

~~~
Joof
Ah, right.

