0

I recently upgraded my old Monogame project to the latest version of Monogame. Everything is running as it used to, however, my imported .FBX models are appearing as pure black (implying that they're not being lit up).

enter image description here

(The burgers+tapes are made dynamically using Quads at runtime. They are affected by the lighting as they should be).

My code (which worked in older versions of Monogame) for displaying a model is as follows:

public override void Draw()
    {
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.World = Matrix.CreateRotationZ(rotX);
                effect.World *= Matrix.CreateRotationX(rotY);
                effect.World *= Matrix.CreateTranslation(new Vector3(pos.X,
                                                                    pos.Y,
                                                                    0f));

                effect.View = MainGame.matrixView;
                effect.Projection = MainGame.matrixProj;

                effect.TextureEnabled = true;
                effect.Texture = tex;

                effect.EnableDefaultLighting();
                effect.AmbientLightColor = new Vector3(0.2f, 0.2f, 0.2f);
                effect.EmissiveColor = new Vector3(1, 0, 0);
            }

            mesh.Draw();
        }
    }

The models are exporteed from Blender as FBX 7.4 Binary (the project doesn't compile if I use FBX 6.1 ASCII).

Thanks in advance. I hope it's not something silly I've overlooked.

Milun
  • 91
  • 1
  • 7

2 Answers2

2

I see that I'm quite a few years late to help you but I just figured this out for myself. For me anyway, the problem was solved by taking the .FBX file in Blender and reducing any Material's Roughness setting to any value less than 1. Any material with Roughness set to the max value (1) would mostly show up just black.

0

I was having the same issue last week. I'm thinking this is actually a problem with Blender's Binary FBX exporter where the Textures aren't being exported or referenced in the *.FBX file properly. I'm assuming this because I built the ASCII version in XNA and then referenced the compiled *.xnb file in the monogame version of the game and it render's properly. The fix I've been using is:

Export too ASCII and Build in XNA First
It's not the cleanest way to do it, but until the fbx exporter get's patched it's what is needed.

Reference The *.xnb file in MonoGame
Reference your compiled XNB files and set the 'Build Action' as 'Copy'. But just remember you'll need to reference your built texture files as well.

Hope this clears it up.

RT Roe
  • 106
  • 7