How to create an average buffer?

I am using a bloom image effect that takes the alpha channel result of my rendering pipeline (lets call this the bloom buffer) to determine bloom strength (much like the “Glow” image effect from Unity Pro). I have some great results, but one thing I’d like to eliminate is some flicker that can occur when the camera makes small changes. What I think would work nicely is if the bloom buffer was the average of the last few frames, rather than just the current frame, that way small motions create a ghostly/spread bloom, rather than flickering.

What would be a good way to accomplish this without using a ton of render textures? My target frame rate is 60 FPS for desktop.

That would mean you are essentially adding motion blur on the bloom effect, which might turn out less nice than envisioned.

You could of course hold n targets in memory for the last n frames, but I assume that’s the ton of textures you don’t want.

So, there is a fairly simple three target solution. Let’s call them 1, 2 and 3. Every frame you render the current frame bloom in target 1. Pretty much what you already have set up. Targets 2 and 3 alternate in having the solution for the current frame and the last frame. At every frame you just blend between the target 1 and the result of the last frame. So for example 20% new and 80% old. (For frame rate consistency the new percentage should be depending on the frame rate.)

So in odd frames you combine 1 and 2 into 3 and then display 3. In even frames you combine 1 and 3 into 2 and then display 2.

With a 50/50 blending rate you’ll get this:
50%: frame 0
25%: frame -1
12.5%: frame -2
6.25%: frame -3
Et cetera

Nice idea. Thanks. You may be right that it won’t look like I expect, but I am curious. :slight_smile: