AREA forums upgrade
Read more about the planned upgrade of our forums
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / SDK / 3DXI Exporting Normal, Tangent and Binormal
IMPORTANT ANNOUNCEMENT ABOUT AREA FORUMS
  RSS 2.0 ATOM  

3DXI Exporting Normal, Tangent and Binormal
Rate this thread
 
25160
 
Permlink of this thread  
avatar
  • Orcun_
  • Posted: 06 April 2009 06:43 PM
  • Total Posts: 4
  • Joined: 14 June 2008 02:26 PM

Hi,
I’m trying to export scene meshes to file by using 3DXI. (IGame) However, I can’t correct normal, tangent and binormal information. I want to export them as world coordinates.

Here is my code. It export correct position and texture coordinates but it’s exported normals, binormals and tangents are totaly wrong. I can’t figure out the problem in here. Documentation is not clear about this subject.

// Mesh is IGameMesh
// CurrentFilePortal is a custom data structre that holds information about polygons and vertices. (Triangle list)

Mesh->InitializeData();
Mesh->InitializeBinormalData();
Mesh->SetUseWeightedNormals();
for (
int I 0Mesh->GetNumberOfFaces(); I++)
{
    FaceEx
Face;
    
Face Mesh->GetFace(I);
    for (
int N 03N++)
    
{   
        CurrentFilePortal
->Polygons[I].Material ProcessFaceMaterial(Mesh->GetMaterialFromFace(I));
        
MapFileVertexVertex = &CurrentFilePortal->Polygons[I].Vertices[N];
        
int BinormalTangentIndex Mesh->GetFaceVertexTangentBinormal(IN);

        
Mesh->GetVertex(Face->vert[N], *(Point3*)&Vertex->Positionfalse);
                
        
Mesh->GetNormal(IN, *(Point3*)&Vertex->Normalfalse);
        
Vector3::Normalize(Vertex->NormalVertex->Normal);
                
        
Mesh->GetTangent(BinormalTangentIndex, *(Point3*)&Vertex->Tangent);
        
Vector3::Normalize(Vertex->TangentVertex->Tangent);
                
        
Mesh->GetBinormal(BinormalTangentIndex, *(Point3*)&Vertex->Binormal);
        
Vector3::Normalize(Vertex->BinormalVertex->Binormal);
                
        
Mesh->GetTexVertex(Face->texCoord[N], *(Point2*)&Vertex->Texcoord);
    
}
}

All I want to do is exporting polygons vertices in world coordinates. (Without indexing just triangle list) Any help will be very appreciated.

Thanks.
Orcun



Replies: 0