normal x tangent = binormal?

Started by
4 comments, last by interfoz 16 years, 2 months ago
my english is poor,sorry :) look at the picture max2eu8.jpg 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]
Advertisement
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...
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...
Quote:Original post by cignox1
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...


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).
i use ogre,it support gl and dx both.


Quote:Original post by mossmoss

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).


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

i hope the question resolved in max.
Quote:Original post by cignox1
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...


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

This topic is closed to new replies.

Advertisement