Terminology help.

Started by
9 comments, last by GameDev.net 19 years, 3 months ago
I'm making a little prototype game to teach myself DirectX and some simle game design. I currently get these artifacts in the render and I'm curious as to what this is called. Obviously this is jaggy but I don't think it has anything to do with antialiasing. Below is an image of what i am seeing. The Jaggy mess circled in yellow is the artifact I'm curious about. What is this called? Is it something to do with Depth-Biasing, anti-aliasing or something else? Each of these die are simple cubes rendered as Triangle List, and they are positioned close to one another. When thier edges meet, this jaggy artifact appears. Any help is appreciated.
Advertisement
IIRC, that's called Z fighting.

It has to do with rounding errors in your Zbuffer.

Clicky

Thanks for the speedy reply.

Z-fighting has to do with Depth-Biasing right???
Part of me wants to say Z-fighting, but I'm not certain because you look to be pretty close to the objects and Z-fighting would more typically happen at a distance, although if the edges of the two dice overlap it might be a different story.

To solve it, you can try improving your z-buffer precision by either
a) asking for a 24-bit depth buffer
b) making your near/far clip planes closer together (best done by pushing near out)

-Mezz
Z-fighting can happen whether you are depth-biasing or not, it depends on the precision of the z-buffer.

Also for the record, don't do depth biasing, do projection matrix tweaking :)

-Mezz
Quote:Part of me wants to say Z-fighting, but I'm not certain because you look to be pretty close to the objects and Z-fighting would more typically happen at a distance, although if the edges of the two dice overlap it might be a different story.

To solve it, you can try improving your z-buffer precision by either
a) asking for a 24-bit depth buffer
b) making your near/far clip planes closer together (best done by pushing near out)

-Mezz


Thanks alot to everyone.

This was an easy fix.

As the above suggestion I changed my near clipping plane. I had it set arbitrarily close (set to 0.01f).

Changing this to 1.0f stopped the z fighting.

Whats funny is after some quick test, it doesn't seem to matter what I put the far or near clipping plane too, as long as the near is not 'close' to zero.

Once it gets down to about 0.1f it starts having some problems, 0.01f caused that really nasty looking jagged edge. And since I don't really know why, It means I have alot more to learn.

Thanks for all the help. That was solved much more easily than I had thought.
The accuracy of the depth buffer is based on the ratio near/far. The smaller the ratio, the less accurate the depth buffer is. Since far tends to be fairly large (compared to near), near ends up being the controlling factor. Smaller near = less accurate, larger near = more accurate. In general, anyways.
I was going to try and give you a quick explanation, but I think the following is better than anything I could come up with:

clicky

Enjoy.

-Mezz
Quote:The accuracy of the depth buffer is based on the ratio near/far. The smaller the ratio, the less accurate the depth buffer is. Since far tends to be fairly large (compared to near), near ends up being the controlling factor. Smaller near = less accurate, larger near = more accurate. In general, anyways.


Thanks..

But this is the part that is confusing.

Initially I had the Far set to 100 and the near set to 0.01.

Changing the near to anything over 0.2 makes the artifact unnoticable.

But the strange thing is if, like you say it is based on the ratio near/far.

When I set far to 10000 and near to 1 I dont get the artifact showing up, but the ratio is the same for 0.01/100 and 1/10000


Anyway, thanks for the help, and I'll try to do some reading and see if I can't figure it out.

Quote:I was going to try and give you a quick explanation, but I think the following is better than anything I could come up with:

clicky

Enjoy.

-Mezz


Thanks, I'll check it out.
Quote:When I set far to 10000 and near to 1 I dont get the artifact showing up, but the ratio is the same for 0.01/100 and 1/10000


I think it is because in this case, the position that the artifact is at is much closer to the near plane than it is when you set near=0.01 and far=100. This means that it is in a spot in the depth buffer range where there is much more precision (closer to the near plane) because the z-buffer is not linear.

This topic is closed to new replies.

Advertisement