<p>Yes, your theory is correct. A gamma-correct blur entails converting the input pixels to linear color space, performing the blur weighting and accumulation in that space, and then converting back to gamma space at the end.</p>

<p>As noted in the comments, the actual transform is not literally squaring and square-rooting, that's just an approximation (and not that good of one). For the true sRGB gamma transform, see the equations in <a href="https://en.wikipedia.org/wiki/SRGB#Specification_of_the_transformation">this Wikipedia article</a> (look down the page for the equations involving $C_\text{srgb}$ and $C_\text{linear}$).</p>

<p>By the way, some visual comparisons of gamma-correct and gamma-incorrect blurs can be found on <a href="http://ninedegreesbelow.com/photography/linear-gamma-blur-normal-blend.html#100">this page by Elle Stone</a>, which shows why this whole thing matters.</p>

CC BY-SA 3.0
2016-07-03T01:28:41.097Z
2016-07-03T01:28:41.097Z
Nathan Reed
<p>I am trying to make a glow shader using separable gaussian blurring.</p>

<p>I have recently been inspired by the short youtube video <a href="https://www.youtube.com/watch?v=LKnqECcg6Gw">"computer color is broken"</a> and I have <a href="https://www.shadertoy.com/view/MsGSR3">messed with it with color interpolation</a> and boy his suggestion is beautiful!</p>

<p>A big thing the video talks about is that this principal should be applied to blurring, however I am pretty confused.  I don't really know what to square when and what to sqrt when when values are being added. My current theory is each texture sample for the gaussian blur gets raised by the power of two weighted with a bell curve and added to a sum like usual. At the end the sum is square rooted, but i'm not sure if that is correct. Could someone please confirm? Would this make an appreciable difference that made things worth it?</p>

CC BY-SA 3.0
2016-06-30T11:14:48.513Z
No the power is 2.2 usually (read about [gamma correction](https://en.wikipedia.org/wiki/Gamma_correction))
joojaa
CC BY-SA 3.0
2016-07-01T05:09:22.967Z
So wait add the sum of your pixels with each one raised to the 2.2 power. And then take that sum by the 1/2.2 power?
J.Doe
CC BY-SA 3.0
2016-07-01T05:27:04.647Z
Depends on how pedantic you want to be, a gamma correction of 2.2 certainly is close to srgb but if you really want to be pedantically correct google dor linear to srgb
joojaa
<color-science><blur><gamma>
Applying correct light physics to gaussian blur formulas for glow
J.Doe
# Applying correct light physics to gaussian blur formulas for glow

(Asked by: username_0 on 2016-06-30)

I am trying to make a glow shader using separable gaussian blurring.

I have recently been inspired by the short youtube video ["computer color is broken"](https://www.youtube.com/watch?v=LKnqECcg6Gw) and I have [messed with it with color interpolation](https://www.shadertoy.com/view/MsGSR3) and boy his suggestion is beautiful!

A big thing the video talks about is that this principal should be applied to blurring, however I am pretty confused. I don't really know what to square when and what to sqrt when when values are being added. My current theory is each texture sample for the gaussian blur gets raised by the power of two weighted with a bell curve and added to a sum like usual. At the end the sum is square rooted, but i'm not sure if that is correct. Could someone please confirm? Would this make an appreciable difference that made things worth it?

**Tags:** color-science, blur, gamma

> **Comments:**
> **username_1**: No the power is 2.2 usually (read about [gamma correction](https://en.wikipedia.org/wiki/Gamma_correction))  
> **username_0**: So wait add the sum of your pixels with each one raised to the 2.2 power. And then take that sum by the 1/2.2 power?  
> **username_1**: Depends on how pedantic you want to be, a gamma correction of 2.2 certainly is close to srgb but if you really want to be pedantically correct google dor linear to srgb  

---

## 1 answers

### Answer by username_2 on 2016-07-03. Score: 7 | Accepted answer

Yes, your theory is correct. A gamma-correct blur entails converting the input pixels to linear color space, performing the blur weighting and accumulation in that space, and then converting back to gamma space at the end.

As noted in the comments, the actual transform is not literally squaring and square-rooting, that's just an approximation (and not that good of one). For the true sRGB gamma transform, see the equations in [this Wikipedia article](https://en.wikipedia.org/wiki/SRGB#Specification_of_the_transformation) (look down the page for the equations involving $C\_\text{srgb}$ and $C\_\text{linear}$).

By the way, some visual comparisons of gamma-correct and gamma-incorrect blurs can be found on [this page by Elle Stone](http://ninedegreesbelow.com/photography/linear-gamma-blur-normal-blend.html#100), which shows why this whole thing matters.


---

