Sunday, February 24, 2008

Normal Mapping

One of the things that makes modern games look so good is called Normal Mapping. It's a technique that allows the GPU to deform a simple mesh (an object made of relatively few triangles) with a special image made from a much more detailed mesh of the same model. The result is few triangles, which means faster rendering, but lots of detailed thrown in at render time by the GPU, which means better looking models. Read the Wikipedia article in the link to understand it. I plan on using normal maps a lot in Tower Simulator.

This can be applied in very small-scale object, such as a telephone used to communicate to other ATC all the way to a whole planet, which is what this video is all about. It is not rendered in XNA, as I have not learned to do that yet, but in modo. I just wanted to learn a bit more about normal mapping and the quickest way was to use this software, which is what I use to create models.

The video portraits a perfectly smooth sphere model with 288 polygons with to textures applied. One is a color map of the surface of Mars, the other a normal map of the surface of the same planet. The normal map does not show as color, but instead it allows the GPU to deform the smooth surface I created to show elevation of some major features and craters on the surface of the red planet.

This render is made out of 1500 frames playing at 60 frames per second. The blogger upload came out darker than what I wanted, but you can still see some of the major elevations such as the huge volcano that shows on the beginning and end. Notice how it remains partially lit for a little bit once it moves into the shadow area as Mars rotate. That clearly indicates it is higher than the rest of the surface. You can see this in reverse towards the final seconds as a canyon moves into view.

If you are interested, I got the textures from Planet Pixel Emporium.

Here's the video: