   Custom vertex format and vertex shader problem
  Hello everyone,I'm working on my little own directx application using c# 2005 and the february dx sdk.In my quest to do normal mapping i got stuck with this problem: I don't know how to pass the tangnet and binormal to the vertex shader. In the vertex shader i have this:struct a2v{float4 position  : POSITION0;    float3 normal    : NORMAL;    float2 texCoord  : TEXCOORD0;    float3 tangent   : TEXCOORD1;    float3 bitangent : TEXCOORD2;};however i can't manage to send the tangent and bitangent information.I am drawing objects using DrawPrimitives function from a triangle list i create manualy - i am not using .x filesSo, to store the information for every vertex i deducted i need a custom vertex format so i created this:public static readonly VertexFormats Format = VertexFormats.Position | VertexFormats.Normal | VertexFormats.Texture2;   public static readonly VertexElement[] Declarator = new VertexElement[]{new VertexElement( 0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0 ),new VertexElement( 0, 12, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0 ),new VertexElement( 0, 24, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0 ),new VertexElement( 0, 32, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Tangent, 0 ),new VertexElement( 0, 44, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.BiNormal, 0 ),VertexElement.VertexDeclarationEnd };My very frustrating problem is that i don't know what to put in the Format of the pixel so it can pass a position, normal, texture coordinates and tagnent, binormal.Upon running the application i noticed that the position, normal and texture coordinates are passed correctly to the vertex shader as well as the TWO first coordinates of the tangent (x and y) without the z and without anything for the binormal.I can't figure out what the problem is and how to make the program to pass the z coordinate as well for the tangent and the 3 extra coordinates for the binormal.Help would be greatly apreciated,Thank you   
  You should be creating a vertex declaration from the vertex elements array, and using that. You shouldn't be using VertexFormats.What you defined in VertexFormats is a vertex containing position, normal and two vertex coordinate sets, each 2 components. Which is why you get 2 components of the tangent.   ;  Thank you for the answer. However, can you direct me to an example where this is done because I'm not sure how to replace the Format with a Declaration.Currently, in the program i use the Format in two places:myVB = new VertexBuffer(Device, myVertices * PositionNormalTangentBitangentTextured.StrideSize, Usage.WriteOnly, PositionNormalTangentBitangentTextured.Format, Pool.Managed, null);  GraphicsBuffer<PositionNormalTangentBitangentTextured> buffer = myVB.Lock<PositionNormalTangentBitangentTextured>(0, 0, LockFlags.None);and before i start rendering:myGraphics.Device.VertexFormat = PositionNormalTangentBitangentTextured.Format;   ;  OW !!I figured it out how to use declaration instead of the format.Thanks for the tip !;  Here is a link to a normal mapping sample I made in Managed DirectX.I hope this helps.Take care.   ;  <quote>OW !!I figured it out how to use declaration instead of the format.Thanks for the tip !</quote>Would you care to share your revelation with the class? I'm having a very similar problem.   