logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic OpenGL gamma/brightness correction (Read 1574 times)
GreatEmerald
Oldunreal MasterPoster
*
Offline


The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
OpenGL gamma/brightness correction
Aug 28th, 2014 at 9:16pm
Print Post  
Is there a way to get how much exactly is OpenGL changing the screen gamma/brightness during play? These changes are not reflected in screenshots and videos, and that's rather annoying because things look way too dark. If there is a way to tell how much is changed, then I can manually edit them to match what I see.
  
Back to top
WWW  
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7913
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: OpenGL gamma/brightness correction
Reply #1 - Aug 29th, 2014 at 10:34am
Print Post  
no idea if this is of any use for you (simplified code):


Code (C++)
Select All
SDL_SetGammaRamp( gammaRamp.red, gammaRamp.green, gammaRamp.blue ); 



and:

Code (C++)
Select All
                FLOAT RedGamma = 1.0f / (2.5f * (GammaCorrection+GammaOffsetRed));
		FLOAT GreenGamma = 1.0f / (2.5f * (GammaCorrection+GammaOffsetGreen));
		FLOAT BlueGamma = 1.0f / (2.5f * (GammaCorrection+GammaOffsetBlue));

		for (u = 0; u < 256; u++)
		{
			int iVal;
			int iValRed, iValGreen, iValBlue;

			//Initial value
			iVal = u;

			//Brightness
			iVal += brightness;
			//Clamping
			if (iVal < 0) iVal = 0;
			if (iVal > 255) iVal = 255;

			//Gamma
			iValRed = (int)appRound((float)pow(iVal / 255.0f, rcpRedGamma) * 255.0f);
			iValGreen = (int)appRound((float)pow(iVal / 255.0f, rcpGreenGamma) * 255.0f);
			iValBlue = (int)appRound((float)pow(iVal / 255.0f, rcpBlueGamma) * 255.0f);

			//Save results
			gammaRamp.red[u] = (BYTE)iValRed;
			gammaRamp.green[u] = (BYTE)iValGreen;
			gammaRamp.blue[u] = (BYTE)iValBlue;
		}
 



while Brightness refers to the value in the ini in [SDLDrv.SDLClient], from 0.1 to 1.0
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
GreatEmerald
Oldunreal MasterPoster
*
Offline


The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
Re: OpenGL gamma/brightness correction
Reply #2 - Aug 29th, 2014 at 5:31pm
Print Post  
Huh, that's 0.5 by default, so it just adds +0.5 to each colour component? That's not a whole lot... And also looks like it doesn't translate to YUV (which is what videos are using) well at all, because Y reacts to G much more than to B :\ Oh well, it looks like having it approximated through YouTube enhancements is probably the best way to go anyway.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo