Jump to content
  • Advertisement
Sign in to follow this  
icethelog

Scene "flickers" when moving camera

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

I'm a bit clueless as to what is causing this, so I'm not really sure what code to post. Basically, using C++ directx 9 I am creating some random building meshes and assigning random textures to them (which have been created using D3DXCreateTexture). When I am flying along the building geometry and textures seem to sort of flicker a pixel at a time back and forth (more so when textures are steeper angled away from the camera). Initially i thought it was to do with D3DXCreateTexture, but when I just make all the buildings untextured their geometry still has this flicker effect. Has anybody got any idea where I should be looking in my code? Photobucket I've circled in red the areas of buildings that flicker the most - when the camera is stationary it looks fine. thanks for any help

Share this post


Link to post
Share on other sites
Advertisement
Sounds like a depth buffer issue to me. What are your near and far clip planes set to (In your projection matrix), and what is your depth buffer precision?

For D3DFMT_D16, you really don't want a near clip closer than 1.0f, and a far clip further than say 1000.0f or so.
For D3DFMT_D24S8 or D3DFMT_D24X8, you don't want a near clip closer than 0.1f, and a far clip further than 5000.0f or so.
(Random values picked out of my head). The main thing is that the near clip should be as far as possible, and the far clip should be as close as possible.

Share this post


Link to post
Share on other sites
I am using D3DFMT_D24S8 and my near far planes are 1,1000. Another thing I am noticing is that increasing the resolution lessens the flickering a bit. I think this could be something pretty fundamental that I don't understand.

Share this post


Link to post
Share on other sites
It really sounds as though you're using textures without mip-mapping, but if it happens when drawing without any textures then it can't be that.. It's hard to know exactly what you mean with flickering, and hard to see anything in your image. Does geometry from behind shine through?
It might be that you have T-junctions in your geometry. If you have a triangle with an edge between two vertices, and then other triangles share this same edge, but have extra vertices along the edge, then this can happen. You solve it by having each triangle share each of its edges exactly aligned with exactly one other triangle.
YOu can also try enabling anti-aliasing to reduce edge-flickering.

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!