简体   繁体   中英

XNA Rendering Issue

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();
        }
    }

I now believe this may be an exporting issue from 3DS Max itself, I've checked the code over and over and i don't believe that is where the issue is.

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

I now believe this may be an exporting issue from 3DS Max itself, I've checked the code over and over and i don't believe that is where the issue is.

Thanks for your help Peter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM