Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Set Gamma problem

Author
Message
Booma
15
Years of Service
User Offline
Joined: 29th Mar 2009
Location:
Posted: 13th Mar 2011 17:23
I have problems with SET GAMMA command
I want to correct gamma in the game. Simply to change brightness and contrast but SET GAMMA can't do this
If you look at the code of SET GAMMA then it becomes clear that this function only reduce brightness



Function forms a linear RAMP. And what about gamma?
I found good link http://en.wikipedia.org/wiki/Gamma_correction
So if we change our function to:



YES! Now it's real gamma imho
But there is one more problem. This function works only (I didn't see videocard wich support gamma in windowed mode) in fullscreen.
The DirectX function SetGammaRamp is useless for us in windowed mode, but what about GDI?
In constructor() we save current ramp and in the destructor() restore system ramp.

I compile an example where you can change gamma in fullscreen or in windowed mode.

And yes I know about contrast shader and about sprite/plane over viewport but these decisions add integrated approach to the project.
It seems to me that I have missed something and there is a simple decision for brightness and contrast change in DBPro. So need your help

Attachments

Login to view attachments
Booma
15
Years of Service
User Offline
Joined: 29th Mar 2009
Location:
Posted: 13th Mar 2011 18:36 Edited at: 13th Mar 2011 22:07
)
Booma
15
Years of Service
User Offline
Joined: 29th Mar 2009
Location:
Posted: 20th Mar 2011 17:55 Edited at: 2nd May 2011 21:57
I haven't found the simple solution. So I simply create plugin with one command BO SET GAMMA Red, Green, Blue.



The main idea of this command is described in the message above and in the message above you can find demos.

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 29th Mar 2011 14:53
Interesting. Could this be used to make HDR images / effects?

I only know a little about the technique but it would be cool to simulate the effect.

Booma
15
Years of Service
User Offline
Joined: 29th Mar 2009
Location:
Posted: 30th Mar 2011 13:36
Hardly. HDR more complex system. When we change gamma ramp we only change brightness and contrast parity and their power. Set Gamma don't change picture pixels color.
P.S.
To use bo set gamma in window mode it is necessary carefully. If occurs TerminateProcess the Destructor won't be executed and plugin can't restore system ramp. http://msdn.microsoft.com/en-us/library/ms686714. It's better to use external loader of your game to set and restore system gamma ramp
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Mar 2011 13:55
Aah, so it's not a shader it actually edits the system settings?

I don't think I'll be using it then. Not quite what I thought it was but then I should have had a proper look at the download!

Login to post a reply

Server time is: 2024-05-03 04:59:56
Your offset time is: 2024-05-03 04:59:56