Я пытаюсь использовать Blender, чтобы сделать простую игральную карту с текстурой с обеих сторон для лица и спины и загрузить ее в Monogame.Сама модель в порядке и показывает на эмуляторе при запуске, но я не могу включить текстуры.

Текстуры на карте, кажется, хорошо отображаются вBlender.Материалы настроены на «без тени», поэтому на них не должны влиять правильные уровни освещенности?

Я пробовал использовать разные настройки версии и различные режимы пути из«копировать» в «полосу пути» при экспорте файла.

В менеджере контента выходной каталог настроен на основную папку контента, поэтому проблем со ссылками не должно бытьс текстурами я надеюсь.

Все текстуры находятся в одной папке.

Содержимое - всезагружен вручную в Visual Studio.

Вот код, который я использую для рисования карты, показывающей различные настройки освещения, с которыми я играл.
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();
}
}
Есть идеи?Спасибо.