fade to black ?


i am having an application where i am “drawing” with some shapes by _not_ redrawing the background (trails…). i would like the application to fade to black every now and then: if i am trying this by placing a black rectangle with a low alpha value, then there are always traces of the previous image left (it never gets _really_ black).
it only gets really black when i use an alpha value of around 70, but this would make the “fade” too fast…

any ideas how to achieve a smooth fade to (real) black ?



hey lia

what if you increment the alpha while you apply the fade? that way the fade will be gradual and will end with complete black.

I do know this problem and I’ve used arturo’s suggestion in the past.

just a quick thought (off the top of my head) – this residual seems like a problem with bit depth of the pixel. perhaps using a floating point FBO (offscreen buffer) would help?
I will try to take a look later today at that approach…

hi arturo,

yes, thanks, i tried that with a different application and it works fine.

but in this case, i am still constantly drawing shapes - so the effect should actually be that the shapes are slowly fading away…



oh hi zach, haven’t seen your reply before…

it’s not that urgent, but it would be cool to find a solution … :slight_smile:




ofxFadable from Rui Madeira

Old subject, but i’m facing the exact same problem … anybody know a solution for that ?
I use this fade tricks into a fbo, and if the alpha of the rectangle I draw is low, i always get a residual image.

take a look at gl/fboTrailsExample

1 Like

Thank you Arturo :slight_smile:

I feel a bit stupid to have the solution just so close to me ! But now I face a new issue, you can maybe give me a hint : why can’t I use multisampling anymore with a RGB32F internal format ?

BTW it works fine with a RGB16 and a MSAA set at 8.

So if you can explain me a bit the underlying of this issue ?

Thank you very much !

no idea, must be a limitation of your graphics card. rgba16 should be enough for this though

1 Like

I’m also trying to fade to black after having drawn a lot of white pixels with alpha. It does start like it is going to fade to black but then everything which was white stalls at grey.

Won’t it be possible to accomplish this using glBlendFunc() or glBlendFuncSeparate()? I already tried to tweak with these but still didn’t manage to make it work.

If I don’t find a solution I’ll have to write a shader for this.