Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have several models here. When they stand still during gameTime, there's no flickering. But as soon as I move them across the x-axis, they flicker on some places.

protected override void Draw(GameTime gameTime)
{
    graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

    Matrix[] transforms = new Matrix[myModel.Bones.Count];
    myModel.CopyAbsoluteBoneTransformsTo(transforms);

    foreach (ModelMesh mesh in myModel.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index] * 
                Matrix.CreateRotationY(modelRotation)
                * Matrix.CreateTranslation(modelPosition);
            effect.View = Matrix.CreateLookAt(cameraPosition, 
                Vector3.Zero, Vector3.Up);
            effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45.0f), aspectRatio, 
                1.0f, 10000.0f);
        }
        mesh.Draw();
    }
    base.Draw(gameTime);
}

Why is that happening and what could I do to prevent it?

share|improve this question
2  
Does the flickering look like Z-fighting? –  Andrew Russell Apr 30 '13 at 11:16
    
Probably something like that. When they are static the math turns out with the same results, once they move it flip flops between different states. It can be z-fighting or aliasing with different results. –  rioki Apr 30 '13 at 12:37
add comment

1 Answer 1

Issue was easy to solve:

My farPlane was too much (actually 10k). So I reduced that to 3k (according to my models) and also important is the nearPlane, which was at 0.1f. I changed that to 1 and now everything works!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.