Using tangent in shader

Crashy

15-04-2007 17:38:07

I need a tangent vector to do some bump mapping computation on my terrain, but as far as I know, the tangent are not generated and not added to vertex declaration.
Though, is there a way to get them?

Thanks

Walley

16-04-2007 05:12:51

You can generate one with normal.cross(float3(1, 0, 0)), as you'll never have 1, 0, 0 as the normal on terrain.

Crashy

16-04-2007 07:45:22

I tried that but the result seemed weird. However, I'll keep it as it is mathematically correct.
Thanks.

Walley

16-04-2007 09:38:52

I've used it successfully to write normal + offset mapping shaders for the terrain so yes, it does work :).