How to disable Gamma Correction??

Yes, hello. I was wondering how to disable gamma correction and if this is at all possible? Someone suggested that I “disable sRGB everywhere in the pipeline.”](https://forums.unrealengine.com/development-discussion/rendering/1537220-how-to-achieve-a-late-1980s-early-90s-cgi-film-look)for my game project since it’s supposed to be based off of late 1980s - early 1990s CGI.

I downloaded a copy of Autodesk 3D Studio for DOS from 1990-1993( for reference) to see what renders of that era looked like. I tried version 3 (1993) first and then version 2 (1992) second.

I noticed that the versions 1 and 2 renders looked very different than version 3’s. I discovered that this was due to gamma correction being on by default in version 3 which gives the renders a very different quality (a more modern quality, which I’m trying to avoid). I turned off the gamma correction in version 3 and it’s renders then looked exactly like version 1 and 2’s renders (older looking , which is a good thing in my case).

So- how can I turn off or at least reduce the amount of gamma correction in Unreal?

You probably don’t want to turn it off, unless you re-do all of your lighting/emissives to be <= 1.0. Otherwise, a simple Linear to sRGB gamma correction should suffice, which you can do in a Post-Process Material set to “Replace Tonemapper.” This will remove all bloom, exposure, and color grading controls… but this might be okay for your purposes.

I would still like to know how, just to see what happens.

Okay, thanks. How would I do this?

…bump…

Make a new Post-Process Material, set it to “Replace Tonemapping”, and then place a SceneTexture node with Post-Process Input 0 as the type. Connecting this directly to Emissive should give you the scene-referred linear image, which may be usable for you if your values don’t go beyond 0 - 1. Otherwise, a super simple gamma correction of a 2.2 power of the Post-Process Input should suffice, but there is a more accurate method of lin2sRGB that retains the linear toe near black if you need it.

2 Likes

Thanks again! I just have to ask, does this do anything different than/beyond just removing the tonemapper (ShowFlag.ToneMapper 0) and disabling all of the post process effects in project settings? And about removing the gamma correction completely (if this becomes necessary); will it involve modifying the source code? (if so how?)

I don’t remember exactly what it disables, but a lot of the effects are done during the same pass as the tonemapper so color grading and exposure are for sure disabled when you replace it through the Post-Process Volume. Exposure and Scene Color Tint is a simple multiplication so you could add them back in the material if need be. This wouldn’t require any code changes, although you could update the TonemappingCommon shader to make it a native feature if the editor doesn’t support it already. You might want to search in the console variables if you haven’t yet and make sure there isn’t any other options for tonemapping

There’s actually a console command just called “gamma” (which doesn’t show up as an autocomplete). Try “gamma 1” but note that this affects the editor UI as well as the viewport.

2 Likes

How would I make a post process material with exposure or scene color? When I disabled the gamma with a post process material like said (which worked great, thanks!) the scene far looks too dark. I tried increasing the skylight to remedy this, but then everything looks overexposed.

Well since you’re making a game based on the 90’s visual style, lighting wasn’t done in a scene-referred linear space so if you keep the scene within 0 - 1, with lights going over where necessary, you should get a similar style with the tonemapping off. To add exposure back in, you would multiply the scene color by a desired value. You probably need to keep the simple gamma correction just to prevent things from being completely crushed.

There are some misunderstandings here. First, what @anonymous_user_6a619fcd is calling “gamma correction” and wants to disable is usually called “linear rendering”. It means all color operations (including lighting) are done in linear color space. The sRGB flag in textures tells the GPU the texture contains data in sRGB color space, so the data needs to be converted to linear before being used.

Converting from sRGB to linear and vice-versa is done using a “gamma curve”. Converting from linear to sRGB “brightens” the image and from sRGB to linear “darkens” it. Monitor displays are made to expect sRGB inputs, so the linear framebuffer must be “corrected” into sRGB before being displayed. This is what the tonemapper does.

If you disable the tonemapper by a simple pass-through post-process material, what you get is the raw linear framebuffer (which looks darker).

Before linear rendering came to be, renderers did all the operations using sRGB color values. CG adopted linear rendering in the early 90’s, but video games kept using “gamma-space” rendering all the way until the PS3/X360 generation, when consumer GPUs became capable of linear rendering. This is why it was so hard to get realistic looking lighting and textures in PS2-era games and earlier: blending sRGB values together would often result in over/under exposed colors.

You cannot disable linear rendering in UE4 without hacking all over the place, but I think you can trick it into using sRGB values as if they were linear all the way. If you apply a linear->sRGB conversion curve into all your color values before feeding then into UE4’s materials, and use a pass-through tonemapper, you should get what you want. You have to ensure your albedo textures contain sRGB values but disable the sRGB flag so UE4 won’t convert them, then in all your color pickers (lights, materials, etc) you copy the hex values from the “sRGB” box into the “linear” box.

That’s exactly what happens when you don’t use linear-space rendering. Welcome to the 90s!

2 Likes

Like I said, before, I downloaded the 3D Studio for DOS and am test rendering my scenes in it before bringing all the textures/geometry in Unreal. And the scenes in 3D studio definitely aren’t that overexposed.

Sorry, I’m having technical difficulties at the moment, but I will post pictures of the scenes from 3D Studio and Unreal when I get the chance (probably in a few days). It should be easier for to understand what exactly is wrong