I have decided to switch my engine to OIT for a couple reasons - mainly because of my map styles. I just don't really like sorting geometry much - and the results are never pixel perfect.. anyways after looking at depth peeling, dual depth peeling, a-buffer, weighted average, and weighted sum techniques I decided on weighted average.

I'm a bit confused on the logistics of implementing it - in the white paper (Bavoil and Myers 2008) it states

"The average RGBA color for each pixel is generated by rendering the transparent geometry

into an accumulation buffer implemented as a 16-bit floating-point texture. The result is an

accumulated RGBA color and the number of fragments per pixel (depth complexity) "

So - I'm already using a deferred shading engine - generating another texture is not a big deal - what I don't quite understand is how to write the average RGBA color and number of fragments per pixel to a 16 bit floating point texture.

Here's where I'm a bit confused:

This may be silly - but from my understanding.. for each fragment I would add the current RGBA color to the 16 bit texture -

My first question is how do I do this? Do I just set glBlendEquation to GL_FUNC_ADD and glBlendFunc(GL_ONE, GL_ONE)?

My second question is how do I save the depth complexity to the 16 bit texture also? The only way I can think to do it is making another texture and adding 1 to every texel that I pass over in the fragment shader (with the blend mode set as above)

Full screen pass: compute the average color/transparency (explained in a moment) and blend with the deferred color buffer

The idea is to compute the average of the colors, weighted by their transparencies. For blending with the background, we additionally need the average opacity. (FYI: I assume that alpha = 1 means opaque, and alpha = 0 means transparent)

Wow - that is literally exactly what I was looking for. Thanks for taking the time to write that out - this should be fairly simple to implement. I will post a picture when I get it working.. should be tomorrow.