multi-pass blur filter for HDR

I want to implement some HDR filters and find that most of them required to run multiple passes of a blur filters (say > 10 passes). Is it possible to do this in panda with two render targets only ? I know how to do it with many buffers, but no idea to do it with fewer.

Sure. I’m not sure what kind of algorithm you’re trying to implement - but you can do multiple blur passes with as many buffers as you like without using up all 4 render targets.

(Note that the limit of 4 render targets is a limit set by the GPU - not by Panda.)

e.g. I have the following algorithm (2D post processing):

  1. blur => blur1
  2. blur => blur2
  3. blur => blur3
  4. blur => blur4
  5. blur => blur5
  6. blur => blur6

combine the original with blur5 + blur6 in a shader

If I do this using FilterManger, I will use 7 buffers, is that right ?

I don’t think it will make much difference if you use 7 buffers or 2 with a couple of MRT’s, since you’re only rendering two triangles, and not an entire scene.

But if you want, the FilterManager still supports two extra render targets per buffer - just pass auxtex0 and auxtex1 to the renderQuadInto call. In your shader, simply write to them by specifying a different color semantic (e.g. “o_blur2 : COLOR1”).

I don’t know why it doesn’t support the other two, I could add that for the upcoming release, if you want.

May be I have a very wrong concept:

If I have to do a 15 blur filtering passes during post-processing, using filtermanager, there will be 15 offscreen buffer created. Won’t it be a burden on the hardware ? My concept is, if I can just use only a few buffers, and render the intermediate results to them cyclically, I can save a lot of hardware resources.

Can you correct me here?

The only way you can find out for sure is by making three filters each rendering a simple quad with a simple shader applied, and measuring the amount of milliseconds it takes to render those three filters together (using PStats that’s easy to track).

Then, create another filter which instead uses one buffer but two extra render targets, and does the same pixel shader but three times (each time writing to a different texture).

Then compare the render time and you know for sure if it’s worth it.

But still, you can’t get 15 auxilliary render targets.
I’m not sure what you mean by “cyclically” - you mean to disable clear, and use the last frame’s result every time? Might be possible, but basically you’re doing a motion-blur like thing then - you’ll always run behind. I think that’s the same thing the sample programs’ Motion Blur sample does (except that it doesn’t apply a blurring shader).

My question is,

  1. 15 offscreen buffers, this will use up hardware resources in GPU ? If I need 30 passes, will I run into limits of most hardware ?

  2. cyclically, I mean I just use 2 buffers
    buffer1 => blur shader => buffer 2
    buffer2 => blur shader => buffer 1
    buffer1 => blur shader => buffer 2
    buffer2 => blur shader => buffer 1

  1. I don’t know. Why don’t you try it?

  2. Well, more or less the same answer. You’ll end up with a motion-blur like approach (since the data from the first frame will always live on).
    So actually the view will get blurred more and more every frame.

hmm…looks like I am not expressing the questions clear enough to get an expected answer… Anyway, thank you for your answers and help.