   Drawing meshes with shaders (DirectX)
  okay so i can draw the mesh using a shader no problem. but i dont know how i am meant to pass in the material for each part. I currently haveeffect->getEffect()->Begin(&passes,0);effect->getEffect()->BeginPass(0);for (int i=0;i< Mtrl.size();i++){Device->SetMaterial(Mtrl);//Device->SetTexture(0,Texture);Mesh->DrawSubset(i);}effect->getEffect()->EndPass();effect->getEffect()->End();But im sending in a colour to use with the pixel shader. so all my objects are drawn red. how do i pass in the materials.
  Hi,Write your own material struct in your shader and program. Like this:In kjhgdkfjgd.cpp;typedef struct __MATERIAL{   D3DXCOLOR diffuse;   D3DXCOLOR ambient;   D3DXCOLOR specular;   //etc...} MATERIAL;//...MATERIAL mat;And in kjahslkdja.fx;struct MyMat{   float4 diffuse;   float4 ambient;   float4 specular;   //etc...};//...MyMat objMat;You can pass an object in type MATERIAL by using ID3DXEffect::SetValue() function. Like this:pMyEffect->SetValue ("objMat", &mat, sizeof (MATERIAL));Just a note: You know, you must fill your custom "mat" object with original material property values (e.g. while loading an .x file) as well. If you don't do that, how can your shader know the values? :)HTH.Rohat.   