Home Unreal Engine

Gamma... Linear.. WTF?! RAGE

vertex
Offline / Send Message
Pinned
Dorian_Harker vertex
So I shipped a game, worked with textures, shaders, game engines, now I'm on this low-key animation movie job. 

And POST people keep bragging about this gamma 2.2 thing. Been in the industry for some time now, never heard of it. Okay, I get it, some technical mumbo-jumbo, I read 20 articles on gamma, it's on a disk like this, it displays on a monitor like this...

THIS IS ALL BULLSHIT. Give me a real answer, anyone? I'm dying here!

I create the texture in photoshop. No gamma correction, no nothing. I insert it in UE4, it looks exactly the same as in photoshop. Never got a problem in my life. Other engines, same thing. I want it to look like this, I paint it like this. Simple!

I do the same with houdini, render it, and the texture is all messed up. So the post guys tell me, you have to change the way your whole department creates textures. The thing is, textures have to look different from what you would expect them to look normally. It's like you can't trust your eyes. How can an artist work without his eyes, I mean come on, what the idiotic technical ass is this anyway? How do I explain to my team of 7, "guys, you worked for years in a certain way... now you have to gamma-correct your textures, so they look like a complete pile of shit, but it will look correct on the final render, so..." 
I've been told, texture guys need to take their texture, apply brightness/contrast, or levels with this 0.45 thing, on a separate "gamma layer", after that, they need to change the texture so it looks normal again, turn the "gamma layer" off, and save. So the final, "gamma-correct" texture looks like it's covered with grey 20% opacity layer.
It doesn't look too good on the render, too, because with levels and contrast and all that, you end up losing color information and quality. 
So the only solution is to have this "gamma layer" from the beginning of the texture creation, from the blank file stage. 

Is this a thing? Because I've been living on this earth for a couple years, saw portfolios of a few artists, and some have textures in their portfolios. And these textures look normal to me. Not bright, not dark. Normal. I might have been isolated in the gaming industry, where gamma is... done by the shader automatically without the need to correct textures? Houdini's shader also does everything automatically, but whatever you insert in it, looks incorrect. Same texture in UE4 - correct.
Why is it different in the movie industry? How come this isn't just fixed in 1999 to begin with? This whole gamma business sounds absolutely stupid to me, so as you can see, I'm quite angry and frustrated. Makes me want to go 100% analog.

Movies aside, do I have to worry about this in UE4 and games? I plan to use Unreal till the day I die, so it's important.
I saw Naughty Dog employee's incomprehensible article about gamma, so looks like it is a thing in the gaming world, too. And then I saw Naughty Dog employee's textures, which look 100% normal to me. 
I find that hard to believe that 100% of the CG artists use gamma correction. Never saw it not in a single asset creation tutorial. Never heard of it. Yet it's still real.
Please, give me some answers. I suspect that render and post guys are doing something incorrectly, but the science I've read so far confirms what they'are saying. But the texture correction workflow can't be what I've described above, texture correction workflow should never even exist.. =(

Replies

  • leleuxart
    Options
    Offline / Send Message
    leleuxart polycounter lvl 10
    As far as UE4 goes, and the other programs that game artists generally use, you shouldn't have to worry about working in any particular color space. Stick to your current one, which should be sRGB. Let the renderer do the conversions for you. 

    One issue you'll come across with UE4 and color spaces is the fact that UE4(and most renderers afaik) will convert all textures that are considered sRGB to Linear during the rendering process. It does so by applying a gamma of 0.4545, but before we see the final frame, the scene has a gamma of 2.2 again to match our sRGB monitors.

    Let's say you create a texture that you don't want the editor to convert, such as a Roughness map. During the rendering process, that map is converted to Linear which typically darkens the map, so your materials appear more reflective than you intended. You can bypass that conversion to Linear on a per-map basis by unchecking sRGB in the individual texture window. By doing so, you're telling the editor to treat the map as if it already has the 0.4545 applied and it can be used as provided.


    (excuse the yellow numbers, this was created for a breakdown at work)


    The general rule of thumb for UE4 is if it's visible, it's sRGB. If it's used for calculations, its Linear
    sRGB = Base Color
    Linear = Roughness, Metalness, AO, Height, etc
  • Ravenok
    Options
    Offline / Send Message
    Ravenok polycounter lvl 7
    It's just a math thing, a physics thing.
    I'm not an expert on exactly how it all works but I'll try to explain as far as I know. If I'm mistaken on any point I'd be happy to get it clarified myself :)

    Gamma in short is a way to take mathematical information that represents luminance in a physical environment, and adjust it so it LOOKS like what a human would see, instead of what a computer would see.
    Think about it like this: adding a gamma operation on a linear image is the equivalent of adding a human observer to a physical universe.

    Think about values as physical properties for a second. A value of 0 means complete darkness, no light whatsoever. A value of 1 means perfectly white light, in terms of intensity. Now let's go to 0.2 - that's 20% of 1, so logically, LINEARLY, you would use a 20% gray to represent that, right?
    Well, mathematically yes, but after you take into account the way our brains work, the way our eyes adjust to light - that 20% brightness (which is still 20% mathematically) is perceived to be less, by humans.

    When as an artist you are told "this is 20% gray" - what you think of is PERCEIVED 20% gray. In actual physics terms, that 20% is probably less than 20% in terms of intensity relative to absolute white, because the way we perceive light is not linear.

    To create realistic results, a game engine/graphics renderer must simulate this effect. Because what we see on the screen is just colored pixels in a very narrow luminance range, we can't just shoot out a linear image and expect people's brains to do the rest for us - we must adjust it to look exactly like it would if a human looked out their window.

    So we calculate everything linearly. 50% is 50% in terms of intensity and in terms of presented color. We keep that "linear workflow" throughout the production. And then, in the end, just before we show it to anybody, we do 1 gamma correction on everything to transform it to something humans are used to seeing.

    That happens automatically in many cases. In photoshop for example, you work straight into a corrected document, so when you pick 50% gray you actually pick something else linearly, but you view it in sRGB space (gamma corrected), so it's fine.

    I never heard of this workflow you mentioned, of applying a gamma correction layer above everything and working with linear color below. I don't even know if that would benefit quality in any way. I know that textures get converted to a non-corrected format before they're rendered, and then the renderer does the correction again. So you work in normal sRGB space and then, as you said, you add a .454 gamma correction node on your image and send it to your tech department. They can use that and then put a 2.2 correction on everything.

    In unreal, if you open a texture's settings you'll see a checkbox for sRGB correction. If it's checked, it means the image is in sRGB space. If it's not, it means it's a linear image. Any color texture you want to use in Unreal should have this checked on. Any roughness/height or data type texture should have this checked off. As far as I know, that's all Unreal requires you to do.

    As for the workflow in your project, I think you should work normally, but before exporting, use a gamma layer to adjust your texture to .454 gamma. In truth, the tech department should be able to do that in-engine per asset, you shouldn't modify a texture like that, but I have no idea what their consideration are and why they asked for that.
Sign In or Register to comment.