0
$\begingroup$

I am working on a specific blur effect that implies several behaviours. But before I would like to know what you think about those blurring algorithms according to performances and quality : Kawase blur, Box blur and two pass Gaussian blur.

Next are the effects I am currently working on and I would be glad to have your thoughts on those on the proper way to achieve this. Here is a schematic view followed by my questions.

enter image description here

  1. I would like to blur the content of those 4 spheres using the same offset no mater their position. If I apply the same blur on all objects, far object's content will appear more blurry than ones on the foreground and I want to avoid that. I think that the depth make could help but any precision would help me.
  2. If I blur the whole image and apply the result on the sphere, the white background will bleed onto the sphere shape and I want to avoid that. I also don't want that the blue (3) and yellow (4) sphere merges with the red (1) and green (2) ones. But I would like that the green and red ones merges. Again This could be done using the depth but if you have more precision about how to do it it would be interesting.

Any ideas about those questions would be helpful.

Thanks a lot.

$\endgroup$
1
  • 2
    $\begingroup$ Regarding the background mixing with your objects during the blur, my recommendation would be to not render on white, but to render on transparent black. When doing the blur, you should blur using pre-multiplied alpha. That will make the result such that you can apply it to any background color (using standard alpha blending) and it will look correct. More information here: stackoverflow.com/questions/4854839/… $\endgroup$
    – Alan Wolfe
    Dec 19, 2017 at 17:01

1 Answer 1

2
$\begingroup$

If I blur the whole image and apply the result on the sphere, the white background will bleed onto the sphere shape and I want to avoid that. I also don't want that the blue (3) and yellow (4) sphere merges with the red (1) and green (2) ones. But I would like that the green and red ones merges. Again This could be done using the depth but if you have more precision about how to do it it would be interesting.

You will need to blurr in multiple passes to achieve this: once for the blue and once for the yellow, as well as once for the red and green (together). That is: you need to render to texture, you need three textures in this instance to render to, you need to blur the individual textures and then combine them in another render pass. If you know beforehand that the green and red spheres may blur together, you can just hardcode it, otherwise you need to come up with a way of determining, which spheres may blur together, and group your spheres to render into the same texture.

If you do this, keep in mind that for combining the three individual blurred textures, you need z-values for correct visibility determination.

I would like to blur the content of those 4 spheres using the same offset no mater their position. If I apply the same blur on all objects, far object's content will appear more blurry than ones on the foreground and I want to avoid that. I think that the depth make could help but any precision would help me.

Yes, you can scale your blur filter with a depth value (where you should "invert" the value to make the blurriness scale to larger effects on closer proximities, i.e. smaller depths). For a box filter, you take ratios of the pixels neighbourhoods, but you need to make sure that those ratios add up to one. For this, you'd ideally increase the ratio for the center pixel based on the proximity and reduce the ratio for the neighbouring pixels accordingly.

performances and quality : Kawase blur, Box blur and two pass Gaussian blur.

As to performance, I can't say anything about the three. As to quality, the Box Filter is rather simple, but that doesn't mean it doesn't suffice for your specific need. Just test them against each other.

$\endgroup$
1
  • 1
    $\begingroup$ To blur the different sphere separately, I decided to do it the same way is done in screen space subsurface scattering. I am using depth to calculate the difference between the basic depth and the blurred depth. If the difference is to high, I just don't apply blur. $\endgroup$
    – MaT
    Dec 26, 2017 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.