Talk:GLSL Programming/Blender/Lighting of Bumpy Surfaces

Hi,

I'm trying to port this tutorial to C++, and I wonder how to compute the "tangent" attribute. I'm thinking of picking a solution for the vector perpendicular to N : $$\scriptstyle N_x.T_x + N_y.T_y + N_z.T_z = 0$$, but I wonder which tangent to pick. Beuc (discuss • contribs)


 * Hi, as far as I know, the tangent direction is usually chosen correspondingly to the first texture coordinate, say u. Think of the 3D vertex position p as a function of the texture coordinates u and v: p(u,v)= (x(u,v), y(u,v), z(u,v)) then the tangent is chosen as close to $$\partial p(u,v) / \partial u$$ as possible while still orthogonal to the normal vector. This is particularly useful for normal and parallax mapping. --Martin Kraus (discuss • contribs) 22:18, 1 June 2012 (UTC)


 * This article http://www.terathon.com/code/tangent.html seems to be detailing what you suggested. Incidentally it also insists on using "bitangent" rather than "binormal". Beuc (discuss • contribs) 11:53, 2 June 2012 (UTC)


 * As far as I know "binormal" is the traditional term because the concept can also be used for curves. The question is: should we use the same names for the same concepts even if the names don't fit the application? Or should we use different names for the same concepts in different applications? I think it is helpful to use the same names, but opinions may differ. --Martin Kraus (discuss • contribs)


 * OpenGL Tutorial Lighting of Bumpy Surfaces.jpg
 * I believe I managed to implement the tangent :)
 * https://gitorious.org/wikibooks-opengl/modern-tutorials/blobs/master/textures_in_3d/cube.cpp Beuc (discuss • contribs) 14:16, 3 June 2012 (UTC)


 * Looks good. :) --Martin Kraus (discuss • contribs) 16:46, 4 June 2012 (UTC)