CSS goes 3D with voxel.css

Default avatar.
January 28, 2016
CSS goes 3D with voxel.css.
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.

Ezequiel Bruni

Ezequiel Bruni is a web/UX designer, blogger, and aspiring photographer living in Mexico. When he’s not up to his finely-chiselled ears in wire-frames and front-end code, or ranting about the same, he indulges in beer, pizza, fantasy novels, and stand-up comedy.

Read Next

15 Best New Fonts, July 2024

Welcome to our monthly roundup of the best fonts we’ve found online in the last four weeks. This month, there are fewer…

20 Best New Websites, July 2024

Welcome to July’s round up of websites to inspire you. This month’s collection ranges from the most stripped-back…

Top 7 WordPress Plugins for 2024: Enhance Your Site's Performance

WordPress is a hands-down favorite of website designers and developers. Renowned for its flexibility and ease of use,…

Exciting New Tools for Designers, July 2024

Welcome to this July’s collection of tools, gathered from around the web over the past month. We hope you’ll find…

3 Essential Design Trends, July 2024

Add some summer sizzle to your design projects with trendy website elements. Learn what's trending and how to use these…

15 Best New Fonts, June 2024

Welcome to our roundup of the best new fonts we’ve found online in the last month. This month, there are notably fewer…

20 Best New Websites, June 2024

Arranging content in an easily accessible way is the backbone of any user-friendly website. A good website will present…

Exciting New Tools for Designers, June 2024

In this month’s roundup of the best tools for web designers and developers, we’ll explore a range of new and noteworthy…

3 Essential Design Trends, June 2024

Summer is off to a fun start with some highly dramatic website design trends showing up in projects. Let's dive in!

15 Best New Fonts, May 2024

In this month’s edition, there are lots of historically-inspired typefaces, more of the growing trend for French…

How to Reduce The Carbon Footprint of Your Website

On average, a web page produces 4.61 grams of CO2 for every page view; for whole sites, that amounts to hundreds of KG…

20 Best New Websites, May 2024

Welcome to May’s compilation of the best sites on the web. This month we’re focused on color for younger humans,…