Search Unity

Still waiting to hear back, but I think there's a bug in TANGENT_SPACE_ROTATION

Discussion in 'Shaders' started by akutruff, Apr 9, 2015.

  1. akutruff

    akutruff

    Joined:
    Jul 24, 2009
    Posts:
    44
    This only affects people who are still trying to do tangent space operations, but the code should normalize the vectors before construction

    So, this is the code you should want.
    float3 binormal = cross( normalize(v.normal), normalize(v.tangent.xyz) ) * v.tangent.w;
    float3x3 rotation = float3x3( normalize(v.tangent.xyz), binormal, normalize(v.normal) );