【发布时间】:2015-12-31 08:14:15
【问题描述】:
我最近将旧的 Monogame 项目升级到了最新版本的 Monogame。一切都像以前一样运行,但是,我导入的 .FBX 模型显示为纯黑色(暗示它们没有被点亮)。
(汉堡+胶带是在运行时使用 Quads 动态制作的。它们应该受到照明的影响)。
我用于显示模型的代码(在旧版本的 Monogame 中有效)如下:
public override void Draw()
{
foreach (ModelMesh mesh in model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.World = Matrix.CreateRotationZ(rotX);
effect.World *= Matrix.CreateRotationX(rotY);
effect.World *= Matrix.CreateTranslation(new Vector3(pos.X,
pos.Y,
0f));
effect.View = MainGame.matrixView;
effect.Projection = MainGame.matrixProj;
effect.TextureEnabled = true;
effect.Texture = tex;
effect.EnableDefaultLighting();
effect.AmbientLightColor = new Vector3(0.2f, 0.2f, 0.2f);
effect.EmissiveColor = new Vector3(1, 0, 0);
}
mesh.Draw();
}
}
模型从 Blender 导出为 FBX 7.4 Binary(如果我使用 FBX 6.1 ASCII,项目不会编译)。
提前致谢。我希望这不是我忽略的傻事。
【问题讨论】:
-
移植游戏时是否重新编译了模型资源?
标签: 3d xna monogame lighting fbx