Archived

This topic is now archived and is closed to further replies.

Which vertices can a Mesh's Triangles share? (.X)

This topic is 5016 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 was sitting back and thinking about the Normal-Vectors of the verticies in my meshes (.x). I understand that the Index buffer is used to store which verticies triangles use. IndexBuffer[0], [1], and [2] are Triangle 1, etc. Some verticies are shared between triangles. It has been my understanding that the vertex''s normal vector is the same normal vector as the plane it is associated with (plane which the triangle lays in). So lets be hypothetical... There are 2 Triangles as a part of a larger mesh. If we graphed these triangles, we would see that 1 vertex from each triangle lies at the same x,y,z coordinate. However, the triangles do not lie in the same plane... Does this mean that as far as our Directx is concerned, these 2 triangles MAY NOT share the same vertex... because the vertex would IN FACT need to have 2 different Normal Vectors? (One for each Triangle) As a side note, in my programming I just simply take the normal vector from any vertex in my triangle and use that as my plane''s normal vector. I wonder if I am wrong in doing this... Thanks for your input!

Share this post


Link to post
Share on other sites
A bird whispered in my ear that it may be necessary to average the normal vectors of each vertex in the triangle... but then we got to talking about that and it seemed a silly thing to do...

Share this post


Link to post
Share on other sites
In a complex model, the normal vectors stored in each vertex are rarely the same as the normal of the plane the triangle is in.

What usually happens is that the normal of a vertex is taken by averaging the normals of all the triangles that share that vertex. That way, light will seem to be calculated correctly across a faceted model and it will be less likely that the model will be rendered with visual seams everywhere.

That is what D3DXComputeNormals does when you provide it the adjacency information of the mesh.

neneboricua

Share this post


Link to post
Share on other sites
So, neneboricua19 is probably talking about some sort of custom "complex model" and not a mesh (.X)...

My mesh happens to be the way Mastaba describes it... but I wonder if it will still be that way once I add windows and such to my building...

Share this post


Link to post
Share on other sites
When I say complex model, I mean a model like a human face, an aerodynamic airplane, etc... Models that are meant to look very smooth.

Your case of a building is different. Buildings don''t have many rounded corners. Buildings will usually need to have different vertices because their normals will face different directions depending on which side of the building you''re rendering.

neneboricua

Share this post


Link to post
Share on other sites