7
\$\begingroup\$

Here is the artifact:

Artifact

Here is some clarifying information:

  1. This appears only at 480 units from the origin, and seems to get worse (to a point) as I move away.
  2. All water should have sand rendered behind it, but the sand should be occluded (since I will eventually be rendering the water semi-transparently).

Here is my guess:

This looks like z-fighting, but my issue with this hypothesis is that none of these polygons are co-planar.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Probably just need to change the near plane, the far plane should be fine. \$\endgroup\$
    – House
    Jan 4, 2012 at 6:05
  • \$\begingroup\$ You'll find that this also varies from graphics card to graphics card too. I never have issues like that on my PC, but my laptop regularly has them. \$\endgroup\$
    – House
    Jan 4, 2012 at 16:17

2 Answers 2

5
\$\begingroup\$

What are your far and near clipping planes set to? Try adjusting them to be closer together and see if that solves the issue. I think it's z-fighting as well, and it could crop up even if the polygons aren't on the same plane, depending on the precision of the depth buffer, the closeness of the clipping planes, etc.

\$\endgroup\$
3
  • \$\begingroup\$ Well, My near plane is set to 0.01, and my far plane is set to about 300 units. I find it funny that this is only happening when I move away from the origin. \$\endgroup\$ Jan 4, 2012 at 6:15
  • 4
    \$\begingroup\$ The way projection works, the closer near plane is to zero, the worse the z-buffer precision will be. Push the near plane as far as possible (like 1.0 or something). The far plane doesn't matter. \$\endgroup\$ Jan 4, 2012 at 6:51
  • 2
    \$\begingroup\$ @JohnGietzen - There is a nice write-up on the z buffer that taught me quite a bit - it's for OpenGL (but the z buffer works the same for OpenGL and XNA). He even wrote a calculator. \$\endgroup\$ Jan 4, 2012 at 8:26
1
\$\begingroup\$

As D C said, this is probably z-fighting, caused by insufficient depth buffer resolution, caused by a too-near near plane.

You might be interested in the answers to this question of mine, How do I methodically choose the near clip plane distance for a perspective projection?, which describe several different approaches to choosing the near clipping plane.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .