Normal mapping w/ texture mirroring (Tangent and bi-Tangent calculation).

Started by
1 comment, last by Mahmud Hasan 9 years, 5 months ago

Hi,

I am having some issue rendering model that has mirrored mesh.

I am having split lighting while using it with normal map and directional lights.

We are exporting the models from Max and in my conversion tool I am re-calculating the tangent and bitangent.

However, the output is as follows with single directional light.

[sharedmedia=gallery:images:5802]
To make sure there was no problem getting the tangent and bitangent correct,
I rendered the normal, tangent and bitangnet as follows:
[sharedmedia=gallery:images:5803]

Can anyone suggest me any solution or clue why it is happening?

are my tangent and bi-tangents are coming out correctly (2nd image)?

Thanks,

P

Advertisement


clue why it is happening?

Got the same issues a few years back, so read with care. There might be a better/correcter solution smile.png

If I remember correctly , then you have trouble with changing the handness of your transformation matrix. Sure, the surface normal is still point outside your model (which is needed for the light calculation), but the "normal" of the transformation matrix should be pointing inside when mirrored. Practically the green lines on the left side should point inside the model to be correct.

This leads to an second issue: when do you need to invert the normal from the transformation matrix to get the correct surface normal ? Well, I have saved it in as sign of an else always positive value (I use a quaternion to represent the tangent space matrix) to encode the "handness".

Thanks! I found the issue.

Problem was not in my conversion data but the shader.

Shader was messing it up which was not written by me!! :-)

This topic is closed to new replies.

Advertisement