Sign in to follow this  

normal x tangent = binormal?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

my english is poor,sorry :) look at the picture [img]http://img111.imageshack.us/img111/7171/max2eu8.jpg[/img] 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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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. :(

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this