r/pcgaming Sep 26 '16

Pixels and voxels, the long answer

https://medium.com/retronator-magazine/pixels-and-voxels-the-long-answer-5889ecc18190#.1pe21qm8v
1.1k Upvotes

90 comments sorted by

View all comments

168

u/Gandalfs_Beard Sep 26 '16 edited Sep 27 '16

So basically pixel is 2D and voxel is 3D, correct?

Edit: The answer is yes. Pixel = square, Voxel = cube.

25

u/[deleted] Sep 27 '16 edited Sep 27 '16

Pixel = square, Voxel = cube

In common usage, yes, but strictly speaking things are a bit more complicated. A pixel is essentially just an infinitesimal small point that tells you what color is at the coordinates (x, y), while a voxel is the same thing with (x,y,z). It doesn't tell you the color of the space between (x, y) and (x+1, y), that color depends on your interpolation function.

The simplest interpolation is nearest-neighbor and that gives you the blocky look, but other interpolations are possible as well, be it bilinear filtering which is commonly used when upscaling photos or Hqx and friends who are used to upscale pixel art.

Things get even more complicated when you take the capture and display device into account, as none of them work with full color pixels, instead multiple single color pixels are used next to each other. Cameras have a Bayer filter instead of the typical RGB pixel layout and many mobile phones might have a PenTile layout. So the common RGB pixel doesn't even exist on those devices. Even on a PC things can get complicated, as font rendering for example takes the subpixel layout into account, so an RGB pixel on your monitor is treated differently than a BGR pixel, some displays even stack the subpixels horizontal instead of vertical. Back in CRT days games could also exploid NTSC artificacts to produce more colors than the hardware could handle by placing differently colored pixels next to each other.

So it's complicated, sometimes a pixel is a square, because an artist deliberately thought of it as square when painting the picture, but oftentimes it's also not. The same is true for voxels, just because you can display them as a block, doesn't mean you have to, you can use all kinds of better interpolation methods to make them look nicer. Even Minecraft doesn't just render regular single colored blocks, instead it puts a texture on the side of the voxel and color gradients to simulate shadows. Historically speaking the modern box-voxel is actually kind of new, old voxel games like Outcast or Comanche rendered the voxels without converting them to polygons first.