About Me: I am currently a Computer Science major at San Jose State University.

Tuesday, December 10, 2013

Computer Graphics: Voxels vs. Polygons




During the 1990s, the video game industry had two competing methods for visualizing and building the virtual world of a game: voxels and polygons. Both had their upsides and downsides, but at the end of the day, polygons won out and now nearly every single modern game uses polygons to represent characters, objects, and the environment. But what are polygons and voxels, why did polygons win, and are voxels coming back into use?

http://upload.wikimedia.org/wikipedia/commons/6/65/Voxel-polygon-alleycats-v01.gif
Voxels on the left, Polygons on the right.
In order to define a voxel, we need to also define what a pixel is. A pixel is short for Picture Element, and they are used to represent a single point in an image. A computer monitor is divided into tens of thousands of pixels, arranged in columns and rows. There are very many pixels in any given monitor; you would be quite hard pressed to find a specific pixel. In monitors, each pixel generally stores some kind of color value, generally of the RGB type. A voxel is then short for Volume Pixel, which is essentially a 3D pixel. Voxels are generally represented by a cube, and each cube is one small part of a whole 3D image. Voxels together are used to simulate volume and give an image a quantifiable depth. Polygons, however, are quite different. First you start with at least three lines which connect a series of coordinates together. Each coordinate would have, depending on the type of game, an x, y, and z portion, which determine the shape of the polygon. You can then apply polygons to a wire frame skeleton of the object you with to model, then apply phong shading or a texture map to the shape to get a final object that a play can interact with.

So now that we all have a basic idea of what each type is, why did polygons beat voxels when it came down to designing a game world? The answer can be narrowed down to two reasons: memory and visual fidelity. When it comes to memory, polygons beat voxels with almost no effort. Since polygons are usually wrapped around a wire frame model, each object that uses polygons is completely hollow. We do not need to know what is inside the object, so the game generally does not bother putting anything in there, which saves memory. Voxels, on the other hand, are present throughout an object. Each of the voxels, from the ones representing the skin of the object to ones in the middle of it is held in memory. Each when an object is manipulated, each individual voxel needs to have its position updated, which take a lot of processing power to do just for a single object. Just imagine a game where a hundred voxel based boxes get thrown around by an explosion, each and every voxel will have to be updated constantly. The issue of visual fidelity also ties somewhat into the memory issue. When creating a person, polygons, through a number of texture maps, shading techniques, and anti-aliasing, can create a surprisingly realistic model with very low overhead. But in order to match that with voxels, we will have to create many extremely tiny voxels to simulate the non- uniform surface of a person's body, which is difficult to maintain due to memory and processor constraints. As time went by, we began to see a phasing out of voxels as a medium to display video game worlds.
http://cdn2.planetminecraft.com/files/resource_media/screenshot/1202/2012-01-14_153552_1214597.jpg
This is just one of the many creations made by user the players of Minecraft: CVN 65, The USS Enterprise.
While this may sound like a bleak outlook for voxels, they are still being used in a number of ways. In medical fields, voxels are being used to render 3D models that are created during MRI scans. Doctors use these static models to essentially examine the body from the inside-out. We are also seeing a bit of a resurgence of voxels in the video game industry. One of the most well-known sandbox games on the market, Minecraft, uses voxels to represent terrain. Voxels are being used to represent meter-sized cubes of dirt, wood, rock, etc. that players can pick up and place, creating vast sculptures. The game even gets around the memory issue by only storing the values of voxels near the player character in memory, and loading and unloading more voxels as the player character moves around the environment. So while the voxels are nowhere near as prevalent as polygons, they have still found their own niche in the realm of computer graphics.

3 comments:

  1. Hi Matt,
    Very nice and details post about how computer graphics actually applied in different field in real world. Nowadays, we see images everywhere in our lives from social to hollywood movies and in NASA's works as well. With more advancements in computer graphics technology, the games development for mobile is very popular today, though.

    ReplyDelete
  2. A really cool post. I had never even heard of voxels before but I'm glad they didn't win because then we would have had Minecraft with polygons. You explained the two different approaches to graphics design in games extremely well and now I feel like I am an expert in graphics. Also glad that polygons won out since they seem like the obvious choice for saving memory and they look visually better.

    ReplyDelete
  3. This is a great post! I learned a lot I did know from reading your post. I like that you defined your terms and explained there uses. I would have liked to read a few examples of each type in games that are most commonly known. I was wondering about your updating of voxels. You said that when a voxel is moved all the parts of the voxel have to be recalculated. Isn't that also true for polygons? When it comes down to the hard, the computer needs to calculate the location of all pixels involved and shading of each, correct? I would have liked to see a benchmark of each to see what the actual performance differences are. But overall, great post and I look forward to reading more.

    ReplyDelete