0
\$\begingroup\$

I have a problem getting blender models to show in monogame on windows. Using latest monogame 3.4, fresh blender 2.76b, developing in Visual Studio 2010 using OpenGL Monogame template.

What I'm trying to do is to create a simple model in blender - a sphere, export it as FBX, getting it properly into Monogame Pipeline - here it compiles fine. But then it's invisible in the application. I load it this way:

model = Content.Load<Model>("MyBall");

I draw it this way:

model.Draw(Matrix.Identity, camera.View, camera.Projection);

Also tried other drawing method with enumerating meshes.

The code seems to work in general, because I can see a model which I downloaded from Internet. However I got one or two working, with tens of other downloaded models which don't work and tens which the Pipeline tool will not accept.

I can move around in my app to make sure I' m not inside a model. Also tried adding material in Blender but with no luck. But I'm still learning Blender.

Also tried Autodesk FBX converter, but didn't help anything.

Where's the catch?

\$\endgroup\$
2
\$\begingroup\$

Okay, found it. Used this to draw the model:

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (BasicEffect modelEffect in mesh.Effects)
    {
        modelEffect.EnableDefaultLighting();
        modelEffect.World = Matrix.Identity;
        modelEffect.View = camera.View;
        modelEffect.Projection = camera.Projection;
        modelEffect.Alpha = 1;
    }

    mesh.Draw();
}

And the critical thing in this is to add modelEffect.Alpha = 1.

\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.