top of page

NORMAL MAPPING

  • Writer: Shaveen Kumar
    Shaveen Kumar
  • Feb 13, 2015
  • 1 min read

It’s been a long time since I posted anything so thought of writing a quick update. A major portion of the time I spent on my engine in the past couple of months was in re-architecting the existing engine. It was very difficult to write custom shaders easily with the previous architecture. It is a lot easier now and there are many more improvements such as better memory management, but more on that in another post. My latest shader is one that does normal mapping. In order to implement this, it required a few extra calculations performed on the native side. Normal mapping using a map which represents a direction vector for model at every texel mapped on top of the model. The added challenge which does not make this straightforward is the fact that these provided normals should respect the existing normal on the model. This requires the calculation of a basis matrix in image space, transform existing light information into this new tangent space and perform calculations there to perturb the model space normal and then apply lighting to the model.

Here is a screenshot of tangents generated in the vertex shader and used in the color channel of the output:

Here is a screenshot of the final result:

Robot obj model; diffuse, specular and normal map textures courtesy tf3dm.com


Commentaires


bottom of page