<blockquote>
  <p>the colors are distorted and much brighter corresponding to (186,186,186) color value. If I don't apply gamma encoding then the image file displays the expected color that is (127,127,127).</p>
</blockquote>

<p>No, the gamma-correct color is not distorted; your <em>expectations</em> are. If your lighting, meshes, textures, and other scene elements were not built to be properly linear and gamma correct to the screen, then every decision you have made has been through a distorted lens. If you don't like the effect you're getting with a properly gamma-correct lighting system, that's the fault of all of those decisions you've been making, not with gamma correction.</p>

<p>Half of the full lighting intensity in a linear colorspace does correspond to greater than half in a gamma-correct colorspace. And those gamma-correct values are what you <em>ought</em> to be passing to the screen. If that's not what you're shoving into the display, then you're doing lighting wrong.</p>

CC BY-SA 4.0
2020-05-01T10:57:11.793Z
At this point it would be good to undetstand differences between humanities and sciences. Humanities deal with relative statements and sciences deal with how things work. As art is generally a humanist endeavour an artist might say that it looks good everything is hunky dory. Thats fine. However from a sientist perspective its still wrong because there are so many implied assumptions that are wrong in such a setup. You simply miss on a lot of refinements if you side step this. Everything from antialias and shading routines are slightly off. You can tweak things but would be better if not.
joojaa
CC BY-SA 4.0
2020-05-01T12:32:36.690Z
@nicol Thanks. So do you mean that the material reflectance must first be gamma corrected (raised to the power of gamma) before doing the ray tracing ? In other words, if I am setting up my materials using any Color Picker app, are the RGB values already in non-linear space? and therefore I first need to convert it to linear space before feeding it to ray tracing?
ali
CC BY-SA 4.0
2020-05-01T02:31:03.460Z
2020-05-01T02:31:03.460Z
Nicol Bolas
<p>I have few questions regarding tone-mapping and gamma correction.</p>

<ol>
<li><p>is a tone-mapping operator a function whose output is a value between [0,1] ?
If this isn't the case and since gamma encoding requires a value to be in range [0,1], do I need to normalize the values after tone-mapping?</p></li>
<li><p>imagine a diffuse horizontal surface with (0.5,0.5,0.5) reflectance under an unobstructed uniform sky of radiance (1,1,1) cd/m2. The incident radiance on an image pixel coming off this surface will have value of (0.5,0.5,0.5). Now, most codes I have seen apply gamma encoding(raising pxl value to the power of 0.45) at this stage just before saving it to the file. But on viewing the image, the colors are distorted and much brighter corresponding to (186,186,186) color value. If I don't apply gamma encoding then the image file displays the expected color that is (127,127,127).</p></li>
</ol>

<p>If the CRT monitor or the LCD does apply the inverse of gamma, then by encoding it I must see the original color that is (127,127,127), is that right? 
And if I am seeing (186,186,186) instead, am I right therefore to assume the encoding happens internally on saving the image data as png or jpg format? and therefore I don't need to do any gamma encoding? </p>

<rendering><gamma><tone>
Two questions on Gamma correction and Tonemapping
ali
# Two questions on Gamma correction and Tonemapping

(Asked by: username_0 on 2020-04-30)

I have few questions regarding tone-mapping and gamma correction.

1. is a tone-mapping operator a function whose output is a value between [0,1] ?
   If this isn't the case and since gamma encoding requires a value to be in range [0,1], do I need to normalize the values after tone-mapping?
2. imagine a diffuse horizontal surface with (0.5,0.5,0.5) reflectance under an unobstructed uniform sky of radiance (1,1,1) cd/m2. The incident radiance on an image pixel coming off this surface will have value of (0.5,0.5,0.5). Now, most codes I have seen apply gamma encoding(raising pxl value to the power of 0.45) at this stage just before saving it to the file. But on viewing the image, the colors are distorted and much brighter corresponding to (186,186,186) color value. If I don't apply gamma encoding then the image file displays the expected color that is (127,127,127).

If the CRT monitor or the LCD does apply the inverse of gamma, then by encoding it I must see the original color that is (127,127,127), is that right?
And if I am seeing (186,186,186) instead, am I right therefore to assume the encoding happens internally on saving the image data as png or jpg format? and therefore I don't need to do any gamma encoding?

**Tags:** rendering, gamma, tone


---

## 1 answers

### Answer by username_1 on 2020-05-01. Score: 2

> the colors are distorted and much brighter corresponding to (186,186,186) color value. If I don't apply gamma encoding then the image file displays the expected color that is (127,127,127).

No, the gamma-correct color is not distorted; your *expectations* are. If your lighting, meshes, textures, and other scene elements were not built to be properly linear and gamma correct to the screen, then every decision you have made has been through a distorted lens. If you don't like the effect you're getting with a properly gamma-correct lighting system, that's the fault of all of those decisions you've been making, not with gamma correction.

Half of the full lighting intensity in a linear colorspace does correspond to greater than half in a gamma-correct colorspace. And those gamma-correct values are what you *ought* to be passing to the screen. If that's not what you're shoving into the display, then you're doing lighting wrong.

> **Comments:**
> **username_2**: At this point it would be good to undetstand differences between humanities and sciences. Humanities deal with relative statements and sciences deal with how things work. As art is generally a humanist endeavour an artist might say that it looks good everything is hunky dory. Thats fine. However from a sientist perspective its still wrong because there are so many implied assumptions that are wrong in such a setup. You simply miss on a lot of refinements if you side step this. Everything from antialias and shading routines are slightly off. You can tweak things but would be better if not.  
> **username_0**: @username_1 Thanks. So do you mean that the material reflectance must first be gamma corrected (raised to the power of gamma) before doing the ray tracing ? In other words, if I am setting up my materials using any Color Picker app, are the RGB values already in non-linear space? and therefore I first need to convert it to linear space before feeding it to ray tracing?  

---

