[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - GL Gamma Correction

GL Gamma Correction

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Re: GL Gamma Correction

Postby Spike » Tue May 07, 2013 12:00 am

gl_brightness and gl_contrast are supposed to exist in fte, but whether they're identical to the gamma+contrast cvars is a different matter. If it ain't exact, it ain't gamma. :s
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: GL Gamma Correction

Postby Baker » Tue May 07, 2013 12:59 am

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: GL Gamma Correction

Postby revelator » Tue May 07, 2013 9:26 am

Indeed what it does is a bit like doing overbright but it emulates gamma amazingly well though ;)
Also easy to use as it uses the v_gamma cvar directly.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: GL Gamma Correction

Postby jitspoe » Wed May 08, 2013 3:42 pm


jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: GL Gamma Correction

Postby Spike » Wed May 08, 2013 7:06 pm

GL_RGB_SCALE does scale the output, yes (overbrights etc). Activate it when drawing everything else and you can double the contrast of the screen, but you have to be really careful with blend modes.
contrast is easy to implement - just double the colour values.
brightness is also easy - just add to the colour values.
actual gamma requires exponents, however. luckily, it should be possible to just multiply the values enough times. the down side is that doing that will loose precision. a lot of precision.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: GL Gamma Correction

Postby Barnes » Wed May 08, 2013 7:33 pm

User avatar
Barnes
 
Posts: 232
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow

Re: GL Gamma Correction

Postby revelator » Thu May 09, 2013 12:34 am

Aye its not true gamma :) but if someone can use it for whatever its easy to implement call the function from the same place as the old gamma and give it a cvar as argument for the bright factor.
Small note it uses negative values so if you want to use it with the standard quake menu you have to invert the menu scales. Maybe nice for a scalable overbright setting hmm :) ?.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: GL Gamma Correction

Postby Baker » Thu May 09, 2013 6:00 am

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: GL Gamma Correction

Postby Baker » Thu May 09, 2013 8:03 am

Sat on fence then went with this.

Reasons:
1. Loss of 4 fps 223 fps to 219 fps on my $300 windows laptop (this $300 laptop is incredible ... it's terrific and I'm picky)
2. No need for gamma and contrast. Just brightness. Winner.
3. No more platform specific hardware gamma code.
4. Screenshots don't need gamma correction applied (not that I did that). Neither does video capture.
5. Affects only the Window itself.

Drawbacks:
1. Slightly narrower capabilities of brightening the screen. Hardware gamma has more brightening power.
2. Slight loss of FPS and fps matters (within reason). But 1%-2% loss is nothing.

I had rewritten all the Windows hardware gamma code really nice and orderly. And now I'm throwing it away. A bit ironic, but I'll take this total solution over hardware gamma every day.

Since "gamma" is a standard Quake cvar (some mods even use it for brightness effects like flash grenades ... although they shouldn't have used the cvar) I internally call it scr_brightness but keeps same external cvar name.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: GL Gamma Correction

Postby revelator » Thu May 09, 2013 12:39 pm

Happy that it found a use :) fps hit is as you say minimal and it Works rather well so i thought someone might find it interresting even though its not real gamma ;).
Heh funny i use the same cvar name small World indeed.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: GL Gamma Correction

Postby jitspoe » Fri May 10, 2013 1:34 am

In a lot of cases, we don't actually want gamma - we just want things brighter, so it's ideal for that. If things are simply too dark, using gamma to brighten them can result in washed-out visuals (loss of contrast and saturation). If you want brightness in the standard case, you can use this when combining the lightmap and textures to avoid the 4fps hit, though it would require modifying a lot more code.

jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: GL Gamma Correction

Postby Baker » Sun May 12, 2013 5:46 am

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: GL Gamma Correction

Postby Barnes » Sun May 12, 2013 9:58 am

Kill'em, kill'em!!!!
Seriously I have already killed the hardware gamma ramps. A terrible thing has been :D
User avatar
Barnes
 
Posts: 232
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow

Re: GL Gamma Correction

Postby revelator » Sun May 12, 2013 4:21 pm

Definatly worth it sifting through mh's older OpenGL engine sources, lots of non standard but amazingly well working ideas :) His Q2 sources are also worth having a look at, many nice ideas in them.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: GL Gamma Correction

Postby revelator » Sun May 12, 2013 11:03 pm

Btw try replacing tenebraes old gamma code with the code posted :) i think your going to like it.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

PreviousNext

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests