Jump to content
  • Advertisement
Sign in to follow this  
ill

Sorting by depth for occlusion queries + sorting by materials and meshes

This topic is 2230 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

So I recently got into using occlusion queries. Before, I was sorting my objects by materials and meshes and all that to avoid state changes, but now with occlusion queries you need to sort by depth front to back more or less.

Is it still worth sorting by materials somehow? Maybe doing a depth first pass then doing the complex pixel sharers and all that?

Share this post


Link to post
Share on other sites
Advertisement

So I recently got into using occlusion queries. Before, I was sorting my objects by materials and meshes and all that to avoid state changes, but now with occlusion queries you need to sort by depth front to back more or less.

No reason you can't do both. If you have a radix sort going, allocate a few bits for materials (8 would probably be fine) and use the rest for depth (24 bits is a pretty common depth format, and you honestly don't even need that level of granularity) to get the advantages of each.


Is it still worth sorting by materials somehow? Maybe doing a depth first pass then doing the complex pixel sharers and all that?

These are orthogonal concepts, I'm not quite sure what you mean. One is designed to minimize CPU-side overhead for swapping out device state, one combats overdraw and in particular tries to avoid running expensive shaders on invisible pixels. You can still do both no problem-- and indeed that's how most games work.

Share this post


Link to post
Share on other sites
Well the way it used to work is I would render all objects with some mesh and model. Meaning i'd render the really far away objects along with the close objects in one pass. Then switch to the other objects.

Now I order objects roughly by depth. So I'm having a hard time understanding how I'd do both.

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!