View Full Version : quake3 sky rendering optimization

08-04-2002, 04:17 AM
For my quake3 map viewer, I'm working on sky rendering optimization.

My sky model is following: I've 6 faces that form the skycube, and each face is divided in several quads (in fact 9x9 quads but it can be changed easily). I think quake3 use similar model.

Now I want to optimize rendering like in quake3. When you are looking quake3 in wireframe mode (run a level with "devmap 'mapname'" and then "r_showtris 1"), you can see that only quads that are behind a window are drawn.

I've started doing the same. I make a projection of the vertices of window faces (the faces of the bsp that have a shader with a surface flag representing sky) on the sky cube. So I can find quads (I call them 'support quads') that are behind the vertices (look result at " http://www.calodox/morbac/images/skyopt.jpg " - magenta is clear color). The idea is then to fill the quads that are between the support quads, but here come the problems !!
There are lots of complications if support quads are not all on the same face. I tried making clipping between cube faces, but result is not good and method looks slow... and I wonder if I'm still making optimization http://www.opengl.org/discussion_boards/ubb/frown.gif

Has anyone ideas on quake3 sky rendering optimization ??

08-04-2002, 04:22 AM
screenshot is at http://www.calodox.org/morbac/images/skyopt.jpg http://www.opengl.org/discussion_boards/ubb/wink.gif

08-05-2002, 06:34 AM
How about you use bigger faces (hardware is perspective correct these days). And draw the sky last, that way coarse Z will get you most of the optimization you're looking for. Only clear the depth buffer of you write every fragment, no need to clear color.

[This message has been edited by dorbie (edited 08-05-2002).]

08-05-2002, 07:29 AM
I think that quake3 clips the sky polygons and computes the extents of each portion of the polygon on each face of the sky box. There aren't many sky polygons at the same time, so it's not so expensive as it sounds.

The GPLed Quake2 engine uses almost the same algorithm, and you can have a look to see how it works.