# Binormal and tangent vectors

This topic is 4840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is their anyway in GLSL to call something like gl_Normal gl_Tangent, gl_Binormal to get those values? Or am I going to have to calculate them? I am using render monkey and not sure but think DX must calculate them for you? In the stream mapping you can turn them on... If I need to calculate them, I have to use the normal correct and get 90deg each way????

##### Share on other sites
I was going to post a similar question just now, then I saw this. I've spent about an hour trying to work out the best way to find these vectors, and I've came up with a few ideas:

1) Just pass in arrays of normals, binormals, and tangents into the shader. Memory hogging I know, but effective.

2) Pass in arrays of normals and tangents, then do a 'cross(tangent, gl_Normal)' to get the binormal, not technically accurate, but a reasonable hack.

3) Just use normals somehow. I've been trying to get good looking per-pixel lighting using only normals, but due to my lack of mathematical knowledge at this current time, its damn near impossible. I'm having to sit down with a pen and paper to design my shader, all I want is a reasonably accurate looking shader that does normal mapping and doesnt suck up all the GPU juice.

If I had a scanner i'd scan through some of my sketchs i've drew to make visualising how to accomplish all this a bit simpler, but, sadly, I don't.

Anyways, you're original question, I believe you have to calculate those yourself.

##### Share on other sites
Hmm... I have the "Shaders for Game Programmers and Artists" book and he uses HLSL. I am assuming DX must calculate the actual name for binormal is bitangent and tangent? I am trying to do spherical harmonics and my shader is close to the demo but is messed up when I rotate the teapot the back side goes black and from what I can tell from my code it has something to do with my tangent and bitangent due to I just set them up to be 1, 0, 0 and 0, 0, 1.

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 15
• 14
• ### Forum Statistics

• Total Topics
633392
• Total Posts
3011635
• ### Who's Online (See full list)

There are no registered users currently online

×