<p>You can get fancy with individual weighting on the blur maps if you want to adjust the look, but an equally weighted mix (and yes, it should be additive) will work too. I’m not sure about whether you need to gamma-correct the blurred image before adding it to the source one, but you should definitely get it into linear space before doing the blur; <a href="https://ninedegreesbelow.com/photography/linear-gamma-blur-normal-blend.html" rel="nofollow noreferrer">this article</a> has some good illustrations as to why.</p>

CC BY-SA 3.0
2018-01-03T22:34:00.917Z
2018-01-03T22:34:00.917Z
Noah Witherspoon
<h2>In short:</h2>

<p>You should not gamma correct your glow map. In fact, you should do everything in a <strong>linear color space</strong>. At the very end, when doing any color grading (which is the very last step), you convert the final image to the right color space. The color space include that gamma correction.</p>

<h2>In long:</h2>

<p>Gamma correction is a step in the encoding of images. It is usually done so that we use more bits to store the shadows and less bits to store the highlights, since we see less detail in the highlights anyway. It is also part of some color spaces. These color spaces make sure the image looks the way it is supposed to. It is the final step, often part of color grading. Just before it is send out to the display, or saved to a file. This means that everything before should be in a linear color space.</p>

<p>Usually things would look like this:</p>

<ol>
<li>Load textures and convert them to a linear space, so you do not double gamma correct..</li>
<li>Render the image.</li>
<li>Do the post effects.</li>
<li><p>Convert the image to the final color space with color grading. Probably sRGB Gamma. Converting to the color space includes the gamma correcting.</p>

<p><em>Color grading is not necessary, but optional.</em></p></li>
</ol>

<p>When having everything at linear and doing the gamma correction at the very end, you will need a high precision for the color. Using floating point framebuffers is recommended. When using the default 8-bit framebuffer the whole way, you end up getting banding effects when gamma correcting.</p>

<p>This setup is not always done for games, to my knowledge, since most people will barely notice it or even care about it. In the film industry, VFX and animation, using the proper color space is more important.</p>

<p>When not doing it the 'right' way, the textures are not converted to linear and at the end, there is no gamma correction. Lights are supposed to have a quadratic falloff to be physically correct, but when gamma correcting it with a gamma of 2.0, it becomes a linear falloff. Lights can therefore get a linear falloff and look normal. As Noah Witherspoon pointed out, when blending and blurring you should use a linear color space, however this is not always done either.</p>

<p>The reasons for not doing it the 'right' way, is probably that it still looks fine. You do not need to do it this way, to end up with good graphics. It is always a matter of what the artist likes the most.</p>

CC BY-SA 3.0
2018-01-04T14:50:22.963Z
*"The reasons for not doing it the 'right' way, is probably that it still looks fine"*
I suspect it's more that when graphics moved from work stations (such as SGI machines) that had, say, 10bit per channel support and perhaps did linear colour directly, to lower end devices with only 8bpc, that either doing the conversion was too expensive or simply forgotten about.
Simon F
CC BY-SA 3.0
2018-01-03T23:15:48.667Z
2018-01-03T23:15:48.667Z
bram0101
<p>Hello I have a simple application with some bright 2d mono-color shapes I am hoping to make appear emissive with a nice glow around them. To do that I am producing multiple gaussian blurs of varying kernels and resolutions and adding them all together to create a composite glow.</p>

<p>I have seen many guides mention this and even mention what sizes and kernels they are using to produce their bloom however they never mention the math they used to put them all together. Right now I am assuming it was just regular additive blending.</p>

<p>I was wondering what tips you might have to put this glow effect together effectively as far as if I should do anything other than just adding pixels together to combine the various maps. Should I do something with the weight on certain textures used in the composite? </p>

<p>I am just trying to composite everything in an optimal manner.</p>

<p>My main concern is whether or not I should gamma correct my glow map or if that is accounted with the weights from the gaussian sampling or source material. Should I gamma correct my blurred composite before adding it to the source image?</p>

CC BY-SA 3.0
2018-01-04T11:44:42.567Z
For further information, you might like to consult my answer to [*What are the practical differences when working with colors in a linear vs. a non-linear RGB space?* on Stack Overflow](https://stackoverflow.com/q/12524623/967945)
Dan Hulme
<gaussian-blur><gamma>
Does a gaussian blur based bloom/glow shader require gamma correction? Any other tips?
J.Doe
# Does a gaussian blur based bloom/glow shader require gamma correction? Any other tips?

(Asked by: username_0 on 2018-01-03)

Hello I have a simple application with some bright 2d mono-color shapes I am hoping to make appear emissive with a nice glow around them. To do that I am producing multiple gaussian blurs of varying kernels and resolutions and adding them all together to create a composite glow.

I have seen many guides mention this and even mention what sizes and kernels they are using to produce their bloom however they never mention the math they used to put them all together. Right now I am assuming it was just regular additive blending.

I was wondering what tips you might have to put this glow effect together effectively as far as if I should do anything other than just adding pixels together to combine the various maps. Should I do something with the weight on certain textures used in the composite?

I am just trying to composite everything in an optimal manner.

My main concern is whether or not I should gamma correct my glow map or if that is accounted with the weights from the gaussian sampling or source material. Should I gamma correct my blurred composite before adding it to the source image?

**Tags:** gaussian-blur, gamma

> **Comments:**
> **username_1**: For further information, you might like to consult my answer to [*What are the practical differences when working with colors in a linear vs. a non-linear RGB space?* on Stack Overflow](https://stackoverflow.com/q/12524623/967945)  

---

## 2 answers

### Answer by username_3 on 2018-01-03. Score: 4 | Accepted answer

## In short:

You should not gamma correct your glow map. In fact, you should do everything in a **linear color space**. At the very end, when doing any color grading (which is the very last step), you convert the final image to the right color space. The color space include that gamma correction.

## In long:

Gamma correction is a step in the encoding of images. It is usually done so that we use more bits to store the shadows and less bits to store the highlights, since we see less detail in the highlights anyway. It is also part of some color spaces. These color spaces make sure the image looks the way it is supposed to. It is the final step, often part of color grading. Just before it is send out to the display, or saved to a file. This means that everything before should be in a linear color space.

Usually things would look like this:

1. Load textures and convert them to a linear space, so you do not double gamma correct..
2. Render the image.
3. Do the post effects.
4. Convert the image to the final color space with color grading. Probably sRGB Gamma. Converting to the color space includes the gamma correcting.

   *Color grading is not necessary, but optional.*

When having everything at linear and doing the gamma correction at the very end, you will need a high precision for the color. Using floating point framebuffers is recommended. When using the default 8-bit framebuffer the whole way, you end up getting banding effects when gamma correcting.

This setup is not always done for games, to my knowledge, since most people will barely notice it or even care about it. In the film industry, VFX and animation, using the proper color space is more important.

When not doing it the 'right' way, the textures are not converted to linear and at the end, there is no gamma correction. Lights are supposed to have a quadratic falloff to be physically correct, but when gamma correcting it with a gamma of 2.0, it becomes a linear falloff. Lights can therefore get a linear falloff and look normal. As username_2 username_2 pointed out, when blending and blurring you should use a linear color space, however this is not always done either.

The reasons for not doing it the 'right' way, is probably that it still looks fine. You do not need to do it this way, to end up with good graphics. It is always a matter of what the artist likes the most.

> **Comments:**
> **username_4**: *"The reasons for not doing it the 'right' way, is probably that it still looks fine"* I suspect it's more that when graphics moved from work stations (such as SGI machines) that had, say, 10bit per channel support and perhaps did linear colour directly, to lower end devices with only 8bpc, that either doing the conversion was too expensive or simply forgotten about.  

---

### Answer by username_2 on 2018-01-03. Score: 2

You can get fancy with individual weighting on the blur maps if you want to adjust the look, but an equally weighted mix (and yes, it should be additive) will work too. I’m not sure about whether you need to gamma-correct the blurred image before adding it to the source one, but you should definitely get it into linear space before doing the blur; [this article](https://ninedegreesbelow.com/photography/linear-gamma-blur-normal-blend.html) has some good illustrations as to why.


---

