Finally, normal map! It's always nice to know how to make things look realistic without using ten thousand polys. And this is how we do this:
In addition to the diffuse map, we use the normal map which gives you the "bump" information (similar to height map) to calculate lighting, so you actually feel like the surface as "bumpy" as it should be.
Sounds easy enough, so we just store the normal information in the normal map and pass it into the shader and that's it? Of course not.
The normals you store in the texture are set, which means they are only facing only one direction, this could be problematic. What is this suppose to mean? Well, imagine you have a cube, its six faces has the same texture. If you think about it, the normals you store in the texture can only fit one of those faces. How to make it fit any face of the cube? You need some way to convert the normals in the map from "texture space" to model space.
The way we do this is by using the "TBN" rotation matrix, we can get the right normals by using tangent, bitangent and normal of each vertex on the mesh. And we can get this information from mesh in Maya. After we get the normal, the lighting part is the same as before.
The implementation is fairly easy, nothing worth mention.
The screenshot:
Source:
Graphics 08

No comments:
Post a Comment