3
\$\begingroup\$

My XNA model renders wrong.

It should render like that:

But it renders like that:

The background doesn't matter. It's just the model that renders wrong.

Here is the drawing code:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);

    DrawModel(model);

    base.Draw(gameTime);
}

private void DrawModel(Model m)
{
    GraphicsDevice.RasterizerState = RasterizerState.CullNone;

    Matrix worldMatrix = Matrix.CreateRotationY(MathHelper.ToRadians(rot))
        * Matrix.CreateTranslation(new Vector3(0,0,0));

    foreach (ModelMesh mesh in m.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = worldMatrix;
            effect.View = viewMatrix;
            effect.Projection = projectionMatrix;
        }

        mesh.Draw();
    }
}
\$\endgroup\$
1
  • \$\begingroup\$ What do you mean with posting the mesh? The model loading code is this: Model model = Content.Load<Model>("Model"); It looks fine in the model editor. The model is saved in a .fbx file \$\endgroup\$ Commented Mar 1, 2013 at 15:36

1 Answer 1

5
\$\begingroup\$

The problem you are describing could be caused by polygons with more than 4 vertices. Please make sure that you have edges in the model as seen in the image below:

\$\endgroup\$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .