Jump to content
  • Advertisement
Sign in to follow this  

Sorting by depth

This topic is 2955 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 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?


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!