I'm trying to use Blender to make a simple playing card with a texture on either side for the face and back and load it in to Monogame. The model itself is fine and shows on the emulator when run but I can't seem to get the textures included though.
The textures on the card seem to render ok in Blender. The materials are set to 'shadeless' so they shouldn't be affected by light levels correct?
I've tried using the different version settings and various different path modes from 'copy' to 'strip path' when exporting the file.
The content manager has the output directory set to the main content folder so there shouldn't be a referencing problem with the textures I hope.
All the textures themselves are in the same folder.
The content is all loaded manually in to Visual Studio.
Here's the code I'm using to draw the card showing the different light settings I've played around with.
private void DrawCard(Model m, Vector3 v, CardFacing c, PlayerFacing p)
{
foreach (var mesh in m.Meshes)
{
foreach (var effect1 in mesh.Effects)
{
var effect = (BasicEffect)effect1;
effect.TextureEnabled = true;
effect.EnableDefaultLighting();
//effect.PreferPerPixelLighting = true;
//effect.AmbientLightColor = Color.White.ToVector3();
effect.DiffuseColor = Color.White.ToVector3();
//effect.EmissiveColor = Color.White.ToVector3() * 2f;
//effect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(0, 0, 1));
effect.Alpha = 1;
effect.VertexColorEnabled = false;
Matrix mCardFacing = new Matrix();
switch(c)
{
case CardFacing.Down:
mCardFacing = Matrix.CreateRotationY((float)(Math.PI / 180) * 180) * Matrix.CreateRotationX((float)(Math.PI / 180) * 90) * Matrix.CreateTranslation(new Vector3(0, 0, 0));
break;
case CardFacing.Up:
mCardFacing = Matrix.CreateRotationZ((float)(Math.PI / 180) * 180) * Matrix.CreateRotationX((float)(Math.PI / 180) * 90) * Matrix.CreateTranslation(new Vector3(0, 0, 0));
break;
case CardFacing.Hand:
mCardFacing = Matrix.CreateRotationX((float)(Math.PI / 180) * -20);
break;
}
Matrix mPlayerFacing = new Matrix();
switch (p)
{
case PlayerFacing.North:
mPlayerFacing = Matrix.CreateRotationZ((float)(Math.PI / 180) * 0);
break;
case PlayerFacing.East:
mPlayerFacing = Matrix.CreateRotationZ((float)(Math.PI / 180) * 90);
break;
case PlayerFacing.South:
mPlayerFacing = Matrix.CreateRotationZ((float)(Math.PI / 180) * 180);
break;
case PlayerFacing.West:
mPlayerFacing = Matrix.CreateRotationZ((float)(Math.PI / 180) * 270);
break;
}
effect.World = mCardFacing * Matrix.CreateTranslation(v) * mPlayerFacing;
effect.View = view;
effect.Projection = projection;
}
mesh.Draw();
}
}
Any ideas? Thanks.
.fbx
to associate the lights(or lack there of) as an emissive channel. – Strom Apr 29 '19 at 23:24