title: Models appear black in XNA
body: <p>Ive been trying to draw a simple cube in xna but its showing up completely black. Ive tried multiple diffirent FBX models. Played around with the settings for the models in the pipeline. Ive also to apply basic lightning in every way possible. Its still appearing black.</p>
  
  <p>My code:</p>
  
  <pre><code> using Microsoft.Xna.Framework;
   using Microsoft.Xna.Framework.Graphics;
   using Microsoft.Xna.Framework.Input;
   using System;
  
  namespace Game1
  {
  
  public class Game1 : Game
  {
      GraphicsDeviceManager graphics;
      SpriteBatch spriteBatch;
      BasicEffect effect;
      Texture2D floor;
      Model model;
  
      public Game1()
      {
          graphics = new GraphicsDeviceManager(this);
          Content.RootDirectory = "Content";
      }
  
      protected override void Initialize()
      {
          effect = new BasicEffect(graphics.GraphicsDevice);
  
          base.Initialize();
      }
  
      protected override void LoadContent()
      {
          spriteBatch = new SpriteBatch(GraphicsDevice);
          floor = Content.Load&lt;Texture2D&gt;("floor");
          model = Content.Load&lt;Model&gt;("cube");
      }
  
      protected override void UnloadContent()
      {
      }
  
      protected override void Update(GameTime gameTime)
      {
          if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
              Exit();
  
  
          base.Update(gameTime);
      }
  
      protected override void Draw(GameTime gameTime)
      {
          GraphicsDevice.Clear(Color.CornflowerBlue);
          var cameraPosition = new Vector3((float)Math.Cos((double)gameTime.TotalGameTime.TotalMilliseconds/1000)*20, 40, (float)Math.Cos((double)gameTime.TotalGameTime.TotalMilliseconds / 1000) * 20);
          var cameraLookAtVector = Vector3.Zero;
          var cameraUpVector = Vector3.UnitZ;
  
          effect.View = Matrix.CreateLookAt(
              cameraPosition, cameraLookAtVector, cameraUpVector);
  
          float aspectRatio =
              graphics.PreferredBackBufferWidth / (float)graphics.PreferredBackBufferHeight;
          float fieldOfView = Microsoft.Xna.Framework.MathHelper.PiOver4;
          float nearClipPlane = 1;
          float farClipPlane = 200;
  
          effect.Projection = Matrix.CreatePerspectiveFieldOfView(
              fieldOfView, aspectRatio, nearClipPlane, farClipPlane);
  
          effect.TextureEnabled = true;
          effect.Texture = floor;
  
          drawModel(model, effect.World, effect.View, effect.Projection);
  
          foreach (var pass in effect.CurrentTechnique.Passes)
          {
              pass.Apply();
  
              drawQuad(new Vector3[] {
                  new Vector3(20,-20,0),
                  new Vector3(-20,-20,0),
                  new Vector3(-20,20,0),
                  new Vector3(20,20,0),
              },2f);
          }
  
  
          base.Draw(gameTime);
      }
  
      public void drawQuad(Vector3[] p, float tiling)
      {
          VertexPositionNormalTexture[] verts = new VertexPositionNormalTexture[6];
  
          verts[0].Position = p[0];
          verts[1].Position = p[1];
          verts[2].Position = p[3];
  
          verts[3].Position = p[1];
          verts[4].Position = p[2];
          verts[5].Position = p[3];
  
          verts[0].Normal = p[0];
          verts[1].Normal = p[1];
          verts[2].Normal = p[3];
  
          verts[3].Normal = p[1];
          verts[4].Normal = p[2];
          verts[5].Normal = p[3];
  
          verts[0].TextureCoordinate = new Vector2(0, 0);
          verts[1].TextureCoordinate = new Vector2(0, tiling);
          verts[2].TextureCoordinate = new Vector2(tiling, 0);
  
          verts[3].TextureCoordinate = verts[1].TextureCoordinate;
          verts[4].TextureCoordinate = new Vector2(tiling, tiling);
          verts[5].TextureCoordinate = verts[2].TextureCoordinate;
  
          graphics.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, verts, 0, 2);
      }
  
      public void drawModel(Model model, Matrix world, Matrix view, Matrix projection)
      {
          foreach (var mesh in model.Meshes)
          {
              foreach (BasicEffect effect in mesh.Effects)
              {
                      effect.EnableDefaultLighting();
                      effect.DiffuseColor = Color.White.ToVector3(); 
                      effect.World = world;
                      effect.View = view;
                      effect.Projection = projection;
              }
  
              mesh.Draw();
          }
      }
  }
  </code></pre>
  
  <p>}</p>