Advertisement

Upsamping Glow / Bloom

Started by January 02, 2020 08:12 AM
2 comments, last by JoeJ 5 years ago

I have 2 questions about bloom effect.

 

The first is about the best way to incorporate a lens dirt texture. I thought it’s just a simple multiplication between with the lens dirt texture and the glow – but I’m not pleased with the results. Has anyone implemented it and can share the code / sample dirt texture?

 

Second, in my implementation, I take the output of the bright pass (passes only “bright spots”) and downsample by 2x2 recursively as following: bilinear sampling (simple 2x2 box filter) followed by a small Gaussian blur. I repeat this process 4 times, each round I use the output of the previous one, so the Gaussian width is effectively doubles every round. Then, I compose all the mipmaps with some weights onto the original image.

I noticed that even though I’m using a bilinear sampler, the higher octaves show blocky features. I wonder if I should upsample the mips recursively, but I’d like to avoid the upsampling costs and I thought that the linear sampler should be sufficient for the composition.

 

In the attached top image, I set all the mip weights to 1.0 and in the bottom one I show only the higher octave by setting all the other weights to 0.0 (In the image, I’m overdoing the effect for the sake of the example and showing only the glow image).

 

Not quite exactly explained what the problem is: maybe you have thia pixeloze you want to blur out? If so i guess your dirt texture is way too small anyway, i do not see any interpolation of texels in this pixelated thing, do interpolation between this texture…

Advertisement

iradicator said:
Second, in my implementation, I take the output of the bright pass (passes only “bright spots”) and downsample by 2x2 recursively as following: bilinear sampling (simple 2x2 box filter) followed by a small Gaussian blur. I repeat this process 4 times,

Recently i felt super dumb when i figured this out:

blur, downsample, blur, downsample, blur, downsample

…gives the same result as just doing:

downsample, downsample, downsample, blur (EDIT: unsure about that final blur)

So the blur in each of your step seems redunant. Still not sure about it, but visually it looked like the exact same result. Though, my blur is just simple (left neighbor + right neighbor + center * 2) / 4, so a gaussian should behave differently, but could be opportunity for optimization.

Maybe somebody can confrim this?

Your result could indicate a bug, meaning 2 (or 4) neighboring pixels are the same (or almost the same) color. Not sure, but does not look like expected bilinear filter to me.

Otherwise, what would help is a cubic filter, see here for some image comparison: https://stackoverflow.com/questions/13501081/efficient-bicubic-filtering-code-in-glsl

This topic is closed to new replies.

Advertisement