Error when drawing models with custom effects

I’m trying to draw a model but this time I would like to use my own shader effect. But Monogame gives me an error about not having the proper vertex declaration.

“The current vertex declaration includes these elements: SV_Position0, NORMAL0, TEXCOORD0.”

My draw code looks like this.

        foreach (ModelMesh mesh in TestModel.Meshes)
        {
            foreach (ModelMeshPart part in mesh.MeshParts)
            {
                part.Effect =Shader;
                part.Effect.Parameters["WorldViewProjection"].SetValue(World * View * Proj);
                mesh.Draw();
            }
        }

The effect was generated by the pipeline tool. I haven’t even edited it yet.

Is your model exported with normals?

No, I actually figured out the problem after trial and error. The shader that I was using had the COLOR semantic, and Blender doesn’t export models with vertex colors.

1 Like