   CustomVertex with array
  I am trying to do something like this:In my CustomVertex structure, I have Position, Normal, TextureCoord and I want there also array of texture type. For 4 textures, i can use instead of array Vector4... but I want this as much universal as possible. For 5 textures, I dont want to change structure by adding some Vector2 od something like this.But where is my problem.If I create array of Vector2, then fill VertexElement...ve[0]... ve[2]...for (int i = 0; i < this.weight.Length; i++){ short size = (short)((8 + 2*i) *  sizeof(float)); ve[3 + i] = new VertexElement(0, size, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, (byte)(i + 1));}... ve[ve.Length - 1] = VertexElement.VertexDeclarationEnd;And after calling this:VertexDeclaration vd = new VertexDeclaration(this.device, this.ve);I got Undefined DX-Error But If I create instead of array of Vector2 two variables Vector2 then everything work just fine.Any solution ? Or why is this happening ?   
  Or another way... how can I store variable count of texture weight in vertexbuffer and then work with it in PixelShader (iterate through eaxch texture and each weight)   ;  The vertex structure must have a fixed size. If you want a variable number of values in it, the rest must still be supplied.An alternate way to do this would be to store your weights in a texture, and provide a position and number of weights to read in the vertex structure. However, that'd have a performance impact.   ;  But I have fixed size. I set the fixed arrayfloat[] textureWeight = new float[5]And I set VertexElement on the end, before I fill data to the vertex buffer. So everything should be set up.   ;Quote:ve[ve.Length - 1] = VertexElement.VertexDeclarationEnd;I can't quite tell from your posted code. Do you, in fact, allocate all 5 elements, or just 4, before VertexDeclarationEnd?   ;  Ok.. for now i figured out the error. But still I have black window, if I post that array into Vertex / Pixel Shader. Doing that this way is, i mean, death end, because in HLSL, i cannot have this:float data[] : TEXCOORD0So my solution is not going to work :(   