The web is often seen as a decidedly two-dimensional medium. And, to be fair, it is. That’s what it was designed for.
What’s more, the addition of three-dimensional graphics, rendered live, has traditionally required plugins. Macromedia gave us Shockwave, Unity gave us the Unity Web Player, and all the while, we’ve used 3D graphics for games, mostly.
HTML5, CSS3, and some inventive JavaScript have done a lot to change this, however. Oh, it’s still mostly used for games, but you can take it further, and integrate the graphics into a regular site more easily than ever.
Sure, we still have usability concerns. A site that depends on 3D graphics for navigation or essential content is still a terrible idea. However, when used with progressive enhancement, 3D is a viable, and even performance-friendly way to take things up a notch.
To that end, I present voxel.css.
voxel.css is a framework that uses CSS3 to do the heavy lifting of rendering 3D objects. JavaScript is used to add interactivity, trigger the animations, and pretty much everything else.
Style
Well, this is CSS we’re talking about. You’re not going to get Crysis-level graphics. As the name of this framework suggests, what you get is a lot of cubes. Think Minecraft in the browser. (And someone will build a Minecraft clone with this in three… two…)
Still, you can do some impressive things with blocky graphics. Think of it as taking 8-bit art to a whole new level.
Easy 3D rendering
The basic implementation of voxel.css only requires the inclusion of the library, and 15 lines of code. This creates a savable virtual scene where you can edit your models, point-and-click style.
You can then display these scenes to any web page, and animate them as desired.
Use any image type for textures
Use a PNG for transparency, a GIF for animation, or an SVG file for unlimited scalability. Use a JPG for reasons unknown, or the WebP format because you like things that aren’t implemented in all browsers yet.
There’s even a demo that uses live footage from your webcam as textures for the blocks.
GPU acceleration
Again, it’s CSS3. You can use the superior rendering power of a device’s graphics card (or chip, as the case may be) to display your work. You won’t have to worry about choppy graphics on anything but the slowest of mobile devices. (You should be using a fall-back for those in any case.)
Conclusion
voxel.css is a simple, no-nonsense way to get some three-dimensional goodness into your web app, page, site, or game. Try it out, look at the demos, and see if it’s right for your project.