What is a surface tangent

The geometry node(shader node) has a tangent output, which to my understanding is the same as the tangent node output set to Z. My question is now: what is a surface tangent? I know what a tangent is, but to my understanding a surface has an infinite amount of tangents, which is also why a plane is also sometimes described as all vectors that are perpendicular to a given normal.

2 Likes

The tangent output of the geometry shader node is the same as the output of the tangent node set to radial Z (I think):

https://docs.blender.org/manual/en/latest/render/shader_nodes/input/tangent.html

So of the infinite surface tangents, one is chosen based on some cylindrical map or the UV map.

Well this is pretty much what I stated in my question, so i think i have to clarify a little bit. My actual question is which tangent is chosen to be the “surface tangent”?

In the case of UVs, I am pretty confident that the chosen tangent is the vector in the tangent space that points into positive u-direction when transformed into the UV-space at the given point.

For the ‘radial’ option, I think the given surface point is projected onto a hypothetical cylinder centered at the object origin and oriented towards the chosen axis. The tangent is then selected from the cylinder, where the tangents point in these directions:

That kinda makes sense to me. Do you maybe know how the tangents at the cylinder are calculated?

For UV based tangents, there is a special tangent node you can switch to UV. Note however, that unlike normals, the UV tangent is not smoothed across a marked seam. The radial tangent, where the tangent node lets you select which direction to use, use the origo/selected axis and surface point to calculate it, but it is smooth. Basically, if you rotate the cylinder 90 degrees in edit mode (not object mode), you can switch the axis in the tangent node. If you rotate it 45 degrees in edit mode, the axis don’t align to a cardinal axis anymore and you have to use UVs.

Yes I know that. My question is how the tangents are calculated mathematically. For all surfaces where the surface normal is not parallel with the direction you specify in the tangent node the resulting tangent is the normalized cross product of the two vectors. But with surfaces where the surface normal is parallel with the direction you specify the resulting vector would always be 0,0,0 so how is the tangent calculated in these cases?