0
\$\begingroup\$

I'm trying to render a model made in Blender. I export it to .fbx and import it in the content pipeline, load and draw it, but it displays like this:

enter image description here

And this is what it looks like in Blender:

enter image description here

Code that draws the model:

foreach (ModelMesh modelMesh in model.Meshes)
{
    foreach (BasicEffect basicEffect in modelMesh.Effects)
    {
        basicEffect.EnableDefaultLighting();
        basicEffect.PreferPerPixelLighting = true;
        basicEffect.World = Matrix.CreateTranslation(Position);
        basicEffect.View = camera.ViewMatrix;
        basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(width / height, MathHelper.PiOver2, 0.1f, 100f);
    }

    modelMesh.Draw();
}

Does anyone know what's wrong with the model?

\$\endgroup\$
  • \$\begingroup\$ Looks like you're not using the depth buffer — either not reading it, or not writing to it. \$\endgroup\$ – DMGregory Aug 8 '19 at 11:15
  • \$\begingroup\$ I don't know what that is. Is that in MonoGame or Blender? \$\endgroup\$ – Logan Aug 8 '19 at 11:17
  • \$\begingroup\$ Did you search the term to find out? Don't underestimate your ability to find your own answers! This previous user experienced similar symptoms due to how they configured their camera — putting the near plane too close to the camera and the far plane too far, so there wasn't enough depth resolution to correctly sort scene fragments at typical view distances. \$\endgroup\$ – DMGregory Aug 8 '19 at 11:22
  • \$\begingroup\$ Yeah, I was having a look and I saw some stuff about the near and far clip planes and now I understand them even less. Setting the near to 1 didn't help. \$\endgroup\$ – Logan Aug 8 '19 at 11:24
  • \$\begingroup\$ Maybe you should show us your current settings then. \$\endgroup\$ – DMGregory Aug 8 '19 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.