Creating Pixel Art in Blender

Motivation

Image from Kickstarter Presentation of Confederate Express

Image taken from Kickstarter Presentation of Confederate Express

 

 

 

 

 

Image published on OpenGameArt.org

Image published on OpenGameArt.org

 

 

 

 

 

 

There’s a type of retro-style graphics in games these days (see the images above). I like that style a lot – don’t know why exactly. However, such graphics are primarily created manually by artists. It’s a time-consuming process, especially if those graphics are animated. It would be awesome if we could create retro-style low-resolution graphics using renderings of 3D geometry using a software like Blender. This would allow us to create or use existing 3d graphics, animate that and then somehow extract a retro-style rendering from that.

How to do it

Let’s try to recreate a small artefact from a promo graphics of Confederate Express.

the graphic we try to recreate (taken from promo pic of Confederate Express)

the graphic we try to recreate (taken from promo pic of Confederate Express)

Here’s a mesh created in Blender, which resembles the bag from Confederate Express and then let’s render it.

bag mesh in Blender

bag mesh rendered in Blender

The problem now is, that this doesn’t look at all like the reference image. There are 2 important differences:

  1. The pixel resolution of our imitation is way too large
  2. The reference graphic has much less colors

Scaling down

All right, if that is the whole problem, just let us scale our rendering down. In the reference image, the bag has a size of 27×24 pixels (omitting the shadow beneath the bag). Blender allows us to render in any resolutation we want.

16 samples with bicubic smoothing

Now that does not look just like we intended it! It’s all smoothed out and boring, no contrast left. What’s the problem? Blender created this image by combining – for each pixel – 16 subpixels into one. It’s called oversampling at is used for anti-aliasing. In this case we used a cubis filter. Now let’s deactivate anti-aliasing and see what happens.

anti-aliasing deactivated

That’s much better but the image looks garbled. Take a look at the handle of the bag, it’s not very well approximated by such few pixels. So, here’s the deal: Without oversampling, we risk missing important details on the object. No oversampling means no subpixels means there are only 27 times 24 rays probing the object and if they miss an important detail, it won’t show in the rendering.

Blender provides us with other smoothing methods, showing less smoothed out results. For example, there’s „Catmull-Rom“.

16 samples with catmull-rom smoothing

16 samples with catmull-rom smoothing

The result is – compared to cubic – not bad, but both have a major issue: They’re using the alpha channel. The pixels on the silhouette are partially transparent. That is not an option for our retro-style graphics.

The anti-aliasing in these images can be understood as a method for downscaling the image. The subpixels can be seen as parts of a high-resolution rendering.

So what we want is some other method for downscaling our graphics, a method which is preserving or even amplifying small details in our image.

Reducing the palette

Besides downscaling the image, the second requirement to achieve retro-style graphics is to reduce the numbers of colors on the image. Early graphic card could only display 2, 4, 16 colors. A low number of colors is a typical feature of pixel art.

Color reduction is not the most important step in our case, because the reference image is composed of 44 individual colors, which is already quite large. Reducing the rendering with no anti-aliasing to 44 colors results in the following sprite:

palette reduced to 44 colors

palette reduced to 44 colors

Timothy Gerstner’s Pix

Timothy Gerstner wrote a master thesis „Pixelated Abstraction“ dealing with the very requirement I described above. On his webpage, you can find his thesis, 2 papers concerned with the same approach as well as executable code (which is of delightfully high quality!).

Gerstner’s approach does not only handle the downscaling but also the palette reduction.

Using his code I managed to create the following sprite

this version was created by Timothy Gerstner’s algorithm

Though the result does not resemble the reference very strongly I have to admit: it looks hand-crafted. But since Gertner’s algorithm has a couple of tweakable parameters and it is designed for semi-automatic execution, I might just have used an unfavourable set of parameters.

I have branched Gerstner’s code to add a command-line interface as well as to fix some minor platform-compatibility bugs in the code. This is currently WIP.

Other approached

  • Content-Adaptive Image Downscaling by Kopf et al. Looks promising, pseudocode for the whole algorithm is provided, no working implementation known to me. Is citing Gerstner’s paper.
  • Pixelating Vector Line Art by Inglis et al. They concentrate on downscaling vector graphics. Could be interesting for downscaling the emphasized silhouettes often found pixel art.