Quantcast

Bringing Back the Voxel: StarForge, Cube World and the Return of a Graphical Style

By Wesley Fenlon

The creators of two independent games talk about the reemergence of voxels, the visual style inspired by Minecraft and the nitty gritty details of voxel technology.

Voxels are back in vogue. Actually, for the first time ever, volumetric pixels represent one of gaming's most popular visual styles. Since 2009, Minecraft has inspired countless designers to give the 8-bit pixel art look a 3D makeover, spawning small indie games like Voxatron and full retail releases like 3D Dot Game Heroes. Voxels aren't a new technology--in fact, game developers have been using voxels in place of polygons since the 1990s, in games like Comanche and Outcast. But then Minecraft arrived. While voxels were once a clever solution for programmers struggling with the limitations of early 3D graphics processing, they've become a popular, instantly recognizable graphical style that millions of people can point to and say "Hey, that looks like Minecraft!"

Ironically, Mojang's open-ended three-dimensional-pixel world isn't made of voxels in the strictest sense. Minecraft's textures defy the most simplistic definition of a voxel (just as a pixel is a single-color 2D square, a voxel is a single-color 3D cube). Even if there's a lot of confusion over what qualifies as a voxel, the look and technology are undeniably experiencing a renaissance in Minecraft's wake.

"I got the idea while playing Minecraft," wrote Wolfram von Funck, aka Wollay, developer of the independent game Cube World. "I was fascinated by the idea of a huge world which is procedurally generated by the computer (and not directly designed by the game creator.) The game creator just defines a set of rules and equations and the outcome is a totally foreign world... So I decided to create my own procedurally generated voxel game, with influences by RPGs and action adventures."

Cube World is a working title that Wollay plans to change before releasing his game, which has been in development since May 2011. But the name sums up Cube World's aesthetic perfectly: It's gorgeous and vast, with layers of vividly colorful cubes standing in for smooth rolling hills. By contrast, another upcoming voxel game called StarForge camouflages its voxel building blocks, opting for a more traditional graphical style.

"This was a conscious decision we made off the bat with StarForge," wrote Steve Smolley, co-founder of StarForge developer Code Hatch. "The blocky look is neat and retro but eventually it gets tiresome, especially when it seems like most games that borrow inspiration from MineCraft tend to adopt the blocky look. We wanted to stand out and to give players an immersive experience. We want players to look back at the things they've built and wonder, 'Wow, I built that?' "

I asked both Smolley and Funck to dig into the technical details of their voxel projects and describe their individual approaches to engine design. Voxels are in style, and both StarForge and Cube World prove that the technology is as exciting today as it was 15 years ago.

That Voxel Look

When game developers started working with voxels, it wasn't to push a particular visual style. It was out of necessity--graphics cards were just beginning to integrate 3D acceleration in 1997, and you'd be hard pressed to spot visual similarities in Westwood's Blade Runner and NovaLogic's Comanche, two prominent voxel games of the 90s. Why, then, are today's voxel games dominated by giant 3D blocks?

By daylight, Cube World is dominated by bright, cheerful colors.

There's something appealing about the aesthetic, about the way it melds dedication to retro 8-bit pixel art with the modernity of three dimensions and vast landscapes. It's perhaps the most blatant combination of old school and new in video game art direction, something Wolfram von Funck clearly had in mind with Cube World.

"I decided to use colored untextured blocks (aka voxels) to get the special look of a 2D pixel-based game transferred to 3D," he wrote. "To enhance the visuals, I also added a kind of faked ambient occlusion to the vertex colors which results in a rather plastic looking geometry with smooth shading."

The smooth shading makes Cube World's environments pop with color, making up for a minimal amount of detail. Up close, the flat textures and simple geometry make walls and building interiors look barren, but when an entire valley or forest is in view, the layers of color and visible edges give Cube World a sculpted look. And the aesthetic extends to virtually everything in the game, which actually made it easier to Funck to create.

"I don't need a mesh modeling tool (like Maya) to create models like players, monsters or weapons," he wrote. "I have programmed my own 3D voxel editor which allows me to create models quickly and intuitively, similar to a 2D pixel art program. Animations are hard-coded in the game engine: character models consist of multiple rigid voxel sprites which are animated by the engine by rotation and translation. ... I tried to use voxels for many aspects of the game to get a consistent look. For instance, particle effects like water splashes or fire consist of voxels."

There is a danger in so directly adhering to the straightforward voxel aesthetic, though--Cube World and games with similar graphics are easily and often labeled "Minecraft clones." That's one reason Funck wants to rename the game without using the words "voxel," "cube," "block," or "craft." It's also why he downplays the game's building elements. Players will be able to construct houses, but the game focuses on exploring and RPG questing, not gathering resources or building immense cities.

StarForge utterly embraces the "build anything" appeal of sandboxy games like Minecraft, but transplanting that gameplay into a different visual style makes it feel like less of a Minecraft clone. The terrain is indistinguishable from any other polygonal game, and editing it-- hollowing out bits of the ground and watching it deform--feels more like Red Faction than Minecraft. Only in construction does the blocky aesthetic come through--building elements retain the cubey structure we expect from voxels--but Code Hatch has done an amazing job of camouflaging its voxels with textures that naturally combine and flow together.

"We use a collection of hand-made "tileset" pieces which fit together seamlessly around what would normally be a grid of flat cubes," wrote Smolley. He compares StarForge's building system to a giant 3D puzzle, but the computer is the one fitting pieces together, making sure all the textures align to create a sensible picture. "If you're familiar with 2-D tilesets used in older games you'll understand what it requires to get tiles to tile properly; simply things need to line up with each other. But now imagine adding in a third dimension with dozens of possible ways two tiles can lay adjacent to one another. It becomes pretty hectic pretty quickly."

While Cube World's comparitively simple graphical style comes from Funck's homemade voxel engine, StarForge runs in Unity and relies on a variety of tools. Smolley mentioned that Code Hatch uses Allegorithmic's Substance technology for procedurally generated dynamic textures.

"You could say we have an infinite number of textures," he wrote. "We have textures for everything from grass to Cheerios floating in milk, and each preset can be altered in many different ways, such as age, or the number of nails in a wood fence, and so on."

The scope of Code Hatch's ambitions for StarForge have expanded dramatically since the game was released as a free to play alpha in mid-2012. In November they launched an Indiegogo campaign and raised over $100,000 for StarForge, and by the time the game hits a beta release it may have completely hidden all traces of its voxel building blocks.

"You can probably notice the tiles in our current system," Smolley wrote. "They are small tiles so repetition is easily noticed, and can still give a bit of a block look. We hope to redesign our system to allow huge tiles that span across several cubes, replacing the obvious blocky look with convincing architecture. Other planned features include a realtime structural stress simulation, visualized to look like those state-of-the-art physics simulations architects use to design skyscrapers. This will challenge players to create structurally sound buildings, or else some nifty destruction physics might kick in."

Speaking of physics...

Voxels: How do they work?

"I like the simplicity of a block-based game engine: things like collision and terrain modification become very easy," wrote Funck. "Procedural generation of 3D objects is straightforward. Each object [in Cube World] is basically defined by a 3D array of voxels which can be easily modified by algorithms."

Even Cube World's map is made from voxels.

The distinction between voxels and polygons is muddied somewhat by the fact that most voxel-based games, including Cube World and StarForge, actually render their virtual worlds as polygons.

"Shader technology on modern hardware has made it possible to render voxels directly by using methods like ray tracing, but this technique is generally way too slow to allow much more than an interesting tech demo," wrote Smolley. "Some developers are tackling the problems of rendering voxels directly, but their work has yet to be released and integrated into engines for developers like us to use."

Confused? Smolley's description of the voxel tech behind StarForge should help clear things up.

"We are using polygons to render everything, as there is no way yet of rendering voxels directly that is accessible and reliable enough for developers; we ultimately have to convert them to polygons and then draw them. Polygons might be replaced for the most part some day, but I doubt they will be replaced completely because they are extremely efficient whenever highly geometric objects like buildings need to be rendered, whereas using voxels or points to represent such surfaces would be redundant and wasteful, and the result might not be as clean or crisp.

"Both terrains and building materials use Voxels but in two very different ways. The terrain uses the 'marching cubes algorithm' which has been around since the 80s. This algorithm has been useful in other industries and can be employed whenever circumstances call for rendering some sort of volumetric data. For example, an MRI scan or 3-D ultrasound can be rendered with marching cubes.

"The algorithm works by building polygon meshes around a volume of 3-D pixels, hence the term "voxels". Each voxel has a value which represents, in our case, the terrain density in a range between 0 and 1 at a given point in space. The next step is to place vertices between any two neighboring voxels whose values cross over 0.5, and to then connect those vertices with triangles. To help visualize this, imagine a tank of water: Wherever a bubble or air pocket forms (a low density region), there exists a surface which separates it from the water (a high density region). This is roughly equivalent to what the marching cubes algorithm does."

In simpler terms, voxels provide the skeleton for StarForge's polygonal skin. But there's a lot more to the relationship between that skeleton and the other working parts of a game, especially in a project as ambitious as StarForge. Physics make things complicated.

"The physics engine is pretty smart in that you can feed it virtually any polygon mesh and it'll figure out what happens when stuff collides with it," wrote Smolley. "This worked great at first. However, problems arose when we implemented infinite voxel terrain and terrain LODs (levels of detail). The only problem was the simple fact that now what is visible and what is actually there are now completely different.

"With infinite terrain, you obviously cannot have infinite visibility. We needed to delete pieces of the terrain that passed too far into the distance, making room for new pieces of terrain that came into view. No problem - except everything would fall into oblivion when the terrain underneath deleted itself. Similarly, switching LODs would cause objects to "jump" when it felt the terrain underneath it change into a lower-polygon version of itself.

"While it is possible to do things like "freeze" objects whose terrain has vanished, so they remain where they are when you come back to check up on them, this doesn't completely solve the problem in cases where LODs are used to render vast landscapes. For example, you could park your vehicle on a surface which appears flat up close, but becomes sloped or jagged at a distance when the next LOD kicks in - sending the vehicle off the edge and into a deep chasm. Otherwise if the vehicle was frozen at said distance, you'd be limiting the distance for which physically simulated objects are interactive.

"Our solution to these problems is to keep rendering and collision detection completely separate. Instead of relying on PhysX's mesh collision detection, we'd instruct all physically simulated objects (or "rigidbodies") to sample from the same terrain density algorithm used to produce the mesh. A collision would occur when a rigidbody detects that the space it resides in changes from being empty to solid."

Physics didn't really factor into Funck's implementation of voxels in Cube World--he said gravity, acceleration and friction would all work the same in a non-voxel game. Voxels were simply an easy avenue to two important game elements: Randomly generated environments and destructible terrain.

"The landscape consists of plains, hills, mountains, rivers, caves etc. and everything is randomly generated using a combination of noise functions and random numbers," he wrote. I think it's much easier with voxels than with polygons: You don't have to care for vertex positions, mesh geometry, textures etc. You just need to modify a 3D array."

This isn't a unique approach to a voxel engine, but it works. While Cube World and StarForge both borrow inspiration from Minecraft, time may well prove them ahead of the curve on voxel technology. Unreal Engine 4, which may power as many games next generation as Unreal Engine 3 has since 2006, uses a new technique called Sparse Voxel Octree Global Illumination for lighting. Even if the trademark cubes are nowhere to be seen, next-gen games that look as amazing as Epic's Elemental will have voxels to thank.