1
\$\begingroup\$

I am using pipeline.exe tool, to convert an .fbx file I made using Blender (using the default Blender 2.73a export settings) to .xnb, and then manually copy and paste it in my content directory (Is this one of the correct ways to convert it properly ?).

After watching this video https://www.youtube.com/watch?v=u7tLYMPC828 I saw that you have to convert the .fbx file that you create using blender, to a new .fbx file, using a tool called fbx converter 2013, and then use that file in the pipeline.exe tool, to produce the final .xnb file. Without doing that, I can't even see my model when drawn on the screen.

With the steps I described above, I managed to see the .xnb file on my screen but it was not exactly the original model I had made. For example:

1

As you can see the real model I got (after the convertion with the fbx converter 2013) is much longer, whereas the one on the left (the one I draw in my game), is like packed in a small square.

If you are using blender, please let me know how do you import the .fbx to your Monogame project. (Or you can suggest to me another software you are using to make models and tell me your method of importing models to Monogame)

This is how I am drawing my model:

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

    Vector3 modelPosition = new Vector3(-25, 0, 0);
    float modelRotation = 0;
    float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

    // Draw the model. A model can have multiple meshes, so loop.
    foreach (ModelMesh mesh in Brick.Meshes)
    {
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 50.0f);
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = Matrix.CreateRotationZ(modelRotation)* 
                Matrix.CreateTranslation(modelPosition);
            effect.View = Matrix.CreateLookAt(cameraPosition,
                Vector3.Zero, Vector3.Up);
            effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
        }
        // Draw the mesh, using the effects set above.
        mesh.Draw();
    }
    base.Draw(gameTime);
}

Edit: I also tried exporting to .X from blender and when i converted to .xnb, loaded the model and drew it, nothing shows up.

\$\endgroup\$
0
\$\begingroup\$

Ok, I finally realized what the problem was... my drawing code was incorrect. I tried https://msdn.microsoft.com/en-us/library/bb197293(v=xnagamestudio.31).aspx code from msdn website and it all worked out. I am stupid. Also, downloading https://msxna.codeplex.com/releases/view/117230 and installing all the files in the correct order (following the instructions .txt) fixed the monogame content project error I was having where I couldn't create the project (error missing project subtype 6D335F3A-9D43-41b4-9D22-F6F17C4BE596), obviously because I hadn't installed things properly.

\$\endgroup\$

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.