vibranceGUI
vibranceGUI copied to clipboard
is there a possibility you can add more than just vibrance as an option?
Most Nvidia cards also have brightness and gamma, wondering if you can add those settings as an option.
This will take some time to implement as the NVAPI is not a nice thing to work with ;-). I might get to it within the next two weeks. No promises though
Thanks
I've looked into this and it seems that you need a specific nda version of the NVAPI for this. I've contacted NVIDIA for this issue but it might take a while.
Nice, thanks for trying.
Guessing you couldn't implemented it, ty tough.
I still don't have an answer from NVIDIA. No idea if they'll ever answer me. Not the best support i've ever gotten tbh
Same, they never replied back when I contacted them.
"This will take some time to implement as the NVAPI is not a nice thing to work with"
tell me about it :)
i would also just like to add my vote to support gamma and brightness (if possible)
I still don't have an answer on my ticket. I'll open another now. Not sure if this will help but whatever. I have some spare time atm and could use it to work on vibranceGUI... I'll try to contact some NVIDIA people via twitter too.
much appreciated - thanks
----- Original Message ----- Subject: Re: [vibranceGUI] is there a possibility you can add more than just vibrance as an option? (#8) Date: Mon, 20 Jul 2015 13:13:32 -0700 From: juvlarN [email protected]
I still don't have an answer on my ticket. I'll open another now. Not sure if this will help but whatever. I have some spare time atm and could use it to work on vibranceGUI... I'll try to contact some NVIDIA people via twitter too.
Reply to this email directly or view it on GitHub: https://github.com/juvlarN/vibranceGUI/issues/8#issuecomment-123015923
@juvlarN tough you were dead, thanks for trying homie.
They didn't respond to me yet. I actually doubt they ever will.
Am I right in assuming that you need the same specific nvapi version for contrast control as for gamma?
What about adding those features for AMD? This will hugely increase the value of the app. Thanks
It's been two years - Do you think you could look into this again? According to a comment on this page there's a public (no nda required) version at the bottom of the page. I would really like to be able to use a brightness/gamma control.
The commentator was wrong when he posted that comment in 2011. The NDA version of the NVAPI is still required for getting/setting the VideoState. I have just downloaded the latest released NVAPI and there is still no information about these functions nor any documentation about digital vibrance itself.
2017-12-03 1:19 GMT+01:00 nalmeth [email protected]:
It's been two years - Do you think you could look into this again? According to a comment on this page https://stackoverflow.com/questions/5119477/how-can-i-program-a-nvidia-brightness-slider-like-the-volume-slider there's a public (no nda required) version at the bottom of the page. I would really like to be able to use a brightness/gamma control.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/juvlarN/vibranceGUI/issues/8#issuecomment-348730425, or mute the thread https://github.com/notifications/unsubscribe-auth/AH4uKedvFdjKx6OOnJJnHZL5Pga_YZp2ks5s8ekigaJpZM4EPl0N .
This app is basically perfect. But I'd love to be able to control gamma for specific apps as well (more gamma in csgo). Do we still face the same NVAPI limitations today?
@fragtion still has not changed, just double checked for the latest version (r410)
Still not possible?
@juv
Hmm this is interesting: https://devtalk.nvidia.com/default/topic/1057935/nvapi/nvapi-nda-request/ Nvidia says that their control panel uses MSFT API directly.
Tried this app: https://github.com/cmdf/extra-gamma
Seems to work, but I need to unplug one of the monitors. I believe that first parameter in the SetDeviceGammaRamp function from ms api needs to point to correct monitor.
Ok, I found how to select monitor to change gamma on, didn't test it tho: https://stackoverflow.com/questions/34486842/how-to-change-the-gamma-ramp-of-a-single-display-monitor-nvidia-config
I also think "Other applications control color settings" should maybe be selected in nvidia control panel for this? hmm.

Maybe there is still hope! 👍
What do you think?
@Horex
SetDeviceGammaRamp, SetMonitorBrightness and the other high level monitor configuration functions provided by Microsofts API are not really what is of interested for this project. They access and change the configuration of the actual physical device, e.g. your gaming monitor. This is an entirely different approach from what vibranceGUI is using in its current versions. The current design is to force the GPU to override certain settings and that's it. Changing this behaviour might lead to confusion when users expect the NVIDIA/AMD settings to be overriden but in fact their monitor settings are changed.
Also, I am pretty sure that the NVIDIA guy in their forums is wrong. The NVIDIA driver is capable of overlaying even more brightness/contrast/gamma on top of what is being set by the Microsoft API (or your physical menu on the monitor). So while there is a slight chance that there are some different Microsoft APIs that are being used by NVIDIA, I really doubt it.
I have tested the GetMonitorBrightness/SetMonitorBrightness functions and they reflect what my monitor displays when I access the physical menu of the monitor. The NVIDIA Control Panel can overlay even more. I have recorded a quick video of this. As you can see in the video, the brightness added by the NVIDIA driver (set by utilizing the NVIDIA Control Panel) is different from what is being reflected by the Microsoft APIs: https://imgur.com/EUJ0H7t
The "Other applications control color settings" option has no effect on this behaviour.
So while changing brightness/contrast/gamma might be achieved by using the Microsoft APIs, this might not really what we want. To sum up, it is possible to do this by using the Microsoft APIs but not the best solution and a workaround at best.
@juv
Hmm, SetMonitorBrightness seems to change monitor settings. So this is not what we want.
This app was made back in 2002: https://www.majorgeeks.com/files/details/gamma_panel.html It seems to work exactly as nvidia control panel, including Brightness, Contrast, and Gamma. This app can also change those settings per color channel. It does not change any of my monitor settings.
Now the question is how this 18 years old app is doing it. There must be some ancient MS API for this, somewhere.
EDIT: gamma panel and nvidia control pannel override eachothers settings. So this seems like a good indicator that those two apps are writing values to the same API, My best bet is that they are both using SetDeviceGammaRamp.
EDIT2: I found piece of code that converts gamma, contrast, brightness values into GammaRamp for SetDeviceGammaRamp function https://www.pcreview.co.uk/threads/adjusting-screen-contrast-through-c-code-programmatically.4038760/
@juv
I created helper class in attachment to fiddle around with.
Example usage:
static void Main(string[] args) {
int monitorId = 1; // 0 - means apply to all monitors
double level = 50; // default 50
double gamma = 10; // default 10
double brightness = 50; // default 50
double contrast = 50; // default 50
SetDeviceGammaRampHelper.ApplyGammaRamp(monitorId, level, gamma, brightness, contrast);
}
It seems that NVIDIA is using slightly different scale for brightness and contrast. We would need to get nvidia's math for calculating SetDeviceGammaRamp values. If we want to match it. Not sure if we actually need to match scales exactly as nvidia to make it usable for games.
EDIT: Just confirmed that nvidia control panel is indeed changing values of GetDeviceGammaRamp, so that means nvidia is using MS API internally.

Hey,
I am the developer of the HeliosDisplayManagement project and I was going to add the SetDeviceGammaRamp() function to my WindowsDisplayAPI library and since it is hard for users to work with this function I have decided to write a method to calculate the DAC lookup table (gamma ramp) that yields a similar result to the one used by NVidia. I am yet to commit this to my project but since this conversation was helpful, here is the final code that can be used to do so:
private static ushort[] CalculateLUT(double brightness = 0.5, double contrast = 0.5, double gamma = 1)
const int dataPoints = 256;
// Limit gamma in range [0.4-2.8]
gamma = Math.Min(Math.Max(gamma, 0.4), 2.8);
// Normalize contrast in range [-1,1]
contrast = (Math.Min(Math.Max(contrast, 0), 1) - 0.5) * 2;
// Normalize brightness in range [-1,1]
brightness = (Math.Min(Math.Max(brightness, 0), 1) - 0.5) * 2;
// Calculate curve offset resulted from contrast
var offset = contrast > 0 ? contrast * -25.4 : contrast * -32;
// Calculate the total range of curve
var range = (dataPoints - 1) + offset * 2;
// Add brightness to the curve offset
offset += brightness * (range / 5);
// Fill the gamma curve
var result = new ushort[dataPoints];
for (var i = 0; i < result.Length; i++)
{
var factor = (i + offset) / range;
factor = Math.Pow(factor, 1 / gamma);
factor = Math.Min(Math.Max(factor, 0), 1);
result[i] = (ushort)Math.Round(factor * ushort.MaxValue);
}
return result;
}
A while back I used the source code of this project to add vibrance control to my project. So thank you for that. By the way, if you are interested you can check out my NvAPIWrapper to change settings on the monitor via I2C bus or to change HUE. I tried to support as much of nvapi as possible.
@Horex I can't reproduce your observation that the Nvidia Control Panel is changing the values returned by GetDeviceGammaRamp(). Are there any extra steps you have taken?
When trying to reproduce it, I have basically added some quick-n-dirty code inside of the MonitorEnumProc method:
private static int MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, ref NativeAPI.tagRECT lprcMonitor, IntPtr dwData)
{
monitorCounter++;
NativeAPI.RAMP ramp = new NativeAPI.RAMP();
bool ret = NativeAPI.GetDeviceGammaRamp(hdcMonitor, ref ramp);
string content = "";
if (ret)
{
content += string.Join(",\n", ramp.Red);
content += string.Join(",\n", ramp.Green);
content += string.Join(",\n", ramp.Blue);
File.WriteAllText("monitor" + monitorCounter + "-" + DateTime.Now.ToFileTime().ToString() + ".txt", content);
}
return 1;
}
Then I started the application, ran the code with default values in Nvidia Control Panel applied, then changed the values in the Nvidia Control Panel, and ran the code again. Two files get created with the content of the Arrays.
Afterwards, I compare those files with VS Code and Notepad++. And the files do match - hence the Nvidia Control Panel does not adjust the values reported by GetDeviceGammaRamp().
Just to make sure I'm not fiddling with some weird issue when joining those UInt16 arrays to a string, I've overriden the Equals and GetHashCode methods of the RAMP struct, but with the same result. Apparently the Nvidia Control Panel is not changing my monitors gamma ramp?
NVCP does use GetDeviceGammaRamp() in my tests as well.
Try using SetDeviceGammaRamp() to override it and see if it resets the NVCP settings applied on your monitor. Sometimes native methods related to stuff like this act crazy.
Well, take a look here:
- I am calling the code of @Horex to adjust the brightness value to 100
- the brightness gets adjusted as expected
- I refresh in the Nvidia Control Panel to see if the values get updated / adjusted to the higher brightness value
- The brightness value in the NVCP is the same as before and when I adjust the slider in the NVCP, the screen gets even brighter.
Note that it does not matter if I close the Nvidia Control Panel after adjusting the brightness
I am running Nvidia driver version 460.89.
https://user-images.githubusercontent.com/8269353/103139599-3f15a800-46de-11eb-841b-2e0fcde7041d.mp4
Oh yeah, I see the source of confusion.
The thing is, you can't get the raw values from the gamma ramp. So NVCP keeps these data in the registry. But it uses SetDeviceGammaRamp() to apply the final generated ramp.
So changing the gamma ramp directly won't change the values in the NVCP UI; in other words, it makes the NVCP UI show invalid values.
And the other thing about the screen becoming, even more, brighter is because the algorithm used by @Horex is different from the one used by NVCP. That's why ranges are different and that's why I wrote an algorithm that works like NVCP. You can try mine and you can see that the 100% when applied with NVCP is identical to 100% when using my algorithm.
@falahati Interesting. Do you know of a way to read out the values that the NVCP is using from the registry? Maybe even set them? At a quick glance I've found that the key \REGISTRY\WC\Silo7290d152-ec65-20e2-7b84-1f67bd5e5fb7user_sid\SOFTWARE\NVIDIA Corporation\NVControlPanel2\RegisteredServers\DisplayPanelServer\AdjustDesktopColorSettings\ColorChannel is written to the registry which appears to be some kind of Application Hive?:

edit: this blog contains some more hints on what that special registry object is about 🤔:
This is a mount event of the virtual registry file of the package, done as a single event. Further virtual registry entries in the trace show the \Registry\WC\Silo_… path being used to access individual entries.