Bonjour,
J'ai un problème pour calculer les tangentes pour le bump mapping.
J'ai trouvé cette fonction mais je ne vois pas à quoi correspond st1 et st2.
(ça vient de ce site : http://www.fabiensanglard.net/bumpMapping/index.php)
Mes normales sont déjà calculées, ce sont les tangentes qui posent problèmes.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 generateNormalAndTangent(float3 v1, float3 v2, text2 st1, text2 st2) { float3 normal = v1.crossProduct(v2); float coef = 1/ (st1.u * st2.v - st2.u * st1.v); float3 tangent; tangent.x = coef * ((v1.x * st2.v) + (v2.x * -st1.v)); tangent.y = coef * ((v1.y * st2.v) + (v2.y * -st1.v)); tangent.z = coef * ((v1.z * st2.v) + (v2.z * -st1.v)); float3 binormal = normal.crossProduct(tangent); }
Je m'arrache les cheveux là dessus...
Merci d'avance.
++
Partager