Skip to main content
gamedev.net
🔒 Locked

Depth sorting using transformed vertices

Started by Shock Dec 11, 2005 at 3:31 PM 1 replies 600+ views
Original Post
Shock
Shock
Heya all, I am trying to create a GUI using transformed vertices and d3d9. It all coming along nicely...except for z-ordering. Does direct3d allow for ordering transformed vertices, and between what ranges? I seen anything less than 0.0f isn't shown and anything greater than 1.0f is behind 3D geometry. I have tried creating 3 controls in my gui. Z values are 0.001f, 0.002f and 0.003f. However it doesn't affect the ordering, they still stay in the same order when rendering. I am batching vertices, but I doubt this would have an effect, would it? Thanks!
jollyjeffers
jollyjeffers
Provided you have a depth buffer enabled and active then it should work fine. I've used this sort of trick on a number of occasions [smile]

Maybe trying different depth values might work better - it's possible that the resolution of your depth buffer might not be seperating them enough. Something like 0.0, 0.1, 0.2, 0.3...1.0.

Although, if you're trying to mix this with a 3D scene and you don't actually want the 3D scene to appear between/through the GUI, you might just be best off disabling Z-test and Z-write and just batching by Z-Order.

The GUI that I have for one of my projects has a built in Z-Order per control - it's not that difficult to do. It can make for very small batches, but I haven't found that to be a problem unless I've got a ridiculously cluttered GUI...

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
Shock
Shock

Damn, stupid me. It wasn't D3D, it was my depth sorter. It seems it isn't sorting components correctly and was always setting 0.0f for the Z regardless of what was 'activated'.

Can anyone give me a clue on how to do depth sorting for my GUI ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.