Hi @all,

I’m not sure if this is the right forum, but it seems to be a mathematical problem.

I need the tangent in a vertex shader. But I can the normal and the vertex position only. How can I calculate the tangent at that point?

I think that OpenGL SL does not provide a build-in function to deliver the tangent, or?

Thanx

jlukas

Hi,

I cross posted this topic here:

http://www.matheraum.de/read?f=2&t=423&i=423

But its in german, sorry. Just for your knowlegde.

jlukas

You have to precalculate the tangents using texture coordinate information from adjacent vertices. Then send the tangents to a vertex program using a generic attribute array. Here’s some code that will determine the tangent direction at each vertex of a mesh:

http://www.terathon.com/code/tangent.html

– Eric Lengyel

Thanx Eric that will help.

chao

jlukas