Announcement

Collapse
No announcement yet.

SDK: Tangent and bitangent

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SDK: Tangent and bitangent

    Hi,

    I need to function to transform vectors between world and tangent space.
    I found this:

    http://www.chaosgroup.com/forums/vbu...ight=bitangent

    From the sample code, I wrote this function:

    Code:
    Matrix worldToTangent(const VRayContext& rc)
    {
        MappedSurface* mappedSurf = (MappedSurface*) GET_INTERFACE(rc.rayresult.sd, EXT_MAPPED_SURFACE);
        return mappedSurf->getLocalUVWTransform(rc, 0).m;
    }
    Is the matrix I get from this function a pure rotation matrix?
    I ask because it transforms my unit vectors into non-unit which doesn't seem right.

    Thanks!

  • #2
    No, it is not a pure rotation matrix; it is used to transform an offset relative to the shaded point from world space to texture space. To get the tangent and bitangent vectors, you will need to invert the matrix and get its first two columns.

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment

    Working...
    X