I’ve been investigating tangent space bump mapping lately and I have put together a demo showing how it’s done. I have included shaders for all 3 light types: directional, point, and spot lights. I have also included code to calculate the tangent, bitangent, and normal vectors.
For further details and download links please visit www.dhpoware.com
It is error to normalize the lightDir and viewDir vectors within the vertex shader. If you do that, the interpolated direction will be incorrect. Additionally you are calculating attenuation from the normalized lightDir which is not correct.
@Komat: thanks for spotting these errors. I’ve uploaded a new version of the demo with fixes to these errors.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.