Jump to content
  • Advertisement
Sign in to follow this  
muhkuh

What is the face normals section in x files for

This topic is 4842 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

Hi, I'm manually parsing x files. In the MeshNormals section there are normals for every vertex. This is followed by a "facenormals". For every face there are 3 indices. These indices point into the normals array saying which normals belong to this face. Seems to me the facenormals indices are actually the same as the face indices the mesh section contains. Is this really redundant data or what are these face normals for?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Nope, it's not redundant, because in an optmized X file the number of faces can be different from the number of vertices. In this case, the normal indices will be different from than the vertex indices. For example, consider the following single model (a box):

Mesh Box {
8;
-42.512074;-51.207726;48.309170;,
42.512081;51.207726;48.309177;,
-42.512074;51.207726;48.309177;,
42.512081;-51.207726;48.309170;,
-42.512074;-51.207722;-48.309177;,
42.512081;51.207733;-48.309174;,
42.512081;-51.207722;-48.309177;,
-42.512074;51.207733;-48.309174;;
12;
3;0,1,2;,
3;1,0,3;,
3;4,5,6;,
3;5,4,7;,
3;0,6,3;,
3;6,0,4;,
3;3,5,1;,
3;5,3,6;,
3;1,7,2;,
3;7,1,5;,
3;2,4,0;,
3;4,2,7;;

MeshNormals {
6;
0.000000;-0.000000;1.000000;,
0.000000;0.000000;-1.000000;,
0.000000;-1.000000;-0.000000;,
1.000000;0.000000;0.000000;,
0.000000;1.000000;0.000000;,
-1.000000;0.000000;0.000000;;
12;
3;0,0,0;,
3;0,0,0;,
3;1,1,1;,
3;1,1,1;,
3;2,2,2;,
3;2,2,2;,
3;3,3,3;,
3;3,3,3;,
3;4,4,4;,
3;4,4,4;,
3;5,5,5;,
3;5,5,5;;
}
}

Notice that there are 8 vertices (8 different vertex indices), but you need just 6 normals (6 different normal indices)... although, for each face, the program always requires 3 vertex positions and 3 vertex normals (which is made through the indices).

Share this post


Link to post
Share on other sites
Ahaaaa! Thanks. Might I add another question:

When doing skeletal animation there is a skinweights section per bone inside the mesh section containing a skin offset matrix. So every mesh can have a different skin offset matrix for every bone. In a tutorial I read there was just one skin offset matrix stored per bone. Why that? Is it uncommon to have multiple meshes in an x file that do have different skin offset matrices for the same bone?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!