<h3>Introduction</h3>

<p>It depends on how you create the map! Consider the following and let it sink in for a while before you go forward:</p>

<ol>
<li>The image is displayed with a gamma correction for the benefit of your eyes</li>
<li>The data is still just data. The gamma correction is for the display part not the data part.</li>
</ol>

<p>Now a bump map is pretty hard to draw with a paint application. Because its hard to see even if you were correctly linear. So you end up using such things as looking at values. Now here is the catch:</p>

<ul>
<li>If you decide that 128 is halfway in your intensity then that is reality. Since that is what your encoding into the data stream. The data is what you interpret it to be since its not meant for human eyes and the monitor. Who cares what the monitor shows the values as its all on how you interpret the data editing it in.</li>
</ul>

<h3>Making the bump/displacement map</h3>

<p>Ok, so now I have described that the data is up to interpretation. But why would you interpret the data as linear? Because then you can design your side profile better. See what you can do is think of 100% opacity of your brush as the target height you want to carve or layer to. You can then use the curves tool to design the shape of your stamps brush (since you think the data is linear). </p>

<p><a href="https://i.sstatic.net/Mz2yX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Mz2yX.png" alt="enter image description here"></a></p>

<p><strong>Image 1</strong>: A suction cup stamp. </p>

<p>Now if you do something like this then your image is linear despite what everybody tells you. You have decided to discard the image rules that says otherwise. <strong>And that is why the image is linear</strong>, the author chooses for it to be linear so its easier to work with.</p>

<p><a href="https://i.sstatic.net/txFW0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/txFW0.png" alt="enter image description here"></a></p>

<p><strong>Image 2</strong>: Same image displaced and interpreted linear (note I scaled the height a bit to fit to my default bb size), working as intended.</p>

<h3>Technically linear is better.</h3>

<p>A synthetic map has no benefit of compressing certain values on the expense of others. Linear is inherently better because the spread of your bump is better that way. Which is why you'd be wasting resources encoding it in a gamma corrected manner.</p>

<p>Secondly a image does not need to specify what color space it is in. Its just that image editors will assume it is sRGB encoded. You have no reason to do same interpretation, no info means just: "Nobody bothered to write down what they were thinking". So maybe the point should be made you should tag it linear. But here is the rub... your computer does not come with a easily accessible linear profile.</p>

<h3>What about Photoshop and blur?</h3>

<p>This is where it gets tricky. Photoshop tries to do quite much work to ensure that you do not need to know anything about this stuff. And this is where you shoot yourself in the foot. Se Photoshop is not meant for texture making, its meant to edit images not random data. So since blur on a image is different linear and nonlinear it wont work its geared to wrong data.</p>

<p>But you can do one of 2 things to fix this:</p>

<ol>
<li>Disable the gamma correction of blur</li>
<li>set your working space to a linear profile</li>
</ol>

<h3>Conclusion</h3>

<p>The reason you have a hard time with this is </p>

<ol>
<li>You do not know what other people think, you simply do not know if they should be gamma corrected or not.</li>
<li>that your using a application that treats images as images</li>
</ol>

<p>Point one is especially confusing. I just know that ALL my bump and displacement maps are in fact linear. But I can not know what your maps are. Odds are they are linear because its nearly universally understood that the data is linear. Even people who do not know about gamma tend to do it linear for bump/displacement for some reason (because its easy and that's what you think images are until somebody tells you otherwise).</p>

CC BY-SA 3.0
2016-08-29T14:31:50.973Z
Thank you for your input - wow! :) I'll have a look at this when I get more spare time. I'll get back to you, thanks!
Kristoffer Helander
CC BY-SA 4.0
2019-07-05T08:44:56.573Z
`Even people who do not know about gamma tend to do it linear for bump/displacement for some reason`
Likely because those maps are generated.
Tara
CC BY-SA 3.0
2016-08-11T20:50:28.990Z
2016-08-12T05:49:14.120Z
2016-08-12T05:49:14.120Z
joojaa
<p>The fact that a photo is stored in gamma space doesn't have to do with PNG or JPEG, it has to do with the fact that it's a photo.</p>

<p>The camera detects a 50% intensity but is going to save it as a 187 instead of 127, because that is more efficient to keep the color information that matters to the human eye when you have only 256 different possible values. And so does Photoshop if you tell it so.</p>

<p><strong>For normals or displacement maps, you don't have this need so there is no reason to use gamma space for them</strong> (using gamma for them would actually be a mistake, since it would affect how precision is distributed). Thus when you decode a normal texture or a displacement texture, you don't need to apply gamma.</p>

<p>If the normal map is encoded in a different space though, <a href="http://aras-p.info/texts/CompactNormalStorage.html" rel="nofollow">as can be the case for a G-Buffer for example</a>, then you have to apply the corresponding correction.</p>

CC BY-SA 3.0
2016-08-10T21:05:59.033Z
How do you tell Photoshop to save an image with the gamma baked in as you said above: _"And so does Photoshop if you tell it so."_
Kristoffer Helander
CC BY-SA 3.0
2016-08-15T03:05:57.087Z
This doesn't explain the "why" at all. It just reiterates the "what".
user1118321
CC BY-SA 3.0
2016-08-15T07:42:23.793Z
@user1118321: I believe it does. I added emphasis in an attempt to make it clearer.
Julien Guertault
CC BY-SA 3.0
2016-08-15T07:58:38.783Z
Well, true but it still does not really explain why. I admit I have the same problem i just mention the lack of benefit or harm done by such compression. There is no need but the why is that the data of images is peculiar due to human senses whereas our spatial reasoning is more linear in nature (as far as the 3D app is concerned)
joojaa
CC BY-SA 3.0
2016-08-10T15:40:22.977Z
2016-08-15T07:41:09.803Z
2016-08-15T07:41:09.803Z
Julien Guertault
<p>JPG, PNG or any other 8 bit image formats do not intrinsically have 1/2.2 gamma associated with it. They just store values from 0-255. How that data is interpreted depends on the software that reads and writes those files. The interesting fact is that most image editing software uses gamma color space by default. All the brushes, effects, filters and even the color picker all operate in gamma space. Just look at the shades of gray on the color picker in Photoshop. They do not follow a linear distribution.</p>

<p>The consequence is that Photoshop does no conversions between gamma and linear color space when opening or saving an image (by default), only when displaying it. That means that you can just as easily use it to create or edit linear data such as a heightmap as you can edit photos. The bump map does not look correctly when loaded with gamma correction, because it wasn't saved with it.</p>

CC BY-SA 3.0
2016-08-10T15:22:55.063Z
Here is a YouTube video also explaining that the stored value in an image is the 1/2.2 (but he simplifies it and just say that it's the square root, there is a disclaimer of that in text.)
Computer Color is Broken - MinutePhysics 
[link](https://www.youtube.com/watch?v=LKnqECcg6Gw)
Kristoffer Helander
CC BY-SA 3.0
2016-08-10T15:33:50.350Z
@KristofferHelander Yes, but he says it's only the camera that stores the values as square roots and only the display that squares it back. Image editing software like Photoshop then just open and save the image with no conversions, which results in artifacts shown in the video when you try to blend colors.
Quinchilion
CC BY-SA 3.0
2016-08-11T13:31:03.027Z
Correct me if I'm wrong on this. When I draw a gradient ramp in Photoshop that looks linear to me on the screen the values in that ramp actually are linear. But Photoshop adds a viewing gamma of 1/2.2 since the monitor adds a gamma of 2.2, thus the images pixel values are linear and they also look linear. But this 1/2.2 gamma is only a viewing gamma that Photoshop use for displaying the image, it is not baked into to image, and therefore no gamma correction to the image need to be done in the 3D software, (use gamma 1.0) since the values already are linear?
Kristoffer Helander
CC BY-SA 3.0
2016-08-11T13:58:48.603Z
@KristofferHelander https://goo.gl/yqkeUP The bottom gradient represents physical brightness. If Photoshop applied a gamma of 1/2.2 for either drawing the gradient or displaying the image, you would see the bottom gradient. Instead, you see the top one, which coincidentally appears to be linear, but isn't. It also wouldn't work for viewing photos. The camera applied 1/2.2 when saving the photo, then Photoshop would apply another 1/2.2, but the display only adds gamma of 2.2 once. That wouldn't look right.
Quinchilion
CC BY-SA 3.0
2016-08-11T14:19:24.253Z
If I fill a document in Photoshop half side red (255,0,0) and the other half with green (0,255,0) and then use a Gaussian blur on that, the resulting gradient becomes brownish rather then yellow in the middle as shown in that video I posted. Why is that? If the pixels in the image are linear then why does the math get screwed up? I don't understand how a displacement map painted in Photoshop is linear and good to go for rendering but at the same time the blurring of pixels gets screwed up with the wrong gamma and colors become to dark and brownish?
Kristoffer Helander
CC BY-SA 3.0
2016-08-11T16:11:49.957Z
@KristofferHelander It's a confusing subject, I understand. As I was trying to say, Photoshop does no conversions. So if you load an image that is stored with gamma, it stays with gamma applied and because of that blurring is wrong. If you load a displacement map that is treated as linear data, it is loaded as linear and saved as linear because no conversions are applied by Photoshop by default. There is no special treatment based on the color model. The only difference between the two is that the displacement map is displayed wrong - the display still applies a gamma of 2.2 to it.
Quinchilion
CC BY-SA 3.0
2016-08-12T09:58:51.210Z
If I create a gradient, let say 256 pixels wide, and I make sure those pixels are linear going from 0, 1, 2, 3, ... to 255. Then I have created a linear ramp, and if I use that as a displacement in 3D without any gamma correction in the 3D software I get a linear displacement effect. But does that same gradient look linear on the screen? And if I wanted to use that same gradient as a diffuse texture, I would have to apply the gamma correction on it, right? So when piping the map into Displacement you keep the pixels as is, but for Diffuse you have to linearize the texture by gamma correcting?
Kristoffer Helander
CC BY-SA 3.0
2016-08-12T12:07:05.883Z
You got it. The gradient will only look linear on the screen if you apply gamma correction to it. That, however, makes the gradient itself non-linear in terms of the raw values and thus unsuitable for use as a displacement map.
Quinchilion
CC BY-SA 3.0
2016-08-15T03:09:19.413Z
This answer is factually incorrect. You tell Photoshop in what color space to manipulate data, and many images have information about what colorspace they are stored in. Photoshop will convert from the image's color space to its working space (which you can change), and can save color space info in the images it creates. If there is no color space info stored in the image, it makes a decision about which color space it assumes. But it is always doing this unless you specifically set it not to, and that is not the default.
user1118321
CC BY-SA 3.0
2016-08-10T15:14:13.783Z
2016-08-10T15:14:13.783Z
Quinchilion
<p>Actually, if your bump or displacement map is saved with that 0.45 gamma correction, it's wrong. These maps contain geometrical information rather than colour, and as such, should be simply encoded linearly.</p>

<p>For a related issue and a fix for Adobe Photoshop, see this slide deck: <a href="https://docs.google.com/presentation/d/1vS5nAAnXbZ8Pt6-dXxy-xEXDkjfjXTmNnthNGccorl0/edit#slide=id.g14b3e28660_0_8" rel="nofollow">https://docs.google.com/presentation/d/1vS5nAAnXbZ8Pt6-dXxy-xEXDkjfjXTmNnthNGccorl0/edit#slide=id.g14b3e28660_0_8</a></p>

CC BY-SA 3.0
2016-08-15T09:01:25.493Z
This is especially true for a normal map were you expect vector lengths to be 1.
PaulHK
CC BY-SA 3.0
2016-08-10T14:46:23.977Z
2016-08-16T10:36:08.683Z
2016-08-16T10:36:08.683Z
IneQuation
<p>So I'm trying to wrap my head around this from a fairly technical point of view.</p>

<p>When you add a Bump or Normal or Displacement map in your shader they should not be gamma corrected. But diffuse textures should be. But why?</p>

<p>When you save a file in 8bit (or 16bit Integer) with a format like JPEG, PNG or TIFF they get the gamma of 0.4545 (1/2.2) burnt in. So a camera captures the light from the real world (that is linear) and when saving the photo as a JPEG a gamma value of 1/2.2 is added, as a way to compress the information into 8bit, and then when you view the image on a monitor that adds a gamma of 2.2 making the luminance linear again.</p>

<p>So when using a diffuse textures (like a photo) you need to a "remove" that 1/2.2 gamma to make it linear (called linearizing) so now the texture looks darker but these values are correct from a mathematical standpoint so the renderer will make the correct calculations. Side note: the software used a display gamma of 2.2 to make sure the textures looks correct it's just for the internal calculation that they are linearized. But when I create a Bump map in Photoshop and save that as a JPG or PNG then that 1/2.2 gamma is burnt into that image as well, so why doesn't this Bump map need to be linearized as well?</p>

<p>If I load a Bump map in 3ds Max with a input gamma of 2.2 just like a would do with a Diffuse texture, the diffuse looks right but the bump looks wrong, so I have to set the input gamma to 1.0 for the bump in order to make it look right, but as I said: why, both image files have the 1/2.2 gamma burnt in, right?</p>

<gamma>
Why shouldn't Bump, Normal and Displacement maps be gamma corrected?
Kristoffer Helander
# Why shouldn't Bump, Normal and Displacement maps be gamma corrected?

(Asked by: username_0 on 2016-08-10)

So I'm trying to wrap my head around this from a fairly technical point of view.

When you add a Bump or Normal or Displacement map in your shader they should not be gamma corrected. But diffuse textures should be. But why?

When you save a file in 8bit (or 16bit Integer) with a format like JPEG, PNG or TIFF they get the gamma of 0.4545 (1/2.2) burnt in. So a camera captures the light from the real world (that is linear) and when saving the photo as a JPEG a gamma value of 1/2.2 is added, as a way to compress the information into 8bit, and then when you view the image on a monitor that adds a gamma of 2.2 making the luminance linear again.

So when using a diffuse textures (like a photo) you need to a "remove" that 1/2.2 gamma to make it linear (called linearizing) so now the texture looks darker but these values are correct from a mathematical standpoint so the renderer will make the correct calculations. Side note: the software used a display gamma of 2.2 to make sure the textures looks correct it's just for the internal calculation that they are linearized. But when I create a Bump map in Photoshop and save that as a JPG or PNG then that 1/2.2 gamma is burnt into that image as well, so why doesn't this Bump map need to be linearized as well?

If I load a Bump map in 3ds Max with a input gamma of 2.2 just like a would do with a Diffuse texture, the diffuse looks right but the bump looks wrong, so I have to set the input gamma to 1.0 for the bump in order to make it look right, but as I said: why, both image files have the 1/2.2 gamma burnt in, right?

**Tags:** gamma


---

## 4 answers

### Answer by username_1 on 2016-08-11. Score: 3 | Accepted answer

### Introduction

It depends on how you create the map! Consider the following and let it sink in for a while before you go forward:

1. The image is displayed with a gamma correction for the benefit of your eyes
2. The data is still just data. The gamma correction is for the display part not the data part.

Now a bump map is pretty hard to draw with a paint application. Because its hard to see even if you were correctly linear. So you end up using such things as looking at values. Now here is the catch:

* If you decide that 128 is halfway in your intensity then that is reality. Since that is what your encoding into the data stream. The data is what you interpret it to be since its not meant for human eyes and the monitor. Who cares what the monitor shows the values as its all on how you interpret the data editing it in.

### Making the bump/displacement map

Ok, so now I have described that the data is up to interpretation. But why would you interpret the data as linear? Because then you can design your side profile better. See what you can do is think of 100% opacity of your brush as the target height you want to carve or layer to. You can then use the curves tool to design the shape of your stamps brush (since you think the data is linear).

[![enter image description here](https://i.sstatic.net/Mz2yX.png)](https://i.sstatic.net/Mz2yX.png)

**Image 1**: A suction cup stamp.

Now if you do something like this then your image is linear despite what everybody tells you. You have decided to discard the image rules that says otherwise. **And that is why the image is linear**, the author chooses for it to be linear so its easier to work with.

[![enter image description here](https://i.sstatic.net/txFW0.png)](https://i.sstatic.net/txFW0.png)

**Image 2**: Same image displaced and interpreted linear (note I scaled the height a bit to fit to my default bb size), working as intended.

### Technically linear is better.

A synthetic map has no benefit of compressing certain values on the expense of others. Linear is inherently better because the spread of your bump is better that way. Which is why you'd be wasting resources encoding it in a gamma corrected manner.

Secondly a image does not need to specify what color space it is in. Its just that image editors will assume it is sRGB encoded. You have no reason to do same interpretation, no info means just: "Nobody bothered to write down what they were thinking". So maybe the point should be made you should tag it linear. But here is the rub... your computer does not come with a easily accessible linear profile.

### What about Photoshop and blur?

This is where it gets tricky. Photoshop tries to do quite much work to ensure that you do not need to know anything about this stuff. And this is where you shoot yourself in the foot. Se Photoshop is not meant for texture making, its meant to edit images not random data. So since blur on a image is different linear and nonlinear it wont work its geared to wrong data.

But you can do one of 2 things to fix this:

1. Disable the gamma correction of blur
2. set your working space to a linear profile

### Conclusion

The reason you have a hard time with this is

1. You do not know what other people think, you simply do not know if they should be gamma corrected or not.
2. that your using a application that treats images as images

Point one is especially confusing. I just know that ALL my bump and displacement maps are in fact linear. But I can not know what your maps are. Odds are they are linear because its nearly universally understood that the data is linear. Even people who do not know about gamma tend to do it linear for bump/displacement for some reason (because its easy and that's what you think images are until somebody tells you otherwise).

> **Comments:**
> **username_0**: Thank you for your input - wow! :) I'll have a look at this when I get more spare time. I'll get back to you, thanks!  
> **username_2**: `Even people who do not know about gamma tend to do it linear for bump/displacement for some reason` Likely because those maps are generated.  

---

### Answer by username_3 on 2016-08-10. Score: 5

The fact that a photo is stored in gamma space doesn't have to do with PNG or JPEG, it has to do with the fact that it's a photo.

The camera detects a 50% intensity but is going to save it as a 187 instead of 127, because that is more efficient to keep the color information that matters to the human eye when you have only 256 different possible values. And so does Photoshop if you tell it so.

**For normals or displacement maps, you don't have this need so there is no reason to use gamma space for them** (using gamma for them would actually be a mistake, since it would affect how precision is distributed). Thus when you decode a normal texture or a displacement texture, you don't need to apply gamma.

If the normal map is encoded in a different space though, [as can be the case for a G-Buffer for example](http://aras-p.info/texts/CompactNormalStorage.html), then you have to apply the corresponding correction.

> **Comments:**
> **username_0**: How do you tell Photoshop to save an image with the gamma baked in as you said above: _"And so does Photoshop if you tell it so."_  
> **username_4**: This doesn't explain the "why" at all. It just reiterates the "what".  
> **username_3**: @username_4: I believe it does. I added emphasis in an attempt to make it clearer.  
> **username_1**: Well, true but it still does not really explain why. I admit I have the same problem i just mention the lack of benefit or harm done by such compression. There is no need but the why is that the data of images is peculiar due to human senses whereas our spatial reasoning is more linear in nature (as far as the 3D app is concerned)  

---

### Answer by username_5 on 2016-08-10. Score: 3

JPG, PNG or any other 8 bit image formats do not intrinsically have 1/2.2 gamma associated with it. They just store values from 0-255. How that data is interpreted depends on the software that reads and writes those files. The interesting fact is that most image editing software uses gamma color space by default. All the brushes, effects, filters and even the color picker all operate in gamma space. Just look at the shades of gray on the color picker in Photoshop. They do not follow a linear distribution.

The consequence is that Photoshop does no conversions between gamma and linear color space when opening or saving an image (by default), only when displaying it. That means that you can just as easily use it to create or edit linear data such as a heightmap as you can edit photos. The bump map does not look correctly when loaded with gamma correction, because it wasn't saved with it.

> **Comments:**
> **username_0**: Here is a YouTube video also explaining that the stored value in an image is the 1/2.2 (but he simplifies it and just say that it's the square root, there is a disclaimer of that in text.) Computer Color is Broken - MinutePhysics  [link](https://www.youtube.com/watch?v=LKnqECcg6Gw)  
> **username_5**: @username_0 Yes, but he says it's only the camera that stores the values as square roots and only the display that squares it back. Image editing software like Photoshop then just open and save the image with no conversions, which results in artifacts shown in the video when you try to blend colors.  
> **username_0**: Correct me if I'm wrong on this. When I draw a gradient ramp in Photoshop that looks linear to me on the screen the values in that ramp actually are linear. But Photoshop adds a viewing gamma of 1/2.2 since the monitor adds a gamma of 2.2, thus the images pixel values are linear and they also look linear. But this 1/2.2 gamma is only a viewing gamma that Photoshop use for displaying the image, it is not baked into to image, and therefore no gamma correction to the image need to be done in the 3D software, (use gamma 1.0) since the values already are linear?  
> **username_5**: @username_0 https://goo.gl/yqkeUP The bottom gradient represents physical brightness. If Photoshop applied a gamma of 1/2.2 for either drawing the gradient or displaying the image, you would see the bottom gradient. Instead, you see the top one, which coincidentally appears to be linear, but isn't. It also wouldn't work for viewing photos. The camera applied 1/2.2 when saving the photo, then Photoshop would apply another 1/2.2, but the display only adds gamma of 2.2 once. That wouldn't look right.  
> **username_0**: If I fill a document in Photoshop half side red (255,0,0) and the other half with green (0,255,0) and then use a Gaussian blur on that, the resulting gradient becomes brownish rather then yellow in the middle as shown in that video I posted. Why is that? If the pixels in the image are linear then why does the math get screwed up? I don't understand how a displacement map painted in Photoshop is linear and good to go for rendering but at the same time the blurring of pixels gets screwed up with the wrong gamma and colors become to dark and brownish?  
> **username_5**: @username_0 It's a confusing subject, I understand. As I was trying to say, Photoshop does no conversions. So if you load an image that is stored with gamma, it stays with gamma applied and because of that blurring is wrong. If you load a displacement map that is treated as linear data, it is loaded as linear and saved as linear because no conversions are applied by Photoshop by default. There is no special treatment based on the color model. The only difference between the two is that the displacement map is displayed wrong - the display still applies a gamma of 2.2 to it.  
> **username_0**: If I create a gradient, let say 256 pixels wide, and I make sure those pixels are linear going from 0, 1, 2, 3, ... to 255. Then I have created a linear ramp, and if I use that as a displacement in 3D without any gamma correction in the 3D software I get a linear displacement effect. But does that same gradient look linear on the screen? And if I wanted to use that same gradient as a diffuse texture, I would have to apply the gamma correction on it, right? So when piping the map into Displacement you keep the pixels as is, but for Diffuse you have to linearize the texture by gamma correcting?  
> **username_5**: You got it. The gradient will only look linear on the screen if you apply gamma correction to it. That, however, makes the gradient itself non-linear in terms of the raw values and thus unsuitable for use as a displacement map.  
> **username_4**: This answer is factually incorrect. You tell Photoshop in what color space to manipulate data, and many images have information about what colorspace they are stored in. Photoshop will convert from the image's color space to its working space (which you can change), and can save color space info in the images it creates. If there is no color space info stored in the image, it makes a decision about which color space it assumes. But it is always doing this unless you specifically set it not to, and that is not the default.  

---

### Answer by username_6 on 2016-08-10. Score: 3

Actually, if your bump or displacement map is saved with that 0.45 gamma correction, it's wrong. These maps contain geometrical information rather than colour, and as such, should be simply encoded linearly.

For a related issue and a fix for Adobe Photoshop, see this slide deck: <https://docs.google.com/presentation/d/1vS5nAAnXbZ8Pt6-dXxy-xEXDkjfjXTmNnthNGccorl0/edit#slide=id.g14b3e28660_0_8>

> **Comments:**
> **username_7**: This is especially true for a normal map were you expect vector lengths to be 1.  

---

