Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!