Quote:
Ok, I can calculate the tangent and binormal from the normal on a terrain. This works on a model terrain, but when I use it on a terrain, I get the SAME tangents as when I use the tangent flag.. Seems like the problem is related to the normals then.. worldToTangentSpace[0] = cross(InNorm, float3(0.0f, 0.0f, 1.0f)); worldToTangentSpace[1] = cross(worldToTangentSpace[0], InNorm); worldToTangentSpace[2] = InNorm;
While I'm not clear on why this works, usually tangents must be calculated by taking the texture coords of nearby vertices into account, even on a terrain this ought to apply.. but if it works I guess it dosent matter
Quote:
I would advise you to use the above way of calculating the tangent and not use the tangent flag, because it is faster on the GPU. Ofcourse it only works for terrains.
This is most certainly not faster than using the tangents calculated by the engine.. why would you think that? Tangents are calculated once only, not every frame...otherwise it would be super slow..
|