   The wrong way to apply Bloom & Lens streak...
  The converntial way to apply post bloom and lens streak involves a final ADD, which inevitably excessively over-brightens the high-luminance areas in an image. This somtimes gives us bad visual efx.Another way is to apply LERP instead of ADD. This brings us an opposite issue: the whole image is overly darkened except for the bright areas.I wanna discuss:Is there any good solution to fix the over-brighten problem and maintain overall luminance of an image?   
  First of all, abbreviations are nice, but maybe not everyone understands them (or ADD means addition? :P ).Second, if you think about real life: What happens when you look into a bright light with your eyes? Your pupils shrink, so the "scene" will be darker (you're blinded a bit).What happens with a camera? If there is no auto-brightness/whatever stuff, the bright light will be over-bright, and the bloom effect will bleed into a much larger area.So both methods (whatever the abbreviations mean) seem totally right.Some games even simulate the short term blindness: if you suddenly turn towards the sun, a fading white "screen" and a bigger but shrinking lens streak will be on top the scene.I hope that helps.   ;Quote:Original post by dextmlIs there any good solution to fix the over-brighten problem and maintain overall luminance of an image?You can do it as it happens in reality. Bloom is an an optical aberration of light from an intense light source. Simply said, you can see it as a non-linear, brightness dependent blur. In fact, in reality bloom is additive on the overall image, yet subtractive from the light source it originates from. Energy from the bright source is distributed along non-optimal paths along the optical system (the light is diffracting and scattering) onto neighbouring parts of the image. So energy conservation is guaranteed, while the over all image does indeed brighten up. This is obviously independent from any tonemapping adjustment operation, such as your eyes adjusting to the increased brightness.So in fact the most realistic operation is an ADD, with or without adaptive blur.;Quote:Original post by Yann LQuote:Original post by dextmlIs there any good solution to fix the over-brighten problem and maintain overall luminance of an image?In fact, in reality bloom is additive on the overall image, yet subtractive from the light source it originates from.So in fact the most realistic operation is an ADD, with or without adaptive blur.Yes, the core idea is to guarant enery conservation.i think the problem is the substraction op, which can give plenty of jagginess. It's non-trivial to faithfully perform the substraction with smooth edges.   ;  The formulae i'm currently using is max( col, texture2D( glow, uv ) * glowfactor )where glowfactor is about 1.15... In here the glow texture is just a blurred version of the rendered scene.. It has no physic logic whatsoever but I like the result, but it's just my taste :)It is creating the halo over the dark areas arround a bright object yet preserves the very bright discontinuities with satisfiying entropy.. But it's just an idea.. :)   ;  Instead of a simple additive blend, use a screen blend. Looks much better IMO, and doesn't suffer from the overexposure problems of additive blending.I've also used a made-up blend mode using "max" like ptitjulien's above, which can work pretty well too.e.g. to avoid the darkening problem of your "lerp" solution", you can do something like:return lerp( original, max(original,bloom), ... );   ;Quote:Original post by ptitjulienThe formulae i'm currently using is max( col, texture2D( glow, uv ) * glowfactor )where glowfactor is about 1.15... In here the glow texture is just a blurred version of the rendered scene.. But it's just an idea.. :)That's nice. But still, it reduces the natural color-bleeding feeling.Hodgeman has offered a better version.Quote:Posted by HodgmanInstead of a simple additive blend, use a screen blend. Looks much better IMO, and doesn't suffer from the overexposure problems of additive blending.I've also used a made-up blend mode using "max" like ptitjulien's above, which can work pretty well too.e.g. to avoid the darkening problem of your "lerp" solution", you can do something like:return lerp( original, max(original,bloom), ... );Brilliant!Even though ScreenBlend is not cheap, but it's worth for the good composition result and scales well with future GPUs.the lerp(ori, max(ori, bloom)) is a cheap alternative to screen blend. In my case, that works well too. :);Quote:Original post by dextmlBrilliant!Even though ScreenBlend is not cheap, but it's worth for the good composition result and scales well with future GPUs.Expensive? It's just b + a * (1 - b).;Quote:Original post by MJPQuote:Original post by dextmlBrilliant!Even though ScreenBlend is not cheap, but it's worth for the good composition result and scales well with future GPUs.Expensive? It's just b + a * (1 - b).man, that's only true for LDR images (namely, lum ranges from 0 to 1).For HDR composition, u have to do more.;Quote:Original post by dextmlQuote:Original post by MJPQuote:Original post by dextmlBrilliant!Even though ScreenBlend is not cheap, but it's worth for the good composition result and scales well with future GPUs.Expensive? It's just b + a * (1 - b).man, that's only true for LDR images (namely, lum ranges from 0 to 1).For HDR composition, u have to do more.For HDR, we don't need these complex methods, that we just do exposure adjustment.   