Recreating the PlayStation 1 look in a browser

Late-1990s horror games have an instantly recognizable look: visible pixels, shimmering colors, and fog that swallows everything a few meters away. That look wasn't an artistic choice: it was a direct consequence of the limits of the PlayStation, released in 1994 in Japan and in 1995 in Europe and North America. The dark death recreates that atmosphere in a modern browser, which has none of those limits. So they have to be brought back, one by one.
Where the PlayStation look came from
The console usually ran its games at 320 by 240 pixels. It stored colors in 15 bits: 32 levels each of red, green and blue, where a modern display has 256 per channel. To hide the banding in gradients, it could dither the image, alternating pixels of two neighboring shades in a regular pattern. From a distance, the eye blends the two and sees the shade in between.
Its video memory was just one megabyte, shared between the displayed image and every texture. Textures were therefore tiny, and the console couldn't smooth them: blown up, a texture showed its square pixels. Finally, drawing a forest all the way to the horizon was out of reach. Many games hid this behind thick fog, to the point that it became a hallmark of the genre.
Two other flaws are just as famous: object vertices that wobble slightly because of imprecise math, and textures that warp when seen at an angle. The dark death doesn't reproduce those two. Its style comes from color, textures, lighting and fog, which keeps the image readable while you're running for your life.
Textures drawn by code, in console colors
Almost all of the game's textures are drawn procedurally at startup, on small surfaces: 64 pixels square for the ground, 32 by 64 for the pine bark, 32 by 32 for most of the rest. That's the scale of textures back then.
Once drawn, every texture goes through the same step: its colors are reduced to 32 levels per channel, exactly as on the console, with dithering based on a 4×4 Bayer matrix. This matrix is a fixed pattern of thresholds that decides, pixel by pixel, whether to round the color up or down. The result has that regular, checkerboard grain typical of PlayStation games. The dithering happens only once, when the texture is created, so it costs nothing during play.
The textures are then displayed with no filtering at all and no downscaled versions for distant surfaces: every texel stays a crisp square, even up close. Only a few images, such as the drawings on the notes and the cat's jump scares, are actual image files bundled with the game.
An image slightly smaller than the screen
The game renders below the screen's resolution, at about three quarters on a typical computer screen and a bit less on a phone, with no anti-aliasing. The browser then scales it up while keeping the pixels square, with no blur. That's still far from the console's 320 pixels of width, which keeps the game playable on a big screen, but edges pick up that slight staircase effect reminiscent of the era.
Lighting: per vertex, except on the ground
On the PlayStation, lighting was computed at the vertices of polygons and then spread across their surface as a gradient. The dark death does the same for most objects, with clearly defined faces, which gives the trees and rocks their angular look.
There's one exception, and it's deliberate: the ground and large walls are lit per pixel. The reason is the flashlight. With per-vertex lighting, a beam sweeping across a large triangle of ground lights it up or darkens it all at once, which creates a very unpleasant flickering effect. Lighting the ground per pixel gives a clean circle of light that glides naturally in front of your feet.
The flashlight itself is a spotlight whose beam opens to about sixty degrees. The ambient light is almost nonexistent, a very dark green. The cat, on the other hand, isn't lit at all: it keeps the same color even in total darkness, which makes its red eyes glow even from far away.
The fog
The fog is the centerpiece of the atmosphere. The game uses so-called exponential fog, whose density increases very quickly with distance, in an almost invisible greenish black. At 30 meters, objects are already five-sixths faded out; at 40 meters, there's practically nothing left. Beyond 90 meters, nothing is even drawn. It's the same trick games used back then, for the same reason: you only see danger coming at the very last moment.
On top of the image
Several layers are added over the 3D scene, using simple browser features.
- Scanlines: a gradient permanently darkens every other line, like on an old TV.
- Vignetting: a radial gradient darkens the edges of the screen and draws the eye toward the center.
- Static: a small 360 by 240 pixel image filled with random red noise covers the screen when you stare at the cat while it's attacking. It's only computed in that case, and the gray snow of a TV with no signal only shows up at the very end.
- Jump scares: a strip of sixteen frames played in half a second, under a red filter, with a screen shake.
The campfire follows the same logic: its flames animate at only eight frames per second, and its sparks move in five-centimeter jumps, as if the console couldn't afford to do any better.
A mirror, even at low resolution
The cabin contains a real mirror, in which you can see your own character, a small cat. The reflection is rendered separately, at a third of the screen's resolution, with no filtering either: even in the mirror, the image stays pixelated. To keep it cheap, it's only rendered when you're within fourteen meters.
Models and sound
The game is built on Three.js, an open-source library that makes 3D in the browser easier. Every model is assembled from simple shapes. The cat, both the player's and the monster, is a single mesh animated by a five-bone skeleton, with a single 256-pixel texture. The monster is that same cat, all black, with two bloodshot red eyes.
The sound is entirely synthesized, with no recordings: heartbeats and a series of unsettling noises that occur at random, like knocking on a door, footsteps circling around you or crying in the distance. The music grows darker with every note you pick up.
Imitating a constraint
That's the whole point of the exercise: the PlayStation produced this image because it couldn't do any better. A browser can do much better, so you have to choose precisely which limits to bring back. The dark death keeps the ones that serve the fear, the limited colors, the grain, the fog, and leaves out the ones that would get in the player's way. To learn how to survive in this forest, see the survival guide for The dark death.