Sign in to follow this  

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

This topic is 2016 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
[quote name='ill' timestamp='1339237800' post='4947621']
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.
[/quote]
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.

[quote name='ill' timestamp='1339237800' post='4947621']
Is it still worth sorting by materials somehow? Maybe doing a depth first pass then doing the complex pixel sharers and all that?
[/quote]
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

This topic is 2016 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this