   Vertex Buffer - repeated vertex tranformation ?
  Hi All !I'm kinda new in the world of the DirectX (but not in the world of 3D graphics!!), and here I am with the first big question, concerning Vertex Buffer.Let's say I have a mesh (actually, a 3DS model). I fill the VB with all the model's vertexes, and then fill the index buffer. Obviously, a vertex is normally shared by more than one triangle.The question is: when DX starts to render the triangles, what happens when DX encounters in a vertex it has already transformed ? My worry was about the fact that DX could waste time transforming vertexes more than one time.How is this problem addressed ?thanks a lot !bye   
  It shouldn't "encounter a vertex it has already transformed."I am not sure what you mean by that.However, I do understand what you mean by repeating vertex data. Usually when you get a model from a 3d modeler, you have many many triangles that shares the same vertex. Those shared vertices also usually have unique UVs and/or Normals. So, you have to treat that repeating vertex as an entirely seperate vertex.So, if I am feeding my data in as a triangle list and I modeled a textured cube, I could have 24 vertices to feed in. Even though I only have 8 unique positions. Because each of those 8 positions has 3 different UVs and normals, one for each face that shares it.;Quote:Original post by brekehanIt shouldn't "encounter a vertex it has already transformed."I am not sure what you mean by that.However, I do understand what you mean by repeating vertex data. Usually when you get a model from a 3d modeler, you have many many triangles that shares the same vertex. Those shared vertices also usually have unique UVs and/or Normals. So, you have to treat that repeating vertex as an entirely seperate vertex.So, if I am feeding my data in as a triangle list and I modeled a textured cube, I could have 24 vertices to feed in. Even though I only have 8 unique positions. Because each of those 8 positions has 3 different UVs and normals, one for each face that shares it.You hit the nail on the head !Actually, I'm so used to work with software engines, that I forgot that even if the position is the same, DX treats the vertexes as if they were different.Thansk a lot man, this will help me to figure out a framework for my new FPS engine :D!   ;  If order to prevent vertices to be transformed several times, there should be some kind of cache. GPU generally don't have a lot of cache, they prefer to make many calculations in parallel.   ;  The GPU has a small cache (GF 3 caches 24 vertices, newer cards probably more). So you can order your indices so that transformations are cached. Google for cache coherent triangle strips.   ;  This shouldn't be a concern unless you have a very complex vertex shader, but you can also call ID3DXMesh::Optimize if you're using ID3DXMesh to optimize the mesh for vertex cache.   ;Quote:Original post by brekehanSo, if I am feeding my data in as a triangle list and I modeled a textured cube, I could have 24 vertices to feed in.Maybe 36 ?6 faces made of 2 triangles each = 12 triangles12 * 3 = 36 vertexesam i wrong ?   ;Quote:Original post by rozz666The GPU has a small cache (GF 3 caches 24 vertices, newer cards probably more). So you can order your indices so that transformations are cached. Google for cache coherent triangle strips.This is correct, and indeed a large performance gain can be made by using a good cache coherent ordering.  There are several papers on this subject, including at least one from Microsoft -- which should be used in the ID3DXMesh::Optimize() method.;Quote:Original post by NiGoeaQuote:Original post by brekehanSo, if I am feeding my data in as a triangle list and I modeled a textured cube, I could have 24 vertices to feed in.Maybe 36 ?6 faces made of 2 triangles each = 12 triangles12 * 3 = 36 vertexesam i wrong ?Each face is typically 4 vertices, not 6.  Each face is made of two triangles which share an edge.  This edge tends to have the same position, normal, UV, color, etc.   