Monday, November 19, 2007

Texturing

Texture mapping is an old 3D graphics technique. It is a way of cheating by faking the details there are in a 3D scene. The basic idea is that you can make a 3D model look like it is made up of many more polygons than it is by wrapping an image around the model. This effectively means that you are distorting an image, such as a photograph, so that it fits the shape you are texturing. More advanced rendering engines will even take account of the z distance of the different points on the polygon.

The texture class that was created for Modern Maze was designed for use with a ray casting engine. As such, the texture class is designed to draw vertical strips on a memory image source. It has two drawing methods. The first one draws a solid strip, while the other one will check the alpha channel not drawing transparent pixels. There is a lot of room for optimization within this class. If I was going to create a more advanced 3D rendering engine, I would add a function that would allow the drawing of a horizontal strip using any two endpoints on the texture. This would allow one to easily create 3D textured polygons.

No comments: