Download

Gamma Correction/Calibration in UE4

I’m creating this thread since I’m a little confused on UE4’s Gamma Correction. I’ve seen it mentioned on the forums, but there doesn’t seem to be any documentation on it. Does UE4 even have built in Gamma Correction/Calibration? The reason why I am asking is because I would like to have a Gamma Calibration Slider in my game. You know how games have a picture with a symbol in it, and they ask you to adjust the slider until you can barely see the symbol. Due to aesthetics and gameplay, it is important that what I see on my monitor is the same thing or as close to identical as possible to what the player will see. I assume UE4 doesn’t have anything like this built in, but I am curious since I’ve seen Gamma Correction mentioned a few times on the forums. If UE4 does have some kind of Gamma Correction built in, do I even need to create this Gamma Calibration tool or will UE4 do it automatically?

Through the use of a Post Process Material, I’ve kind of already created a Gamma Calibration tool. You can see the picture below for an example of what that looks like in game and what the material looks like.

gammacorrection.jpg

I just want to gain some insight on UE4’s Gamma Correction capabilities, to see if the way I am implementing it is good, and if there is a better way of doing it. If the way I am doing it is good/the best, how would I go about adding in the calibration tool. I know how to do the slider with the HUD, but a texture/material being drawn on the HUD isn’t going to be affected by the in game lighting/post process effects (so the symbol wouldn’t change). So any recommendations on how I could have the player see a symbol that is affected by the Gamma Correction (like so many other games do) would be greatly appreciated.

You can visit these two links to gain a better understanding of how I currently have the gamma correction setup.
Change Global Gamma
How to edit Post Process Material

First off all the engine already does gamma correction internally. However as far as I know this is set to sRGB (~2.2) in code and is not exposed. If you want the best performance you could edit the code to expose this value to prevent doing the correction twice. However, doing this in a post-process material will probably not cost you too much, so for simplicity this is also a valid solution.

You can do the preview of the correction on a HUD element in many ways, here are some ideas:

  • Use a material in the widget and do the same manual correction there.
  • Place the images in the world, if you have an entry.umap style empty map for your main menu, you could simply place them in the world instead of using actual HUD elements to have the same correction as your game.
  • If you choose to adjust the internal gamma correction you can also tweak the internal gamma handling of HUD elements.