Results 1 to 5 of 5

Thread: How to compute binormal( bitangent ) vector?

  1. #1
    Senior Member Frequent Contributor ehsan2004's Avatar
    Join Date
    Jun 2004
    Location
    Iran
    Posts
    645

    How to compute binormal( bitangent ) vector?

    Hi
    How to compute binormal vector for bump mapping calculations?

  2. #2
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,000

    Re: How to compute binormal( bitangent ) vector?


  3. #3
    Senior Member Frequent Contributor ehsan2004's Avatar
    Join Date
    Jun 2004
    Location
    Iran
    Posts
    645

    Re: How to compute binormal( bitangent ) vector?

    What's the idea behind the code? Note that I don't like to buy the book "Mathematics for 3D Game Programming & Computer Graphics" to only read one section

  4. #4
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,000

    Re: How to compute binormal( bitangent ) vector?

    Basic idea is that given a mesh that has position, normal and a texcood, you can calculate the tangent/bi-tangent by getting the rate of change of the texture coordinates over the mesh surface.

    If you want more details, look up the GDC slides from 2003/2004 era.

  5. #5
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: How to compute binormal( bitangent ) vector?

    The idea is to use the derivative of texture coordinates across triangle vertices to calculate the derivative of the cardinal texture axes in 3D.

    In that example sdir and tdir are the tangent & binormal.

    The stuff at the end ensures the tangent and normal axes are orthognal and it looks like binormal is the implicit cross product (a common approximation) since tdir isn't corrected the way sdir is. There's no 'right' way to handle bad content here, this is just tidying things up, normalize is the most important operation in the second part of the code.

    The final part is flipping w based on the axis orientation (basically adding support for mirrored coordinates but it needs support in the vertex shader to use this correctly).

    This example shows definite signs of being lifted from somewhere without proper cleanup, especially the way tdir is handled.

Similar Threads

  1. Mesh generation for Cube, Sphere etc with Vertices, UV's Normals, Tangent & Bitangent
    By imported_paul_g_griffiths in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 01-21-2017, 08:22 AM
  2. Tangent, Bitangent & Normal
    By toneburst in forum OpenGL: GLSL
    Replies: 5
    Last Post: 03-05-2008, 09:06 AM
  3. Tangent, Binormal Calculations
    By Swiftless in forum OpenGL: General
    Replies: 2
    Last Post: 11-11-2006, 04:59 PM
  4. normal vector. how to compute it?
    By zip7000 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 05-04-2002, 11:41 PM
  5. Replies: 3
    Last Post: 05-02-2000, 06:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean