rule of thumb regaring sRGB vs linear colors

heey there…
I was wondering…

what is general speaking a good rule of thumb to keep in mind when creating diffuse / albedo textures.

When I try to create a more dark stone / cliff, the texture is getting more brighten because of the sRGB option. When I turn off that switch, the texture in preview texture window looks correct.
But not in the final material. The texture still apears as if sRGB has been turned on.

I am also checking the base color in buffer vis to have a more clear idea about the real only correct colors.

But al this is confusing to me. What is the matter with sRGB anyway? How can I make sure I am getting exact the same colors as seen saved in a plain PSD / TGA texture?
Regards! T

sRGB should be checked for Diffuse/Albedo and unchecked for Roughness/Metallic/Normal/Specular maps.

Basically when you import a texture it’d end up looking exactly the same when you look at it with Unlit view mode. Can you post a comparison so we can see better?

sRGB is used for maximizing quality of a limited 8-bit image. It lifts the color values of the more important dark parts of the image before it gets saved. Because our eyes is more sensitive to differences in darker colors than brighter, the darker parts gets more room in the small 0-255 value space. When you open a sRGB file the values gets lowered again to look like they did before you saved the file.
The Roughness/Metallic/Normal/Specular is more for mathematical use inside the engine and not to be used to looked at directly like a Diffuse map. And you want to save evenly distributed values (linear) without the gamma shifting sRGB does. In linear the brighter values are as important as the dark ones. :slight_smile:

<- it is basically toggling sRGB for diffuse textures doesn’t change anything in the viewport, only in the texture editor. It just looks like the texture in the viewport always is sRGB enabled. (which is confusing, because I just uncheck sRGB for diffuse in the texture preview window)

ok, the whole sRGB thing makes sense now…but now I am wondering, and maybe this is not the correct place to ask but the following:
when I create textures in Substance Designer, all textures kinda looks exact the way I expect them to be. I expect when i turn off sRGB in SD the texture should appear darker but they don’t… they look lighter instead.
Back to unreal…when I create a dark stone in SD (with sRGB enabled), import that one in UE and toggle sRGB on and off I can see clearly difference in the texture preview window. Without sRGB (!) in the texture preview window the image looks the same as in SD while in SD sRGB has been turned on whole the time…?!?

UE4 sRGB off = SD sRGB on = ?!?

Shouldn’t both images not look the same, because sRGB has been on in both engines?!
Regards! T

edit: just tested a quick workflow…when I put a ‘convert to linear’ node for the base color in SD, the image becomes darker. When I import that image in UE4 and leave sRGB enabled it looks exact the way I want it to be. Still…love to hear some thoughts on above.

From what I recall if you’re working in a PBR workflow in SD the maps that get output are already in linear space, even if your intermediate images are in sRGB.

So when you bring them in to Unreal leave sRGB off.

However, if you have a convert to linear node in substance you’re performing the sRGB to linear conversion first, then again when the map is output, so turning on sRGB in Unreal just undoes the second gamma correction and gets the final texture back to linear space.

Partially yes, but there’s a little more to it than that. From my understanding, Substance Painter/Designer their rendering system for PBR is slightly different in how it calculates the lighting samples than UE4 is, so it usually doesn’t end up being a perfect transition from SD/SP to UE4. However, there’s a guy who made a UE4 specific shader for Painter, I haven’t tried to use it with SD yet, though. However, I’ve gotten much better end results using it.

Here’s the link to his shader:

Vailias’ response makes sense.

You should definitely see a change in the viewport when toggling srgb on/off for a texture but you may have to recompile the material to see it. The same thing happens when you change to NearestNeighbor filtering. It wasn’t always like that. When I just tested it I did not have to recompile; it updated instantly but it could have changed due to engine version.

If you are ever in doubt, I would recommend using the “Debug Scalar Values” function and import a 50% grey texture. That means fill with 127 in photoshop. With srgb gamma, that 0.5 value will be remapped to ~0.21 (which is close to 0.5 ^ 2.2 which is the legacy srgb curve). But if you set sgrb to false, the texture will read exactly 0.5 again.

hi guys…
thnx all for the input and detailed info! It makes sense now. I tried out the grey texture trick with the debug scalar node. It indeed shows the expected values. This helps me to have a clear understanding of what is going on and how to create my textures. I am on UE 4.11.2 btw, on my mac it worked.
I noticed however that non sRGB texture requires me to change the texture sampler in the material editor to linear color instead of color. Otherwise it gives me an error.
Anyways, I can figure it out now how to setup the proper settings.
Regards! T

I don’t know if its still an issue, but at one time my PNG 16 bit textures looked pale and bleached out. The only work-around I found was to convert the 16 bit PNG to 8 bit. Then it works fine in my Unreal scene.