I'm not as brainy as I'd like to be, and I'm currently trying to implement my own simple windowing system. I am currently drawing one poly over another using already transformed vertices.
What I have found though is when I set the Z component to 1.0, my scene appears in front of the polygon, but at 0.9 it doesn't. Be aware that I am using an extremely large coordinate space (hundreds of millions of units for... you guessed it, space...) and there are items (large items) over 100 million kilometeres away, and my ship which is like 5m from my ship, but even it still appears in front of the polygon when z is 0.9.
So, what I would like to know is, how is the Z component distributed across the viewing frustum, and what does the W do in x,y,z,w. I am using 32 bit colour with an D24X8 Z buffer. I don't understand why there isn't a 32 bit Z buffer, but I guess that's a question for another day.
I guess I should also ask (something I haven't tried yet that just came to me) if turning off depth sorting (D3DRS_ZENABLE) while drawing the interface windows would also work...

D3DFVF_XYZRHW
faf38
I fund that on some video cards, if you set z value to be 1.0f, you can not see it on screen. I tried 0.999, it worked well, but when it was 1.0f, it disapeared.
Can anybody tell me how to dela with this problem. Is there any render state or device capability flag can be used
Abnerian
Thanks Jack, that article on the z-buffer was very informative and useful
I did some testing after I wrote the message involving turning off the z-buffer, and got the results I was looking for, in that it simply appears the only thing that matters is the order you draw in, which is fine by me.
SatisfiedCustomer++;
Michael Dye
Firstly, you might want to learn to love your Z-Buffer
I think your big problem is the Z-ranges that you're dealing with. Depth buffers are notoriously sensitive to the parameters you feed them. The distribution is also non-linear for Z-Buffering, thus most of your Z accuracy is used close to the camera, so the last 200 million kilometers might be condensed down to less than 10% of your depth range. Hence why you can "jump" your interface in front of so many objects with such a small change.
Try plugging in some of your values into the previously mentioned website and you might start to see how/why this occurs.
There is a 32bit Zbuffer - D3DFMT_D32, but it's not universally supported and doesn't have any stencil depth attached to it. Even with a 32bit depth buffer you'll still get some errors with the scale you're talking about - simply to do with the non-linear distribution of values.
Finally, turning off z testing or z writing whilst drawing the GUI is a perfectly valid approach.
hth
Jack