Sign in to follow this  

Weird Particles Need Advice

This topic is 4594 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
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
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
I have seen a few people implementing their terrain using a single triangle strip with degenerate triangles to join the rows, but not correctly terminating each row. this causes very very narrow triangles to run from the end of a row, back across the terrain to the begining of the next row. Under high tesselations and certain views the triangles dont genreate any, or very few pixels, making the problem hard to spot. Make sure that you are correctly using degenerate triangles if this is the case. You need to duplicate the last vert and the first vert on each row if you are using this method.



|/|/|/|/|/|/|. <- Extra Vert 1
Extra Vert 2 -> `|/|/|/|/|/|/|.
`|/|/|/|/|/|/|.
`|/|/|/|/|/|/|.
`|/|/|/|/|/|/|.
`|/|/|/|/|/|/|.

the 2 degenerate triangles are [last vert of the row, ExtraVert 1, ExtraVert 2] and [Extra vert 1,extra vert 2, first vert of the second row]

hope this helps

Al






Share this post


Link to post
Share on other sites
I anticipated that and I draw the heightmap row by row to avoid that. Anyone knows what else it could be? Iam reading on Polygon Offsets but it doesnt sound like its gonna do the trick.

Share this post


Link to post
Share on other sites

This topic is 4594 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this