Weird Particles Need Advice

Started by
12 comments, last by TempHolder 18 years, 11 months ago
Hey me and my freind are working on a game, I just finished coding the Heightmap and I Implemented it using my freinds base code. Long story short It displays the traingles with this weird particle like dust thing when 2 traingles overlap can anyone tell me how to fix my problem. Heres a Image of how it looks.
Advertisement
I'm not very experienced with this, but I might guess that you have ZFighting issues. The renderer is switching between the two triangles at each spot because their depth is so similar that the calculations are rounding off and not being accurate enough.
Turring Machines are better than C++ any day ^_~
it appears that you have some serious z-fighting among your triangles. im only saying that because it looks like your triangles are VERY small and the terrain is heavily tesselated. you could try researching polygon offsetting
ty do you know where I can read up on it, or how to fix this problem?
Not to be too rude, but for me it is the whole heightmap rendering which is wrong. Just too many artifacts there....
Maybe if you can post an image with a better prespective of the scene I may change idea...
--------------------------------If you can't understand what I said, it's not you, it's because my english sucks!
what do you mean better perspective? The problem is that if I change the camera angle, you might not see any problems, I set up the view like that cause in that spot was where you could see how it was really messed up.
You can use polygon offsetting to help eliminate z-fighting, the redbook shows how to do this.

There are also three other things you can do to help elimate z-fighting:

1- Increase the number of bits used in the depth buffer (where possible)
2- Decrease the distance of the far clipping plane, a greater view distance means the z-buffer has to span more ground with the same amount of data, which results in more inaccuracies.
3- Scale your geometry in some way so that the distances between points are less and the z-buffer more accurate.
number 2 above would probably be better off moving the near plane forward slightly and keeping the ratio between of about 1:1000 (near = 1, far = 1000)
So how exactly, if you could is z-fighting going on? what did I do to make the
"z's fight"...?
Quote:Original post by TempHolder
So how exactly, if you could is z-fighting going on? what did I do to make the
"z's fight"...?


OpenGL's z-buffer works by keeping in an array(of sorts) the closest position that has been drawn at each pixel. Then when it draw something at that same pixel, it compares the depth to what is in the Z-buffer to see if it is front or behind. The problem here is that the accuracy of comparisons are limited by the accuracy of the z-buffer bits. So when two different objects are drawn over the same pixel, the comparison is done. But if the objects are right on top of each other, the innacuracy in the buffer due to rounding of the numbers used causes them to round to the same number. Like 0.5 and 1.3 both round to be 1, when tris are that close, they end up the same, so the renderer renders those types of artifacts. Even though the actual values are barely apart, rounding them puts them together. The phantom chose the best solution. Either set the far plane closer or the near plane farther. I usually use 1 for near and 1000 for far, and I never have seen any Z-fighting in anything I program yet, except the first few when I was testing what values were better.

Alright, sorry for the length of that expanation. If any of it is wrong, don't flame me, correct me, but I'm sure that it is something like that. Thanks.


This topic is closed to new replies.

Advertisement