# normal x tangent = binormal?

This topic is 3901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

my english is poor,sorry :) look at the picture normal x tangent = binromal? i build a model by mirror,but i take some problem. the mirror half of model is error, binromal is error by normal x tangent. result is right when i use binormal by 3dsmax provide. why normal x tangent unequal to 3dxmax's binormal? --------------------------------------------------------- shader: struct VSIn { float4 Position : POSITION; float3 Normal : NORMAL; float3 Tangent : TANGENT; float3 BiNormal : BINORMAL; float2 UV0 : TEXCOORD0; float3 Colour : TEXCOORD1; float3 Alpha : TEXCOORD2; float3 Illum : TEXCOORD3; float3 UV1 : TEXCOORD4; float3 UV2 : TEXCOORD5; float3 UV3 : TEXCOORD6; float3 UV4 : TEXCOORD7; }; struct VSOut { float4 Position : POSITION; float4 UV0 : TEXCOORD0; float3 LightDir : TEXCOORD1; float3 Normal : TEXCOORD2; float3 ViewDir : TEXCOORD3; }; struct PSIn { float4 UV0 : TEXCOORD0; float3 LightDir : TEXCOORD1; float3 Normal : TEXCOORD2; float3 ViewDir : TEXCOORD3; }; struct PSOut { float4 Colour : COLOR; }; VSOut VS(VSIn vsIn) { VSOut vsOut; vsOut.Position = mul(vsIn.Position, WorldViewProj); vsOut.LightDir = vsIn.Tangent; vsOut.Normal = vsIn.Normal; vsOut.ViewDir = cross(vsIn.Tangent, vsIn.Normal); //calculate binormal //vsOut.ViewDir = vsIn.BiNormal; //3dsmsx's binormal vsOut.UV0 = float4(vsIn.UV0,1,1); return vsOut; } PSOut PS( PSIn psIn ) { PSOut psOut; psOut.Colour = float4(psIn.ViewDir,1); return psOut; } [Edited by - interfoz on February 17, 2008 8:53:28 PM]

##### Share on other sites
I don't know if this could be the reason, but what does 3dstudio max when you mirror the geomtry? Does it mirror the tangent as well? Because if this is the case, then the bitangent will point the wrong direction. I remember there was a discussion here on gamedev some time ago about mirrored geometry, but it could heve been about uv mapping as well, I'm not sure...

EDIT: check out these two topics:
http://www.gamedev.net/community/forums/topic.asp?topic_id=340745
http://www.gamedev.net/community/forums/topic.asp?topic_id=352834&forum_id=12&gforum_id=0

They may be usefull...

##### Share on other sites
I am just guessing here, but are you using DX or GL? IIRC 3DS coordinate system is not aligned to GL's and I have no idea if DX matches up with 3DS coordinate system...

##### Share on other sites
Quote:
 Original post by cignox1I don't know if this could be the reason, but what does 3dstudio max when you mirror the geomtry? Does it mirror the tangent as well? Because if this is the case, then the bitangent will point the wrong direction. I remember there was a discussion here on gamedev some time ago about mirrored geometry, but it could heve been about uv mapping as well, I'm not sure...EDIT: check out these two topics:http://www.gamedev.net/community/forums/topic.asp?topic_id=340745http://www.gamedev.net/community/forums/topic.asp?topic_id=352834&forum_id=12&gforum_id=0They may be usefull...

The mirrored geometry would almost certainly be the problem.

The solution I've used is to include a bias term of either +1 or -1. (Can conviently fit into the w component of the shader register containing the xyz of your normal.)

So bitangent = bias * (normal x tangent).

##### Share on other sites
i use ogre,it support gl and dx both.

Quote:
 Original post by mossmossThe mirrored geometry would almost certainly be the problem.The solution I've used is to include a bias term of either +1 or -1. (Can conviently fit into the w component of the shader register containing the xyz of your normal.)So bitangent = bias * (normal x tangent).

ofusion (a exporter of ogre) don't support texturecoord of float3, and must 0 <= texturecoord.xy <=1.

i hope the question resolved in max.

##### Share on other sites
Quote:
 Original post by cignox1I don't know if this could be the reason, but what does 3dstudio max when you mirror the geomtry? Does it mirror the tangent as well? Because if this is the case, then the bitangent will point the wrong direction. I remember there was a discussion here on gamedev some time ago about mirrored geometry, but it could heve been about uv mapping as well, I'm not sure...EDIT: check out these two topics:http://www.gamedev.net/community/forums/topic.asp?topic_id=340745http://www.gamedev.net/community/forums/topic.asp?topic_id=352834&forum_id=12&gforum_id=0They may be usefull...

these postes have not explain how to resolve the question. :(

1. 1
Rutin
48
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 11
• 16
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633003
• Total Posts
3009846
• ### Who's Online (See full list)

There are no registered users currently online

×