Jump to content
  • Advertisement
Sign in to follow this  
dbgamer

DirectX Glitchy Graphics

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

Hello all. So, I've been working on a 3d pong clone in DirectX 10, and I've been battling a mean glitch. For some reason, anything that intersects with anything else seems to overlap in seemingly random places. If you look at the linked screen shot below, there is a jagged pattern to the quad walls where they overlap, but the ball that is in the cube is seemingly completely random. I noticed it overlaps less when the objects are closer to the camera, and gets awful when they are far away. I can post any code requested, but I have no idea where to start. Here is a screen capture from the game. http://mynameismatt.net/wp-content/uploads/2010/02/glitch.jpg Also, here is my Depth Buffer: depthStencilDesc.Width = 1024; depthStencilDesc.Height = 768 depthStencilDesc.MipLevels = 1; depthStencilDesc.ArraySize = 1; depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; depthStencilDesc.SampleDesc.Count = 1; depthStencilDesc.SampleDesc.Quality = 0; depthStencilDesc.Usage = D3D10_USAGE_DEFAULT; depthStencilDesc.BindFlags = D3D10_BIND_DEPTH_STENCIL; depthStencilDesc.CPUAccessFlags = 0; depthStencilDesc.MiscFlags = 0; And I am sure to clear it each time. Not sure if that's relevant.

Share this post


Link to post
Share on other sites
Advertisement
What parameters are you using for your projection matrix? You'll want to make your near and far planes as close as you possibly can.

Share this post


Link to post
Share on other sites
Well, it was
Z-Near: 0.0001f;
& Z-Far: 1000.0f;

So, I changed it to 0.1f & 100.0f. That cleared it up immediately.
Thank you very much!! I didn't know that had anything to do with it.

I very very much appreciate it.

Share this post


Link to post
Share on other sites
The problem you were having is commonly known as z-fighting. It's caused by a lack of precision in the depth buffer, which is generally a symptom of your near/far range being too far apart, as MJP has already pointed out.

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!