Sign in to follow this  
dbgamer

DirectX Glitchy Graphics

Recommended Posts

dbgamer    100
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
dbgamer    100
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
adt7    751
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

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