Problem with tangents (fbx)

Started by
10 comments, last by den_wan 9 years, 3 months ago

so i have some issues with bump mapping meshes made in maya.

using tangents/bitangents generated by maya or generating them myself gives me pretty much the same result.

here some screenshots showing the light vector (light source is at {0, 50, 50}) in tangent space with tangents from maya and self-generated:

3ULTZskl.png

gRsG0aal.png

i'm pretty much out of ideas atm. sad.png

i generate my tangents/bitangents like described here:

http://www.terathon.com/code/tangent.html

just in case here is the code:

http://pastebin.com/S5t9EMJ3

Advertisement

using tangents/bitangents generated by maya

What are you displaying? Tangents, or normals? You should compute binormal as cross porduct of tangent and smooth normal, then display to yorself smooth normals and binormals, those should be smooth, tangents are never smooth. Tangent are equal for all three verticies and are of very triangle plane contained.

using tangents/bitangents generated by maya

What are you displaying? Tangents, or normals? You should compute binormal as cross porduct of tangent and smooth normal, then display to yorself smooth normals and binormals, those should be smooth, tangents are never smooth. Tangent are equal for all three verticies and are of very triangle plane contained.

if you mean the picture, that is the light vector in tangent space.

normals:

t88OqOpl.png

tangents:

EHvOgJCl.png

bitangents:

P5yey3kl.png

bitangents seems incorrect (they should be smooth). Normals are definetly correct, compute the bitangent as the smoothed normal and tangent cross product and display them- if they show smooth, you are all set. And should nat pay attention to tangent vectors not being smooth at all (they never are)

Remeber there are two types of binormals, the one that is truly orthogonal to tangent/ and the one that is cross porduct of the very tangent and of the smoothed normal. The second is wanted , so compute it yourself, and do not pick it from asset defintion, as the asset usualy delivers the real bitangent (the truly orthogonal one- not desired for lightining)

are you sure the tangents are correct ?

because on top of the head there is this weird area.

are you sure the tangents are correct ?

because on top of the head there is this weird area.

That is the seem, they appear where inconsistent mapping happens. it still can appear in your spectating shader, but should not affect lightning if you use correct handedness of tangent. Stop doubting maya generated tangents finaly

What kind of problem are you actually having?

There is no one right way to generate tangents - any method that produces a vector that's perpendicular to the normal is valid.
What is vitally important is that both the art tool that's generating your normal map, and your game, are both using the exact same normals/tangents/bitangents. Otherwise, if the normal-map tool and the game have different vectors, there's absolutely no way to correctly decode the normal map..

ok i guess the pictures in the first post might not show the problem clearly, so here are pictures of diffuse nDotL.

maya generated tangents/bitangents:

oskl7pel.png

self generated tangents/bitangents:

2tg3PfHl.png

the light comes directly from the front.

as you can see the result is partly wrong.

now maya gives you the handedness of the tangent, and i do have some that are left handed, but i don't do anything with that atm and just leave them as they are.

when i generate them myself i compute my bitangent with: cross(n, t) * handedness.

i just exported the normal map in object space, and this is what i get: wacko.png

GFi9Sgcl.png

some triangles have tangents with different handedness, how do i handle that ?

This topic is closed to new replies.

Advertisement