1
\$\begingroup\$

I am using a library to load an obj but it doest compute the tangets for each vertex, which I need for normal mapping and pom. I computed my tangets, and bitangents, everything appears to be fine, but I read that I need to average tangents if the vertices are the same (same position, uv, normal).

So for example if there is a vertex v that has the same pos,uv & norms as vertex v1 and v2, then the tangent for vertex v, v1, and v2 is normalize(v.t + v1.t + v2.t)?

I want to make sure I have the correct understanding before implementing.

\$\endgroup\$
2
\$\begingroup\$

Normalizing would simply divide those combined values by their magnitude.

You just need to find the mean, of which you can add each individual component and thereafter divide by the total number of overlapping vertices.

(v.t + v1.t + v2.t) / 3

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ So then now v, v1, and v2 will all share the same tangent? \$\endgroup\$ – Infodayne Feb 4 '15 at 14:30
  • \$\begingroup\$ Yes, an averaged/smoothed one that lay between all 3. \$\endgroup\$ – Tannz0rz Feb 4 '15 at 14:31
  • 2
    \$\begingroup\$ Since you'll generally want the tangent to be a unit vector for any use you're putting it to, normalizing is not a bad idea. ;) \$\endgroup\$ – DMGregory Feb 4 '15 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.