Gamma changes in full screen mode

Started by rongel, Wed 24/08/2016 11:55:22

Previous topic - Next topic

rongel

Hi!

I'm suffering from gamma issues: when I test my game in fullscreen mode and I load/restart the game, gamma changes to more bright. This does not happen in windowed mode.

I have read previous posts about this issue, but didn't find a clear answer how to fix it. Apparently it has something to do with graphics card? And every game suffers from it???

I'm using AGS 3.3.4. and building a 320 x 200 resolution game with Direct3D. When using DirectDraw this problem seems to go away, but I need Direct3D.

I would really like to fix this, because basically it messes up the graphics of the game. One idea I read from old post was to make the game do a save when you start a new game, and instantly load it again. This way you would never use the "correct" starting gamma, but instead the lighter one. Then you would only use one gamma in the game. Is this the only way to fix this?

Any help & advice is more than welcome!   
Dreams in the Witch House on Steam & GOG

Crimson Wizard

#1
Is there a code in game script that changes gamma and if yes, could you post it here?
(The command that does that is "System.Gamma")

You mentioned reading an old post, could you post a link for the reference?

rongel

Here is the link for the post I mentioned:

http://www.adventuregamestudio.co.uk/forums/index.php?topic=42271.0

Not sure if it's a gamma or display card related problem, but I have the same symptoms as uswin in his post. Basically I have no code that deals with gamma adjustments. Starting in fullscreen everything is fine, but after restart/load, it seems that contrast goes lower, and brightness increases. If I use code

Code: ags
  System.Gamma = 99;


in the game_start, I can see the lower contrast image from the start, and it stays the same after restarting. So the contrast/gamma settings now stay the same but there is still the same loss in contrast. I can change the gamma, but it seems that somekind of color correction is disabled then also.

I hope that my explanation is somewhat understandable!
Dreams in the Witch House on Steam & GOG

Matti

Quote from: rongel on Wed 24/08/2016 11:55:22
when I test my game in fullscreen mode and I load/restart the game, gamma changes to more bright. This does not happen in windowed mode.     

I had the exact same problem on my last laptop (a fujitsu siemens) and it was quite annoying. It had nothing to do with the code, but only happened with AGS games. Unfortunately I couldn't fix the problem as far as I remember. Doesn't happen with the laptop I'm currently using though.

Crimson Wizard

This would require investigation on why is it loading savegame that instigates this problem. The Gilbert's opinion in the old thread is very interesting and may point to right direction.

I'll be back after I check some things first.

rongel

I'm currently using a desktop computer, with a AMD Radeon R9 280x display driver, if it's any help. Saw this same thing happening when testing other peoples AGS games too, when I loaded a save, the screen changed a bit brighter compared to the starting situation.
Dreams in the Witch House on Steam & GOG

Crimson Wizard

#6
rongel, I made this quick hack to the engine that should prevent applying gamma value if it did not change after load.
You can put this file into AGS Editor program folder (make sure you have a backup of an old exe) and recompile your game to test it out.
http://www.mediafire.com/download/ag6yy14vztrwoy1/acwin-3.3.4--gamma-hack.zip
Engine should be compatible to AGS 3.3.4 (you said it is the version you are using).


There are two things to add:
1) This does not solve the problem that gamma setting in AGS mismatches one in the graphics driver, or card. I think there should be a way for a player to configure gamma "offset", or prevent game from changing gamma value.
2) I believe that gamma setting should not be in savegames at all. It's a system setting, not part of the game, similar to display resolution.

rongel

Quick answer for now, but I did some tests with that and it seemed to work, thanks Crimson Wizard!

Gamma/Contrast or what ever it is, stayed the same even after loading a new game. I'll test it more later, but it seems to be working.

Only downside is that I already use the mouse speed fix in acwin.exe (that you made!). So I would need a file that has both of the fixes.
Dreams in the Witch House on Steam & GOG

Crimson Wizard

Quote from: rongel on Wed 24/08/2016 18:16:59
Only downside is that I already use the mouse speed fix in acwin.exe (that you made!). So I would need a file that has both of the fixes.
Hmm, maybe you could upgrade to AGS 3.3.5 then? 3.3.5 supports mouse speed fix officially, and I could add the gamma fix too and release a new official patch, instead of this custom engine.

Frankly I would not want to create more custom engines by gathering different features together.

rongel

That sounds like a good idea, haven't really checked the new versions, I just hope everything is compatible.

Thanks for all the help, I'll wait for the 3.3.5. patch!
Dreams in the Witch House on Steam & GOG

Crimson Wizard

rongel and Matti, I found something very interesting in the Direct3D renderer code of AGS that could be a proper solution for your gamma problems. Basically, there seem to be a mode that passes gamma values through colors "calibrator" if one is set up for the system (https://msdn.microsoft.com/en-us/library/windows/desktop/bb174434(v=vs.85).aspx)

Here is a build based on 3.3.5, which has a certain fix to how Direct3D driver sets new gamma. I would like to ask you to make a small test by scripting gamma changes (for example, with a GUI slider) and check if it works better for you:
http://www.mediafire.com/download/m4whp86lpc7j3mw/acwin-3.3.5--gamma-fix.zip

Actually, everyone else is invited to make a test too, because I do not want to screw things up for other people.

rongel

Thanks, I will try this soon, haven't yet updated to 3.3.5!
Dreams in the Witch House on Steam & GOG

Matti

I can't test this before monday. But keep in mind that I only had the problem on my old laptop (which is broken) and I haven't used any gamma calibration yet. Also, I'm currently using 3.4.0.6.

Crimson Wizard

#13
Oh, I will make corresponding test builds for 3.3.4 and 3.4.0 then, that should be easy. I will add download links to this post soon.

UPD:
3.4.0 test: http://www.mediafire.com/download/id4v2k5mv59ot71/acwin-3.4.0--gamma-fix.zip
3.3.4 test: http://www.mediafire.com/download/cldrblljhd95w7n/acwin-3.3.4--gamma-fix.zip

rongel

I did few quick tests, but it seems that when using this new patch, the gamma changes when I restart the game (pressing F9 key). So the original problem is back again. When using the earlier gamma hack, everything seems to work fine. I can make more tests in the weekend, these are the quick results!
Dreams in the Witch House on Steam & GOG

Crimson Wizard

#15
Quote from: rongel on Thu 08/09/2016 19:25:55
I did few quick tests, but it seems that when using this new patch, the gamma changes when I restart the game (pressing F9 key). So the original problem is back again. When using the earlier gamma hack, everything seems to work fine. I can make more tests in the weekend, these are the quick results!
Okay, I see, this means that this in not a working solution then.
I will just stick to the earlier fix for now, although it is not universal.

SMF spam blocked by CleanTalk