だから私は 2D スプライトで 3D ゲームを作ろうとしています。Blender で平面を作成し、UV マップを使用してスプライトの 1 つを平面にマッピングしました。f12 を押して平面をレンダリングすると、スプライトが表示されます。
プレーンのマテリアルを作成し、テクスチャを追加し、正しい UV マップで UV マッピングを有効にしました。
ファイル モデルを .fbx ファイルとしてエクスポートし、これをテクスチャ イメージと共にプロジェクトのコンテンツ フォルダに配置しました。
ただし、表示されているテクスチャの代わりにモデルをレンダリングすると、平面が真っ黒になります。
何が原因でしょうか? 私のドローは次のようになります。
public void Draw(Matrix View, Matrix Projection)
{
// Calculate the base transformation by combining
// translation, rotation, and scaling
Matrix baseWorld = Matrix.CreateScale(Scale)
* Matrix.CreateFromYawPitchRoll(
Rotation.Y, Rotation.X, Rotation.Z)
* Matrix.CreateTranslation(Position);
foreach (ModelMesh mesh in Model.Meshes)
{
Matrix localWorld = modelTransforms[mesh.ParentBone.Index]
* baseWorld;
foreach (ModelMeshPart meshPart in mesh.MeshParts)
{
BasicEffect effect = (BasicEffect)meshPart.Effect;
effect.World = localWorld;
effect.View = View;
effect.Projection = Projection;
effect.EnableDefaultLighting();
}
mesh.Draw();
}
}