Michael Miriti
Michael Miriti programmer

Video: 3d is a LIE

A new video on my YouTube channel just dropped. Please give it a watch:

What I want to talk about is inspired by an old discussion surrounding the game DOOM in particular.

Have you heard that this classic first-person shooter - and one of the earliest real-time 3D games - isn’t actually 3D?

The claim seems to be that the minimum standard for “real 3D” is polygon rendering.

That’s when points in a virtual 3D space are projected onto a 2D screen using a perspective model. Then polygons—usually triangles—enclosed by these projected vertices are filled with pixels. Manipulating the color of those pixels can create effects like textures and different kinds of shading.

This is how 3D graphics work to this day. It’s quite computationally expensive, so all of this is delegated to a dedicated GPU.

But GPUs as we know them didn’t exist in the early ’90s, and getting real-time polygons to run at a decent frame rate on a home PC just wasn’t doable.

So if you wanted to make something that looked somewhat three-dimensional, you had to cut corners.

One such corner-cutting technique available back then was ray casting.

Don't confuse it with ray tracing, which is also a technique used to render 3D scenes—but it's definitely not something you’d use to cut corners. Quite the opposite, actually.

Imagine a map of walls represented by segments on a two-dimensional plane.

For each pixel column in the frame, cast a ray from the camera’s position. If the ray intersects a wall segment, measure the distance between the camera and the point of intersection, then fill a column of pixels around the horizon line. The shorter the distance, the taller the column.

Add the wall texture and adjust the brightness based on distance, and the result is quite a convincing depiction of a space with walls.

This already looks pretty good, but doing this with an arbitrary number of walls, ensuring all the intersections are calculated efficiently, is still pretty expensive.

Wolfenstein 3D is another id Software game preceding DOOM that uses ray casting to render its graphics.

To simplify the calculations, it uses a grid map instead of arbitrary wall segments. This way, each ray only travels between the grid cells’ edges and stops when a cell is filled.

DOOM steps up the game quite dramatically. It solves the problem of rendering arbitrary wall segments by employing a technique called binary space partitioning. How it works is a whole separate topic that I hope to cover another time. What matters here is that this technique allows most of the heavy calculations to be done during the map-building process. Then, at runtime, the engine can simply read the pre-computed data and determine exactly which walls are visible to the camera. There’s no need to cast rays anymore, but the principle of rendering the walls as columns of pixels remains.

This kind of rendering has its limitations, of course. In fact, it is only good for rendering strictly vertical walls and not much else. For that reason, DOOM uses sprites for anything that isn’t a wall.

So, do these facts exclude DOOM from the league of 3D games?

In my opinion, the answer to this question is: it depends on how you define 3D.

Here’s the thing: at the end of the day, whatever technique is employed, the goal is to create a 2D image that convinces the viewer’s brain it’s looking at a 3D scene.

It’s an illusion created by a machine.

I think DOOM does a pretty good job of creating that illusion—especially with such a basic idea behind its rendering—so it is a 3D game in my book.


As you may have noticed, I’m quite passionate about computer graphics and everything related. If you are too, please subscribe to my channel—and give this video a like while you’re at it—so you won’t miss any of my future videos on these topics.

I’m also interested in hearing from you in the comments section.

That’s all for this video. Thank you for watching. Bye.