Sign in to follow this  
simonjacoby

Sorting faces according to depth but keeping an index buffer

Recommended Posts

Hi guys,

 

I have a problem where I want to sort faces according to depth to be able to render them without a depth buffer (or even a depth component in the position of the vertex, I just want to have x and y in the position).

 

However I still want to have a have a nice index buffer so that I don't have to treat them as separate faces, for memory (and performance, but mostly memory) reasons.

 

Basically, I just want to make a draw call that draws the entire mesh, knowing that it will be drawn back-to-front (overdraw is a smaller problem than the vertex processing in my specific case), and indexed so that I process as few verts as possible.

 

Does anyone have any ideas on how to accomplish that?

 

Thanks,

 

Simon

 

 

 

Share this post


Link to post
Share on other sites

You could probably use [url="http://www.iquilezles.org/www/articles/volumesort/volumesort.htm"]volume sort[/url], given your faces are somewhat laid out in a grid like fashion. Then you provide different index buffers for all the possible view directions. You can even combine them into one index buffer and use a subset logic (DirectX lets you chose the starting index, I don't know OpenGL, but I bet you can do that too).

Share this post


Link to post
Share on other sites

Thanks for the tip, I was looking for something like that.

 

However, I've encountered a fatal flaw with the way I was trying to do things, so I'm dropping it now, and trying something else.

 

Thanks anyway!

Share this post


Link to post
Share on other sites

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