So I followed the basic 3D model display tutorial found here: http://msdn.microsoft.com/en-us/library/bb197293%28v=xnagamestudio.31%29.aspx
And while I know this is for XNA 3.1, I can still get the screen to show and the background color to change fine. The model file seems to be accepted in the method below:
protected override void LoadContent()
{
// Used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
grudmud = Content.Load<Model>("Models\\Vikings_grudmud");
aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
}
The model was created in Blender, so perhaps I'm missing a step in creating a mesh or certain texture for it? I have colored it in Blender and it's a simple blocky humanoid figure. Is there a scaling I should check in Blender so the camera in XNA is not inside the object?
Here's where I actually draw the object and set out some basic properties:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Aqua);
Matrix[] transforms = new Matrix[grudmud.Bones.Count];
grudmud.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in grudmud.Meshes) {
foreach (BasicEffect effect in mesh.Effects) {
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateRotationY(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);
effect.PreferPerPixelLighting = true;
}
mesh.Draw();
}
base.Draw(gameTime);
}
The initial camera and player model positions:
Vector3 modelPosition = Vector3.Zero;
float modelRotation = 0.0f;
Vector3 cameraPosition = new Vector3(0.0f, 50.0f, 5000.0f);
I haven't even attempted to implement the face texture yet.
It seems to have a wireframe/mesh, I've just colored in the faces. The model is pretty much centered around the origin.
Am I exporting it wrong? Do I need to specify lighting/camera angles any further?