Blog

by
BSP rendering in Doom
I gave a talk on the Doom rendering engine at RevolverConf 2019.2. It is a big topic, so I had to narrow down the scope. I chose to talk about the binary space partitioning (BSP) rendering algorithm. This was the core innovation in Doom which enabled it to run smoothly on ancient hardware and it is still an important algorithm in rendering engines. I want to do a write-up on it one day, but for now I defer to the talk (in Norwegian): .embed-container { position: relative; padding-bottom: 56.25%;… Continue reading
Textures
Textures in Doom are a notch more complex than sprites: they are compositions of multiple sprites. There are also a couple of additional indirections, one which seems to make more sense than the other. The first indirection is the TEXTURE1 and TEXTURE2 lumps. While both flats and sprites are lumps in the wad file in their own right, textures are nested one level deeper. You have to read the TEXTURE1 and TEXTURE2 lumps to even find the textures. I haven't been able to make a good guess as to why … Continue reading
Sprites
Sprites in Doom are stored in a custom format, tailor made for the rendering engine and in a sense even for the final output medium. It has taken me a while to implement support for this format in wad-gfx (formerly doom-gfx), not because of any complexity in the format, but because I had a hard time figuring out how to most faithfully represent the source data in a normal contemporary image file format. Anamorphic pixels If you were into computers back when Doom was released, it is not unlikely … Continue reading
Flats
Of the different image formats in Doom, flats are the simplest. Now, all images in Doom are flat, but flats are what they decided to call the textures that go on the floors and ceilings. I'll save the wall textures and sprites for another time. Flats have predefined dimensions of 64 by 64 pixels. With 8 bits per pixel and no compression or other fancy encoding, this works out to 4096 bytes, and indeed all flats in doom.wad are 4096 bytes. The pattern is clear when looking at the entries between … Continue reading
E1M1
I was gifted the Game Engine Black Book DOOM for Christmas, to my great pleasure. It will let me finally satisfy the curiosity that has been lingering in me since '93. And I suspect it is not entirely without some expectation that I get this book now, after having recreated the rendering engine from Wolfenstein 3D in a live-coding session at RevolverConf 2018.1. My primary goal here is to implement a rendering engine of the same kind that Doom sports. But I should note that this will be for my e… Continue reading