Pages

Saturday, July 31, 2010

Vacation

So my four weeks of vacation are now over. The only computer I had access to during the vacation was my 10 inch netbook, Samsung NC10. Not very big or powerful, yet pleasing enough. One evening I was in the mood for pushing some pixels. So I went to google to find a minimalistic library to help me setup a framebuffer. For some unknown reason I chose TinyPTC over PixelToaster. With a framebuffer in my hands I could now freely push as many pixels as I wanted to, but I still didn't know exactly what I wanted to achieve.

Anyway, this is what it eventually became; a DOOM map renderer. It doesn't implement all features, but it were never meant to either! Most noticeable is that wall textures not are aligned properly, but that shouldn't take too long to fix. Other missing features includes transparent walls and sprites.

At first I did my own map format but that turned out to be way overambitious, after all, it was my vacation.

It think the biggest misconception regarding DOOM is that it uses raycasting, much like Wolfenstein 3D does. So let me clarify that; DOOM, DOES NOT USE RAYCASTING! It could have cast rays in the BSP and do some kind of line intersection test, but that would have been both slower and inaccurate. Secondly, there is no point in doing so because the BSP already gives you front-to-back rendering with zero overdraw (not counting transparent walls and sprites). As I said DOOM uses a 2-dimensional BSP tree for rendering, so any kind of animation in the third dimension is possible. That is how lifts and doors works, by altering the floor or ceiling height.

In my implementation walls are drawn as 3-dimensional polygons with perspective correction for every column, in other words, any vertical wall slice have constant Z and thus, very fast to rasterize. The same applies for floors and ceilings but horizontally instead. Floors and ceilings are basically marked in screen space as gaps between walls and later rendered as horizontal runs.

In the screenshot, wall textures was stored row-by-row which implies one extra multiplication and addition in the inner loop, now these are gone and the FPS should be a bit higher.

Over and out.

No comments:

Post a Comment