Gl_depth_test vs polygon sorting alogrithm such as bsp

I am trying to create a world that consists mostly static objects. I wonder if I would achive a much faster rendering speed if i disable gl_depth_test, and write my own polygon sorting alogrithm such as bsp?

as far as I know, sorting your triangles doesn’t eliminate the need for depth test. But by drawing your triangles from closer to further, you eliminate overwriting the same pixel over and over again, so you’re less likely to hit your fill rate.

Again afaik, bsp is not so much a sorting algorithm as a quick way to rule out a number of polygons that absolutely cannot possibly be visible, given the current location. The remaining set of polygons can still be sorted for faster drawing, and they definitely still need depth tests.

So, I think you’ve mentioned three techniques that can quite easily co-exist :slight_smile:

Actually If I pre sort the polygons from further to closer, then I don’t need depth test all when come to draw those polygons.

Anyway I have a question, do you think games such as quake3/doom3 will reply on gl_depth_test to draw polygons in correct order?

Wow I never knew about that before, can you generally tell me how is it done?

Depth test is almost free on hardware. Reordering the polygons is very slow. So, no, it would be much, much, much slower.

lol i guess you are right, I will just stick to gl_depth_test for now. BUT I think there must be more clever way. For instance if we detect a room (volum) which is completely behind a large polygon, then we can skip the objects inside the room(volum).

You should look into different occlusion culling algorithms like Possible Visible Sets (PVS) and Portals / Cells.

PVS breaks the world into rooms and each room has a precalculated list of wich other rooms are possibly visible.

Portal rendering connects rooms using portals and the renderer calculates wich rooms are visible threw the portals using the current view position and orientation.