Jump to content
  • Advertisement
Sign in to follow this  
Lexa83

C# and direct3d, artifacts!

This topic is 4889 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 have wrote two versions of some code, one on VC++ and one on C#. A problem is, that application in C# have some artifacts (but code is 100% right, because it's same thing wrote in C++ works without troubles). It's seem to be problem with depth buffer... I can see some triangles behind blinks. Also I have heard about FPU preserve precision in C#... So, people, what to do?! that's the question. :)

Share this post


Link to post
Share on other sites
Advertisement
"I can see some triangles behind blinks."

Eh? I might know what you mean but please give more detail. And make sure your device is clearing the target with a ZDepth of 1.0f, and Stencil at 0.

Share this post


Link to post
Share on other sites
I have prepared for you two examples, one of them use depth buffer D24S8, and second D16. If you have installed directx 9.0b and .net framework you can see the difference.
In first case there are artifacts that I talk about
but in second, something going wrong!!! the depth buffer not function properly at all! the artifacts has gone, but if you look behind... just see it. I realy don't understand what is going on.
(note: I have radeon 9550, and omega drivers 2.5.90, not an original drivers... but same code in c++ works excellent)

the examples (directly from my pc): 81.218.29.61\test_d24s8.zip,
81.218.29.61\test_d16.zip

Share this post


Link to post
Share on other sites
I can't check the examples, but are you sure you aren't using zNear and zFar as 0.1/100000 or something like that? (which has been seen done before and will much kill the z-buffer making strange things happen)

Share this post


Link to post
Share on other sites
oh my...! there is! my z plane was from 0.0 to 1.0! of caurse zbuffer fails in hiding objects that lies adove 1.0 in z plane...
thanks to all.
I need to be more close

Share this post


Link to post
Share on other sites
zNear should never be less than 1.0
(zNear of 0.0 doesn't work at all I believe, the z-depth fails)

Share this post


Link to post
Share on other sites
Quote:
Original post by Syranide
zNear should never be less than 1.0


False. More correctly: "The ratio of zNear and zFar should be a reasonable value, so that the depth resolution is adequate across the depth buffer range".

If zNear is 0, the depth buffer resolution is divided by infinity, therefore effectively disabling it in practical use.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Nik02
False. More correctly: "The ratio of zNear and zFar should be a reasonable value, so that the depth resolution is adequate across the depth buffer range".


hear hear!

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!