Skip to content

Easily Create Retro Pixelated Graphics for WebGL Browser Games

So here’s just a quick one. Since these days pixelated “retro” graphics are hot, there’s a way you can turn your uncool Full HD browser game into a cool retro game. The key is changing how the browser handles upscaling of images. By default linear filtering is used to upscale lower resolution images. With the CSS property “image-rendering” you can control this (source):

image-rendering: -moz-crisp-edges;         /* Firefox */
image-rendering:   -o-crisp-edges;         /* Opera */
image-rendering: -webkit-optimize-contrast;/* Webkit (non-standard naming) */
image-rendering: crisp-edges;
-ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) *

All you need to do is take your (WebGL) canvas, set the resolution down to something retro-y (e.g. 320×240 px),  scale it up to the full window size and apply the aforementioned styles to the canvas element.

2 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

My Del.icio.us

%d bloggers like this: