Sign in to follow this  
Lexa83

C# and direct3d, artifacts!

Recommended Posts

Lexa83    122
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
dxFoo    100
"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
Lexa83    122
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
Syranide    375
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
Lexa83    122
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
Nik02    4348
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   
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

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