EnableDefaultLighting() black models

I currently have a problem with black models with the fbx format and there’s no error messages.
The texture is working when im using the collada format, but when I set EnableDefaultLighting() I have black models again.
I tried loading the texture with the contentmanager and setting the basiceffect texture and enable texture.

    public void Draw(Vector3 cameraPosition, float aspectRatio)
    {
        foreach(var mesh in model.Meshes)
        {
            foreach(BasicEffect effect in mesh.Effects)
            {
                var cameraLookAtVector = Vector3.Zero;
                var cameraUpVector = Vector3.UnitZ;
                float fieldOfView = Microsoft.Xna.Framework.MathHelper.PiOver4;
                float nearClipPlane = 1;
                float farClipPlane = 200;
                effect.View = Matrix.CreateLookAt(
                    cameraPosition, cameraLookAtVector, cameraUpVector);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    fieldOfView, aspectRatio, nearClipPlane, farClipPlane);
                effect.World = GetWorldMatrix();

                effect.EnableDefaultLighting();
                effect.DiffuseColor = Color.White.ToVector3();
                effect.Texture = texture;
                effect.TextureEnabled = true;
            }
            mesh.Draw();
        }
    }
1 Like

Hi! I have got the same problem. Did anyone find any solutions for this? Or what can cause the problem?

For anyone who is interested I had the same issue and solved it. In my case it turned out to be the normals not been calculated correctly. This is now my normal calculation code.

 public static VertexPositionColourNormal[] CalculateNormal(VertexPositionColourNormal[] verts)
        {
            for (int i = 0; i < verts.Length; i++)
                verts[i].Normal = Vector3.Zero; //set all normals to zero

            for (int i=0;i< verts.Length / 3; i++)
            {

                    int index1 = i * 3;
                    int index2 = i * 3 + 1;
                    int index3 = i * 3 + 2;

                    Vector3 side1 = verts[index1].Position - verts[index3].Position;
                    Vector3 side2 = verts[index1].Position - verts[index2].Position;
                    Vector3 normal = Vector3.Cross(side1, side2);

                    verts[index1].Normal += normal;
                    verts[index2].Normal += normal;
                    verts[index3].Normal += normal;
            }

            return verts;
        }

VertextPositionColourNormal is just a custom Vertext Struct so replace that with whatever you need.

It’s possible your model is being lit, just not enough (if you exported it from Blender for instance).

Try setting DiffuseColor to Color.White.ToVector3() * 4f to increase the brightness.

Sorry I’m a few years late answering this question but I just had this same problem and came across this post, saw that it still wasn’t solved… so when I finally solved it for myself I felt compelled to answer for others who might stumble where I have.

That being said, for me, what finally worked was to go into Blender and select your MATERIAL and set it’s “roughness” setting to a value of less than ONE. This caused my black blotchy models to finally get colored properly. Hope this helps someone.