1
\$\begingroup\$

I am using Monogame 3.7.0.7 on Linux and Blender.

I have exported my model using the "FBX 7.4 Binary" exporter. Here is a render from Blender:

enter image description here

However, when rendered by Monogame, it does not look right:

enter image description here

My render code is very standard (F#)

    let model = this.Content.Load<Model> @"Skull"

    for mesh in model.Meshes do
      for effect in mesh.Effects do
        match effect with
        | :? BasicEffect as effect ->
          effect.EnableDefaultLighting ()
          effect.TextureEnabled <- true
          effect.PreferPerPixelLighting <- true

          effect.World <-
            Matrix.CreateScale (16.0f) *
            Matrix.CreateTranslation (Vector3.Up * 32.0f + Vector3.Backward * 128.0f)

          effect.View <- view
          effect.Projection <- projection
        | _ -> ()

      mesh.Draw ()

How should I export models from Blender for use in Monogame?

\$\endgroup\$
1

1 Answer 1

2
\$\begingroup\$

The missing piece of the puzzle:

use depthStencilState <- new DepthStencilState ()

depthStencilState.DepthBufferEnable <- true

this.GraphicsDevice.DepthStencilState <- depthStencilState
\$\endgroup\$

You must log in to answer this question.

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