early depth rendering?


i read a lot of papers about performance tips using opengl, and “early depth rendering” is talked by in almost all of them.
I searched on the google without significant result.

Could anybody explain me how to realize early depth rendering?

I have several rendering stages:

  • water
  • shadow
  • normal rendering
  • and a rendering for blur effect

i hope i can use this to avoid innecessary depth writing.


It just means that you should render a z-pass first if you use some heavy shaders to reduce the amount of fragments rendered with those shaders.

You can do this in a standalone z-pass or as a part of an ambience pass.

It’s a first depth (+optional ambient) pass, such as what the Doom3 engine does.
Just render all Opaque geometry as Depth + light model ambient first, then process your stuff as usual.
You need do that for each RenderTarget in order to have the correct depth.
It must be done just the step before “normal rendering” for your main frame.