Jump to content

Black Screen with Gamma Correction


Recommended Posts

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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;
}
Link to post
Share on other sites

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.

Link to post
Share on other sites

it doesnt seem to have any problems on android, ill load up my mac in a moment and see if it effects the ios end, i will say one thing though maybe im not setting the value right but changing the value doesnt seem to change the gamma at all :-S


Changing the value on windows 10 1803 doesnt seem to have any issues either =/

Link to post
Share on other sites

wait a moment. On windows it gets called no matter what value you set it to. Sorry about that. sgGammaCorrection just gets a value of 0.00000 if u set it to 0.5 in script. In android studio i have placed a breakpoint and no matter what it doesnt get called but i think this is because there is already platform specific gammacorrection in place for android at least any way that seems to be set by the device (screen brightness maybe?)

Link to post
Share on other sites

well in the android code it just sets gamma correction to true. Which i think in turn doesnt assign any value to it but just bypasses platformvideo code and allows the device to set the gamma. So that doesnt need changed at all. It might be a problem with windows 10 1903? because it works fine for my windows version. I still havent tried ios but i will soon because ive been uploading a few resources for doing different things in the torque2d forum and im about to upload their ios counterparts

Link to post
Share on other sites
  • 4 weeks later...

encountered this error today! doesnt even need any changed in settings to gamma correction to bring this error up. Something very weird is happening. I recorded my screen with shadowplay and started up torque2d the whole screen goes black all i can see is the mouse and that is it. Pressing ctrl alt del doesnt show up anything. But in the screen recording it shows up as if everything is normal. I cant continue development of my app without the hotfix because stupid microsoft have messed something up as from what i can see alot of other people are having the same problem. Although those other people are able to get into taskmanager from ctrl alt delete but i cannot.


The code commented out in the hotfix was only being accessed by windows before but it was never being set to a usable value no matter what value was set to it in script.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...