Black Screen with Gamma Correction

Expanding and utilizing the engine via C++.
  • 1
  • 2
16 posts Page 1 of 2
greenfire27
Posts: 47
Joined: Tue Nov 03, 2015 8:18 pm
 
by greenfire27 » Mon Oct 14, 2019 3:31 am
Hi,

This is something that is popping up in Torque 2D but it might be the same in 3D as well. It seems that in windows 10 version 1903, if there's not two monitors extending the view, then setting the gamma with setDeviceGammaRamp causes the screen to go entirely black with no way of fixing it. If anyone can shed some light on this problem I would greatly appreciate it. Also, you should check to see if it is happening in T3D.
greenfire27
Posts: 47
Joined: Tue Nov 03, 2015 8:18 pm
 
by greenfire27 » Mon Oct 14, 2019 3:58 am
It seems when there are two monitors set to extend the view then getDeviceGammaRamp returns false which causes the setDeviceGammaRamp to never be called.

Is this Gamma ramp code just so old it doesn't work? Would I be better off removing it entirely?
XIXWYRMEXIX
Posts: 61
Joined: Sat Mar 07, 2015 3:13 pm
by XIXWYRMEXIX » Mon Oct 14, 2019 10:45 am
Hey Greenfire27, I have not seen behavior like this in Torque 3d personally. I am on Win10 1903, AMD Ryzen CPU 2nd gen, and an amd 580 video card. This is through both 3.10.1 and the newest test versions of 4.0.

I also have not seen it in Torque 2d using the same hardware (I love T2D so I play with it at times, I think it is one of the coolest unknow 2D platforms out there). However I never played with the gamma values either. I will try to test on this tomorrow or the day after. Will give feedback then. It could be hardware differences as well (perhaps T2D does not like your hardware in this instance). Replicating the problem on different hardware might show if this is a common problem across all hardware, or just a problem with certain hardware setups.

Until you know if this is a universal problem or just a problem with certain setups I would wait and see before blowing out code. That's just my opinion, I wouldn't take something out until I knew it was an issue across the board. On the flip side the code is "older" and I use T2D, I have never used the gammaramp options. I have never needed to use anything like that for any of my experiments.

As I said I will try to replicate on my hardware in the next couple days. Thanks for your work on T2D, awesome little 2D engine, I love it.
greenfire27
Posts: 47
Joined: Tue Nov 03, 2015 8:18 pm
 
by greenfire27 » Mon Oct 14, 2019 3:08 pm
Thanks for the reply! I already commented out the gamma code from the Master branch, but it's easy to revive if you want to test it. Remember, the bug won't happen if you have two monitors (which most devs seem to have).

I think in most cases the gamma correction code wasn't firing anymore anyway.
marauder2k9
Posts: 317
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Mon Oct 14, 2019 6:11 pm
does this happen on other devices? such as iphones or android devices?

I think the gamma is linked to the screen brightness of mobile devices
XIXWYRMEXIX
Posts: 61
Joined: Sat Mar 07, 2015 3:13 pm
by XIXWYRMEXIX » Tue Oct 15, 2019 2:19 pm
Thanks for the reply! I already commented out the gamma code from the Master branch, but it's easy to revive if you want to test it. Remember, the bug won't happen if you have two monitors (which most devs seem to have).

I think in most cases the gamma correction code wasn't firing anymore anyway.
NP, I don't mind helping out T2D, as I said I love the little engine. Yeah I have quad monitors, so I get it. I would have just disconnected 3. Considering your reply and marauders, I think figuring out if it is connected to other devices is a good idea. If it is screen brightness on mobile devices that should definitely not be turned off.
does this happen on other devices? such as iphones or android devices?

I think the gamma is linked to the screen brightness of mobile devices
This is important to know. Does anyone have a test device? I have an android testbed its an older low end model that did not work out as an actual phone for me, got a better one and kept the low end one for testing. But I have nothing setup to test on it currently.
marauder2k9
Posts: 317
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Tue Oct 15, 2019 6:02 pm
i have emulators i could test it out on, where do i execute the code for the setDeviceGammaRamp?

only script bind i can find that includes gamma is this one
ConsoleFunctionWithDocs(videoSetGammaCorrection, ConsoleVoid, 2, 2, ( gamma ))
{
   F32 g = mClampF(dAtof(argv[1]),0.0,1.0);
   F32 d = -(g - 0.5f);

   if (d != sgGammaCorrection &&
     (sgOriginalGamma != -1.0f || Video::getGammaCorrection(sgOriginalGamma)))
      Video::setGammaCorrection(sgOriginalGamma+d);
    sgGammaCorrection = d;
}
greenfire27
Posts: 47
Joined: Tue Nov 03, 2015 8:18 pm
 
by greenfire27 » Tue Oct 15, 2019 6:13 pm
It happens automatically when the engine is starting up. Go to /platform/platformVideo.cc line 197 and 198. If you get latest in the master branch you'll need to uncomment them. The top line is an if-statement to which checks for gamma correction with getDeviceGammaRamp(). If it returns true (i.e. the device has hardware gamma correction) then it falls through to line 198 where it sets the gamma with setDeviceGammaRamp(). Just put a breakpoint there and see if it falls through the if-statement. My guess is that it almost never falls through and it is always broken when it does, but we'd like to know for sure.
marauder2k9
Posts: 317
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Tue Oct 15, 2019 7:08 pm
Breakpoint is only hit when you call videoSetGammaCorrection and apply a value to it that is different from 0.5

this is called in appcore/1/scripts/canvas.cs on line 37 when it is set to the devices default like this
videoSetGammaCorrection($pref::OpenGL::gammaCorrection);
greenfire27
Posts: 47
Joined: Tue Nov 03, 2015 8:18 pm
 
by greenfire27 » Tue Oct 15, 2019 7:48 pm
And does it cause any problems in Android or iOS? In the latest version of windows it brings the whole machine to it's knees in a hell-storm of utter darkness!
  • 1
  • 2
16 posts Page 1 of 2

Who is online

Users browsing this forum: No registered users and 1 guest