PDA

View Full Version : AGC in HDR Rendering



N64Marin
03-27-2005, 05:54 PM
I want to implement Automatic Gain Control(AGC) in my HDR rendering application. In the final rendering pass. We should get the average brightness of scene. So we must sample the floating point texture which contains the scene. But in a shader, you should sample a lot of points to get the brightness, and each pixel doing the same work. So it is reasonable to put the sampling work in a separate pass. In this pass, we render to a 1x1 texture.
Which way is faster? Any better solution?

Overmind
03-27-2005, 11:51 PM
I haven't tried if it is faster, but you could generate the mipmaps for the texture and then sample the 1x1 mipmap level by using the lod bias parameter...

Zengar
03-28-2005, 03:47 AM
On NV4x you should downsample the texture(thus, generate mipmaps)

On other cards that don't support fp texture filtering, you'll have to do it manually. You can optimise the algorithm if you skip some pixels(like performing a box filter on every second pixel) - this should still give you accurate results. But you'll still need multiple passes to do this.