tags:

views:

52

answers:

1

Hey guys, quite a confusing problem has struck me. After programming a fair bit of my game and it working correctly, i've come accross a model that won't show up in the level when i render it. I've tried scaling up, scaling down, rotating it, checking and double checking it's render matrix position and it just doesn't seem to render. I've implemented other models in exactly the same function and they render perfectly. I don't think there is an issue with the model though (by the way all my models are ".X" files), as the model appears perfectly when it is opened through DxViewer. So i am unsure as to what could be causing this issue to occur.

A sample of the temporary code i use to check how models will look in the game:

    static public void RenderTmp(Model model, float scale)
    {
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {                                                              
                effect.PreferPerPixelLighting = true;

                effect.World = Matrix.CreateScale(scale) * Matrix.CreateTranslation(0, 0, 0);

                effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(90), Globals.g_Device.Viewport.AspectRatio, 1, 1000);
                effect.View = Matrix.CreateLookAt(new Vector3(0, 50, 0), new Vector3(0, 0, 0), Vector3.Forward);
            }
            mesh.Draw();
        }
    }
A: 

Are normals pointing the correct way? Are all textures used by the model compiled along with the application?

Peter Lillevold