Announcement

Collapse
No announcement yet.

SDK: Tangent and Bitangent

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

  • SDK: Tangent and Bitangent

    Hi,

    is there any pre-computed Tangent and Bitangent available somewhere, or do I have to compute it myself?

    And if I have to compute it myself.. how would I do this? Because I can't find any information about the triangle-UVs that I'd need in the VRayContext

    Aya~

  • #2
    You can get this information by querying the sd (ShadeData) of VRayContext::rayresult for the MappedSurface interface. Then use it to retrieve the transformation from world to texture space. Then invert this transformation and use its x and y columns to get the world space coordinates of the tangent and bi-tangent vectors.

    Something like this:

    MappedSurface *mappedSurf=(MappedSurface*) GET_INTERFACE(rc.rayresult.sd, EXT_MAPPED_SURFACE);
    if (mappedSurf) {
    Matrix worldToTex=mappedSurf->getLocalUVWTransform(rc, channel).m;
    Matrix texToWorld=inverse(worldToTex);
    texToWorld.f[0]; // this is the tangent
    texToWolrd.f[1]; // this is the bi-tangent
    }

    Hope this helps.

    Greetings,
    Vladimir Nedev
    Vantage developer, e-mail: vladimir.nedev@chaos.com , for licensing problems please contact : chaos.com/help

    Comment


    • #3
      This is correct for Maya, but for 3ds Max you can simply use the ShadeContext:: DPDUVW() method. Note however that the result from this is not continuous across triangles. If you need the continious vectors, let me know.

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

      Comment

      Working...
      X