Jump to content
  • Advertisement
Sign in to follow this  
TempHolder

Weird Particles Need Advice

This topic is 4900 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!