Load 3D Model in VisualStudio 15

Good evening all, this is my first post and I appreciate who could help me with this :slightly_smiling:

I’m actually using VisualStudio 2015 plus Monogame 3.5.

I’ve just started reading “3D Graphics with XNA Game Studio 4.0” (it’s a little bit dated, but I think it’s fine anyway) and I’ve tried to reply the first very simple application.
The application only consists in showing a 3D model in a blue background.

The code is the following:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace Game2
{
    public class Game1 : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Model model;
        Matrix[] transforms;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 800;
        }
        
  
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            model = Content.Load<Model>("Avent");
            transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
            
        }


        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            Matrix view = Matrix.CreateLookAt(
                new Vector3(200, 300, 900), 
                new Vector3(0, 50, 0), 
                Vector3.Up);

            Matrix projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45),
                GraphicsDevice.Viewport.AspectRatio,
                0.1f, 10000.0f
                );

            Matrix baseWorld = Matrix.CreateScale(0.4f) *
                Matrix.CreateRotationY(MathHelper.ToRadians(180));

            foreach (ModelMesh mesh in model.Meshes)
            {
                Matrix localWorld = transforms[mesh.ParentBone.Index] * baseWorld;

                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    BasicEffect e = (BasicEffect)part.Effect;

                    e.World = localWorld;
                    e.View = view;
                    e.Projection = projection;

                    e.EnableDefaultLighting();
                }

                mesh.Draw();

            }

            base.Draw(gameTime);
        }
    }
}

I basically use two types of 3D models: .FBX and .OBJ.
In both cases, I get the following error while debugging:

Additional information: Could not load DIRECTORY asset as a non-content file!

reffering to the code line

model = Content.Load(“Avent”);

(Images attached)


Thanks a lot :smile:

easy mistake:

model = Content.Load("**Models/**Avent");

since you don’t have Avent(ador?) in the main content folder, but in the subfolder “models”

Thanks a lot!

I tried both AudiR8 and Avent( yes - Aventador :)).

AudiR8 gives the same error message as before, while Avent shows me only a blue background :frowning: