February 23, 2023
TIL (Today I learned)
Ultima Underworld and Affine Texture Mapping
I played the video game Ultima Underworld in the early/mid 1990s. If I recall correctly, a close friend replayed it within the last decade. I dont think I ever beat the first one, nor the second, but could be wrong about that.
I was watching my favorite twitch streamer (LobosJr) play it for the first time (https://www.twitch.tv/videos/1742970282) and it struck me how distorted the 3D rendering was. I had noticed this when I was young, probably because I don't think it struck me as unreasonable at the time. In retrospect, any 3D game had an acceptable level of performance / quality embellishments that would be intolerable today.
I was curious if there was any explanation for the distortions available, and with some searching on the search engine DuckDuckGo, I found a history of the making of Ultima Underworld,. The article "Life Off the Grid, Part 1: Making Ultima Underworld" from January of 2019 by Jimmy Maher which is a great read on its own though long, explains that the 3D embellishments are the result of a intended trade off for the sake of rending performance:
The vertices of the polygons in a 3D graphics system are defined with an X, a Y, and a Z coordinate; it’s this last, of course, that makes such a system a 3D system at all. And it’s also the Z coordinate that is the source of all of the complications relating to 3D graphics in general. Nowhere is this more true than in the case of texture mapping. To do it correctly, textures have to be scaled and transformed to account for their position in relation to the viewing location, as largely defined by their Z coordinate. But Green didn’t bother to do texture mapping correctly; he effectively threw away the Z coordinate and glued his textures onto their polygons as if they were in a 2D space. This technique would come to be known inside the industry as “affine texture mapping.” It yielded an enormous increase in rendering speed, balanced by a degree of distortion that was almost unnoticeable in some situations, very noticeable indeed in others. Still, an imperfect texture mapper, Green decided, was better than no texture mapper at all.
I wanted to know more about "affine texture mapping", and a quick search, again on DuckDuckGo, resulted in the following brief article with code examples: https://mtrebi.github.io/2017/03/15/texture-mapping-affine-perspective.html