Sorting faces according to depth but keeping an index buffer

Started by
1 comment, last by simonjacoby 11 years, 1 month ago

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

Advertisement

You could probably use volume sort, 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).

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!

This topic is closed to new replies.

Advertisement