Advertisement
demonixis

HLSL: Computing Tangent/Binormal from Normal

Aug 2nd, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. float3 normal = mul(normalize(input.Normal), World);
  2.  
  3. // [0] Tangent / [1] Binormal / [2] Normal
  4. output.WorldToTangentSpace[0] = cross(normal, float3(-1.0, 0.0, 0.0));
  5. output.WorldToTangentSpace[1] = cross(output.WorldToTangentSpace[0], normal);
  6. output.WorldToTangentSpace[2] = normal;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement