Jump to content
  • Advertisement
Sign in to follow this  
Waaayoff

Passing Tangents and Binormals to shader (for normal mapping)?

This topic is 2689 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

I was wondering, are these passed the same way as normals? For every vertex i need to have for example: { position, textureUV, normal, binormal, tangent }?

Also should i only pass two of these and calculate the third in the vertex shader?

Share this post


Link to post
Share on other sites
Advertisement
Yes that's correct. Personally I calculate the bitangent (it's 'Bitangent' when working with 3D surfaces - a surface has a normal and two orthogonal tangents. 'Binormal' is when you're working with 3D lines such as splines, which have a tangent and two orthogonal normals) in the shader rather than passing an extra vertex attribute, but I imagine only profiling would establish if this is actually faster. You'd be trading off the cost of the extra data to upload to the GPU against the cost of perfoming the calculation in the shader.

Unless you're striving for every tiny bit of performance I'd just do whichever method would make for the tidiest code.

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!