Jump to content
  • Advertisement
Sign in to follow this  
EnochDagor

Wierd Graphic Artifact

This topic is 4732 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

Ok, I'm very new to DirectX graphics in general. I'm still working on my .NET skills so instead of jumping into two languages at once, I'm using VB6 with DX8. I can write and understand C++ so if you have code examples for that, feel free to include them. Ok... the problem I am seeing is pretty simple to explain... I have a 3D terrain generated from a heightmap. I am currently only using brute force to do my work... every height has its own vertex... so on and so forth. I added a water quad that stays with the camera at a certain height and is always rendered (even if it cannot be seen anywhere in the scene. While scrolling across the terrain, I noticed that the water seems to have this strange artifact to it... A Hill comes out of the water and the water appears to move. It doesn't render consistently each frame that the camera is scrolling. I noticed that if I zoom in to the terrain very very very closely, that the artifact reduces itself down to very tiny triangles until at some point, the water appears correctly (but I am practically JUST above the water). Why is this happening? How do I fix it (ROAM?)? Thanks, -Matt (edited because I couldn't type worth anything)

Share this post


Link to post
Share on other sites
Advertisement
That's called z-fighting. Try turning the near plane distance up when you calculate your projection matrix.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think it has to do with the distance in between the near and far clipping planes, so you don't have to change the near plane if you make the far plane shorter, get a nice balance.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
I think it has to do with the distance in between the near and far clipping planes, so you don't have to change the near plane if you make the far plane shorter, get a nice balance.

It's not the distance, but it is the ratio. Consider near/far plane values of 5/5000. You will get more than twice the improvement in accuracy by turning the near plane up 1 point than you would turning the far plane down 100 points.

The far plane is very flexible. It's the near plane that bites you. The closer the z buffer is to the screen, the more resolution it eats up. Turn your near plane up as far as you can manage it. Your far plane will make little difference as long as it's not at insane levels.

Share this post


Link to post
Share on other sites
I believe a compulsory link/reference is required here: Learning To Love Your Z-Buffer [grin]

It's a very useful webpage if you're trying to get a grip on the mathematics behind how the depth calculations work. You can quite easily verify what Jiia is saying about tweaking the values by trying it on the above page...

hth
Jack

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!