Skip to content
Xor edited this page May 30, 2025 · 2 revisions

Hello! Here's a quick demo for my bokeh shader, which is an extension of my 1-Pass Blur shader.

Instead of averaging the blur samples in sRGB color space, I apply a power curve to each sample's color, sum up the samples, and then reverse the curve with the averaged results. Playing around with the GAMMA power can give you stronger results.

Bokeh blur

This gives brighter pixels more weight, just as it appears in real lenses. For more details, read about gamma correction here.

Note: This demo uses a lot of texture samples (500!) at a high resolution, making it quite slow on low-end devices. This is more of a proof-of-concept than an asset you can slap in your project (try lowering the samples if you use it). Perhaps this can be done in 2 passes?

Clone this wiki locally