Author here, Thank you very much for linking! Masaki Kawase is a bit of a graphics programming idol of mine. Living in Japan, I got to interview him on a zoom call about what it was like being a graphics programmer in those adventurous times 1999~2005 of the Japanese video game scene.
This kick-started by desire to write about the Dual-Kawase Blur, a technique I stumbled upon when ricing my linux distro.
Fantastic piece. I love stuff with interactivity; and the comparison between blur types is great, as your eye can evaluate them side-by-side. Thanks for putting it together!
Good article, but it uses less than ideal formula for weights of the gaussian blur kernel.
Gaussian function for coefficients is fine for large sigmas, but for small blur radius you better integrate properly. Luckily, C++ standard library has std::erf function you gonna need for the proper formula. Here’s more info: https://bartwronski.com/2021/10/31/practical-gaussian-filter...
The Kawase approach is from 2005, and GPU performance has improved a ton since then. Some of the newer games do use Bokeh blurs with multiple depths of field. The result can look much more natural than the Gaussian stuff. BTW, it's not just a cinematic effect -- the fact that our pupils are round means that like cameras, they act as a disk-shaped filter for things that are out of focus.
Yes, bokeh blur is way more pleasing. In my article the gaussian likes are the focus for their use as a basic building block for other effects, like frosted glass, heat distortions, bloom and the like.
Specifically the 2015 Dual Kawase was created in the context of mobile graphics, with weak memory throughput. But even on my RTX 4090, near the fastest consumer hardware available, those unoptimized unseparable, naive gaussian implementations bring it to a crawl and `samplePosMultiplier` has a non insignificant performance hit, so texture caches still play a role.
At today's high resolutions and especially on mobile, we still need smart and optimized algorithms like the dual kawase.
Has anyone got suggestions for blur algorithms suitable for compute shaders? The usual Kawase blur (described in the article) uses bilinear sampling of textures.
You can, of course, implement the algorithm as is on a compute shader with texture sampling.
But I have a situation where the inputs and outputs should be in shared memory. I'm trying to avoid writing the results out to off-chip DRAM, which would be necessary to be able to use texture sampling.
I spent some time looking into a way of doing an efficient compute shader blur using warp/wave/subgroup intrinsics to downsample the image and then do some kind of gaussian-esque weighted average. The hard part here is that the Kawase blur samples the input at "odd" locations but warp intrinsics are limited to "even" locations if that makes sense.
I would appreciate if anyone knows any prior art in this department.
I'd like to give a shout out to Neotokyo, one of the best HL2 mods still regularly played. The soundtrack is amazing too. Sadly it's not maintained anymore and playing tends to be done in the weekends and friday nights.
If you've ever seen Ghost in the Shell or like cyberpunk stuff and don't mind a first person shooter in a universe like that? Prepare to have a lot of fun getting your butt kicked in by veterans.
The part about low-pass filtering using FFT ends with the conclusion that it is fundamentally a different thing from a gaussian blur ("Low Pass Filter ≠ Low Pass Filter"). However: A convolution in image space is just a multiplication in fourier space. If you multiplied with a gaussian in fourier space you should get a gaussian blur. It's just not necessarily the fastest option.
This kick-started by desire to write about the Dual-Kawase Blur, a technique I stumbled upon when ricing my linux distro.
Gaussian function for coefficients is fine for large sigmas, but for small blur radius you better integrate properly. Luckily, C++ standard library has std::erf function you gonna need for the proper formula. Here’s more info: https://bartwronski.com/2021/10/31/practical-gaussian-filter...
Here's a breakdown of how Doom (2016) does it: https://www.adriancourreges.com/blog/2016/09/09/doom-2016-gr...
Yes, bokeh blur is way more pleasing. In my article the gaussian likes are the focus for their use as a basic building block for other effects, like frosted glass, heat distortions, bloom and the like.
Specifically the 2015 Dual Kawase was created in the context of mobile graphics, with weak memory throughput. But even on my RTX 4090, near the fastest consumer hardware available, those unoptimized unseparable, naive gaussian implementations bring it to a crawl and `samplePosMultiplier` has a non insignificant performance hit, so texture caches still play a role.
At today's high resolutions and especially on mobile, we still need smart and optimized algorithms like the dual kawase.
You can, of course, implement the algorithm as is on a compute shader with texture sampling.
But I have a situation where the inputs and outputs should be in shared memory. I'm trying to avoid writing the results out to off-chip DRAM, which would be necessary to be able to use texture sampling.
I spent some time looking into a way of doing an efficient compute shader blur using warp/wave/subgroup intrinsics to downsample the image and then do some kind of gaussian-esque weighted average. The hard part here is that the Kawase blur samples the input at "odd" locations but warp intrinsics are limited to "even" locations if that makes sense.
I would appreciate if anyone knows any prior art in this department.
Deleted Comment
If you've ever seen Ghost in the Shell or like cyberpunk stuff and don't mind a first person shooter in a universe like that? Prepare to have a lot of fun getting your butt kicked in by veterans.
The community deserves a remake. ;-)
I use box/gaussian blurs often, but for rendering outlines/highlights of objects.
https://ameye.dev/notes/rendering-outlines/#blurred-buffer