I am using Monogame 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?


The missing piece of the puzzle:

use depthStencilState <- new DepthStencilState ()

depthStencilState.DepthBufferEnable <- true

this.GraphicsDevice.DepthStencilState <- depthStencilState

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.