(Solved) Draw model with custom effect vertex declaration issue

Hi, guys, i got this issue when i try to draw model. Can anyon help?

Error: Additional information: An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, NORMAL0, TEXCOORD0.

#include "Common.fxh" //------------------------------- // Shaders //------------------------------- struct VertexShaderInput { float4 Position : SV_POSITION0; float3 Normal : NORMAL0; float2 TexCoord : TEXCOORD0; float3 Binormal : BINORMAL0; float4 Tangent : TANGENT0; }; struct VertexShaderOutput { float4 Position : SV_POSITION0; float3 TexCoord : TEXCOORD0; float Depth : TEXCOORD1; float3 Normal : TEXCOORD2; float3 Tangent : TEXCOORD3; float3 Binormal : TEXCOORD4; };

struct PixelShaderInput
{
float4 Position : SV_POSITION0;
float3 TexCoord : TEXCOORD0;
float Depth : TEXCOORD1;
float3 Normal : TEXCOORD2;
float3 Tangent : TEXCOORD3;
float3 Binormal : TEXCOORD4;
};

VertexShaderOutput RenderToGBufferVertexCommon(VertexShaderInput input, float4x4 instanceTransform)
{
VertexShaderOutput Out = (VertexShaderOutput)0;

float4x4 worldView = mul(instanceTransform, View);
float4x4 worldViewProjection = mul(worldView, Projection);

float3 viewSpacePos = mul(input.Position, worldView);
Out.Position = mul(input.Position, worldViewProjection);
Out.TexCoord.xy = input.TexCoord; //pass the texture coordinates further

//we output our normals/tangents/binormals in viewspace
Out.Normal = normalize(mul(input.Normal, worldView));
Out.Tangent = normalize(mul(input.Tangent, worldView));
Out.Binormal = normalize(mul(input.Binormal, worldView));

Out.Depth = viewSpacePos.z; //pass depth
return Out;

}

//render to our 2 render targets, normal and depth
struct PixelShaderOutput
{
float4 Normal : COLOR0;
float4 Depth : COLOR1;
};

PixelShaderOutput RenderToGBufferPixelShader(PixelShaderInput input)
{
PixelShaderOutput Out = (PixelShaderOutput)1;

half4 normalMap = tex2D(normalMapSampler,input.TexCoord);
half3 normalViewSpace = NormalMapToSpaceNormal(normalMap.xyz, input.Normal, input.Binormal, input.Tangent);

Out.Normal.rg = EncodeNormal(normalize(normalViewSpace));

if (!Transparency)
	Out.Normal.b = 0;

Out.Depth.x = -input.Depth / FarClip;
return Out;

}

VertexShaderOutput RenderToGBufferVertexShader(VertexShaderInput input)
{
return RenderToGBufferVertexCommon(input, World);
}

technique RenderToGBuffer
{
pass RenderToGBufferPass
{
CullMode = CCW;
VertexShader = compile vs_4_0_level_9_3 RenderToGBufferVertexShader();
PixelShader = compile ps_4_0_level_9_3 RenderToGBufferPixelShader();
}
}

Sry i just found out actually is my mistake.I forgot to generate tangent frame in model processor. Now it’s worked

Can you share the fixed version so others can learn from it?