# LinearEncoding vs sRGBEncoding

**URL:** <https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243>\
**Category:** Questions\
**Tags:** encoding, webgl-renderer, textures\
**Created:** [February 8, 2021, 12:56pm UTC](https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243 "2021-02-08T12:56:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfreifeld](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/tfreifeld/32/15980_2.png) [@tfreifeld](https://discourse.threejs.org/u/tfreifeld)\
**Post date:** [February 8, 2021, 12:56pm UTC](https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243/1 "2021-02-08T12:56:46Z")

</div>

I’ve been researching the whole Linear/Gamma color spaces for some time, and I’m still struggling with a few issues.

I (mostly?) understand the concept of Gamma Correction and how our eyes don’t perceive light linearly and all that.

Please correct me if I’m wrong anywhere:

If I’m getting a textured 3D model created with 3Ds Max - which I understand creates textures in sRGB color space - and the `FBXLoader` gives its textures an sRGB Encoding, then I need my `WebGLRenderer` to have an `outputEncoding` of sRGB as well in order for the model to look as it should, right? This is called a Gamma Workflow?

But If I’m commenting out the lines in `FBXLoader` which give the textures an sRGB encoding, and keeps both them and the renderer with a linear encoding, I get correct colors as well. Is this what’s called a Linear Workflow?

If in both cases the results are the same, then why one should be preferred over the other? What are the pros and cons?

I read that usually the renderer’s outputEncoding should be sRGB (unless post-processing is involved), but I see the default in THREE is LinearEncoding. Why is that?

Hopefully I was clear enough and someone can help me make sense with all this.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 8, 2021, 2:03pm UTC](https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243/2 "2021-02-08T14:03:05Z")

</div>

> [@tfreifeld](#):
>
> If I’m getting a textured 3D model created with 3Ds Max - which I understand creates textures in sRGB color space - and the `FBXLoader` gives its textures an sRGB Encoding, then I need my `WebGLRenderer` to have an `outputEncoding` of sRGB as well in order for the model to look as it should, right? This is called a Gamma Workflow?

It is called a sRGB workflow. Keep in mind that simple gamma correction and sRGB are two different things.

> [@tfreifeld](#):
>
> But If I’m commenting out the lines in `FBXLoader` which give the textures an sRGB encoding, and keeps both them and the renderer with a linear encoding, I get correct colors as well. Is this what’s called a Linear Workflow?

Yes, although this approach is not correct from a strict technical point of view since your texture actually contains sRGB encoded data.

> [@tfreifeld](#):
>
> If in both cases the results are the same, then why one should be preferred over the other?

For many simple scenes the flaws of ignoring color spaces are not obvious. However, it is of course more correct to use a proper color conversion workflow. Simply because lighting equations, post-processing or many other shader code assume color values in linear space. If devs pay no attention to color space, things can quickly break.

> [@tfreifeld](#):
>
> I read that usually the renderer’s outputEncoding should be sRGB (unless post-processing is involved), but I see the default in THREE is LinearEncoding. Why is that?

It was considered once but not implemented because it would break existing applications which rely on the current default value.

---

<div class="post-metadata">

**Author:** ![tfreifeld](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/tfreifeld/32/15980_2.png) [@tfreifeld](https://discourse.threejs.org/u/tfreifeld)\
**Post date:** [February 8, 2021, 2:10pm UTC](https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243/3 "2021-02-08T14:10:18Z")

</div>

Thanks for the answer!

So, to be clear, when I use textured models - which as I understand are usually encoded in sRGB in the software they were created - I should use sRGB workflow?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 8, 2021, 2:20pm UTC](https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243/4 "2021-02-08T14:20:38Z")

</div>

Yes, that’s correct.

---

<div class="post-metadata">

**Author:** ![narfBox](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/narfbox/32/6634_2.png) [@narfBox](https://discourse.threejs.org/u/narfBox)\
**Post date:** [December 10, 2021, 3:10am UTC](https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243/5 "2021-12-10T03:10:43Z")

</div>

> [@Mugen87](#):
>
> It was considered once but not implemented because it would break existing applications which rely on the current default value.

Since when has that stopped THREE before?! Its pretty much a given things will break each version for a good reason mind you. It would be better to setup proper defaults i say.

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [December 10, 2021, 4:00am UTC](https://discourse.threejs.org/t/linearencoding-vs-srgbencoding/23243/6 "2021-12-10T04:00:18Z")

</div>

I think it is probably a question of “when”, not “if”. There are some remaining questions (see [Add THREE.ColorManagement by donmccurdy · Pull Request #22346 · mrdoob/three.js · GitHub](https://github.com/mrdoob/three.js/pull/22346)) I’d hope to have answered before the defaults would be changed.
