Sorting by depth

Started by
0 comments, last by relsoft 13 years, 8 months ago
I currently have a tree of nodes in my game. The screen shot below shows this tree rendered. The larger girls are top level nodes, with no parents. The boy is also a top level node, the small girl is a child node of the boy.

When each node is queued with the renderer it applies its own transformations to the current matrix and then stores a copy of it. When the screen is finally drawn I keep replacing the current matrix with the one stored inside each node.

This positions everything correctly within my scene but I get the following problem...



Uploaded with ImageShack.us

As you can see from this screen shot the boy is being rendered correctly on top of the other parent nodes however the child node is being obscured because it is drawn after its parent.

How can I sort my scene to correct this problem? The only positioning information I have at the time the image is rendered is a matrix defining where on the scene it should be rendered. Can I extract a Z position from this matrix?

Thanks!
Advertisement

Disable depth testing and change your blending modes.
Hi.

This topic is closed to new replies.

Advertisement