You can get a UV map based Tangent using the Tangent node set on UV Map, or by using the Attribute Node with the attribute 'tangent' entered (you'll get the tangent of the active UV map.) If I understand correctly, this is a tangent based on the mesh normals and a UV map. I want to get a tangent of a custom normal and a UV map, such as if you used an Object or World space normal map texture.
How are these UV tangents calculated? Can this be re-created with nodes, or is it precomputed? I can't find any data block for it.
I have looked in the source code for the Eevee tangent node and also Cycles OSL tangent node. The Eevee version just seems to be calling the tangent attribute, so whatever calculation is being done is somewhere else and I can't find it.
The Cycles OSL node is a bit harder to puzzle out. It takes an attribute named geom:tangent as its default input, but returns nothing when set to 'uv_map' direction type unless you enter an actual UV map name instead of geom:tangent. Then it works and produces something that looks like a radial tangent, but is not the same as what the Tangent node is giving. You can re-create the math from the OSL code as nodes and get the same result. Here's a GIF showing each:
What else is going on here? What am I missing?