1
$\begingroup$

The Normal Map node provides the normal of an object in global space. I also need the tangent or bitangent (either's fine because a cross product will produce the third). This is a problem because the only ways I can see to get them - the Geometry node's Tangent output, or the Tangent node - only provide the tangents without any way to apply the normal map first.

I've tried to create a "bitangent map" node to basically fool the Normal Map node, under the logic that by manipulating the channels of the normal map, I can make the normal point towards the bitangent instead. It swaps G and B, and inverts R so the handedness is maintained.

node that reverses green/blue and inverts red

But I'm not getting the expected result, so I'm wondering if my logic is flawed or not.

cubes with results

$\endgroup$

1 Answer 1

1
$\begingroup$

It sounds like what you want is the tangent, only rotated such that it is perpendicular to the modified normal.

To get that, you can take the cross product of your tangent and your modified normal, which gives you a vector orthogonal to both, and then take the cross product of this vector with your modified normal, giving you a vector orthogonal to your modified normal, that lies in the same plane as your modified normal and your unmodified tangent:

enter image description here

I'm not sure what you're doing with the nodes you're showing. If we want the unmodified tangent, and we don't want to just use a tangent node, we can plug RGB 1,0.5,0.5 into a normal map node to get the tangent; likewise, if we want the unmodified binormal, and we don't want to just cross our unmodified normal with our tangent, we can plug RGB 0.5,1,0.5 into a normal map node. But these vectors are unmodified by the normal map-- these are the vectors in which the normal map itself is measured. There is no simple color swizzling we can do to get the modified normal or binormal.

$\endgroup$
1
  • $\begingroup$ This is indeed what I was looking for. $\endgroup$ Commented May 3, 2023 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .