Tuesday, January 11, 2011

Shader - Normal Mapping

Normal mapping. I guess this is one of the important technique in game development. It can gives u a high details of an model without the need of high poly model. Sounds cool isn't it? Anyway, Computer graphics always cool!

Before you can do a good normal mapping, you need to have a good normal map. Question.... how do I create normal map? Easy! Model a really high poly and detailed model, and generate normal map from it first (I believe most 3D software did provide the function of generating normal map) After you have generated the normal map, reduce your poly count until it fits your game :)

The concept behind normal mapping is, do the lighting calculation at Tangent Space aka Texture Coordinate Space. I don't think my explanation will be good. If you wish to know more about this, try to look at this page or this page.

In short, you need to find out TBN matrix and convert your lighting direction to the tangent space by multiplying with the TBN matrix.

TBN matrix is (Tangent, Binormal, Normal) matrix.


Here are some screenshots:
*Original model without applying normal mapping

*Same model after applying normal mapping



Key Control:
1: Without applying normal mapping
2: Applying normal mapping

No comments:

Post a Comment