Reputation: 1014
I have a problem displaying a Milkshape model after I ported my game from XNA to Monogame (WP8.1). Have in mind, this model is loaded "externally" without using Content - hence it is not an "xnb" file, but original "ms3d" file. I don't think that it has something to do with my custom effects file, as it looks messed up under all available effects.
For actual rendering of Milkshape model, I'm using a library from http://www.codeproject.com/Articles/148034/Loading-and-rendering-Milkshape-d-models-with-ani
I'm reading the model in Monogame by passing a Stream
(using OpenStreamForReadAsync()
) in the library's method instead of using File.Open(FileName, FileMode.Open)
function.
Screen from XNA: https://i.sstatic.net/ocYBv.png
Screen from Monogame WP8.1: https://i.sstatic.net/DcoST.png
The background on Monogame was just removed for tests, it's not an issue. To eliminate possible other sources of issues, I tried to render only this single model - but it looks still wrong: https://i.sstatic.net/q07Rl.png
Upvotes: 0
Views: 137
Reputation: 1014
I managed to fix this issue by changing the custom vertex declaration to VertexPositionNormalTexture. Here's code:
foreach (var milkshapeGroup in Groups)
{
milkshapeGroup.verticesPhone = null;
var vertList = new List<VertexPositionNormalTexture>();
foreach (var ver in milkshapeGroup.vertices)
{
vertList.Add(new VertexPositionNormalTexture(ver.Position, ver.Normal, ver.texCoord1));
}
milkshapeGroup.verticesPhone = vertList.ToArray();
}
Upvotes: 0