Teofuzz

10-07-2002, 11:32 PM

This is not really really an ogl related question, but since I use it and I need your help, let's go!

I'm computing (for dot3 use) for every triangle the local tangent (or texture) space, then for every vertex averaging the triangle ones.

But before averaging them, I need to discover if a triangle in object space has opposite area than in texture space, so I can reverse the normal to ensure proper lighting.

How can I detect this?

I have, for every triangle:

Vert coord (x1y1z1 x2y2z2 x3y3z3)

Tex coord (u1v1 u2v1 u3v3)

Then using some algebra, I get tangent, normal and binormal.

I also have the normal for standard lighting per vertex...

How can I use this information to discover if I have to negate the normal?

Thx in advance!!

fz

I'm computing (for dot3 use) for every triangle the local tangent (or texture) space, then for every vertex averaging the triangle ones.

But before averaging them, I need to discover if a triangle in object space has opposite area than in texture space, so I can reverse the normal to ensure proper lighting.

How can I detect this?

I have, for every triangle:

Vert coord (x1y1z1 x2y2z2 x3y3z3)

Tex coord (u1v1 u2v1 u3v3)

Then using some algebra, I get tangent, normal and binormal.

I also have the normal for standard lighting per vertex...

How can I use this information to discover if I have to negate the normal?

Thx in advance!!

fz