MartB/RETC

Overwatch very dim

TobyMoose opened this issue · 11 comments

The lights on the overwatch profiles are very dim. I loaded up some other games and they are nice and bright but not on over watch. any ideas?

MartB commented

Thats just how overwatch designed their colors.
I suppose the leds on the razer devices are a little brighter with the specific colors they picked.

I have recompiled it with a gamma correction function just to light it up a little more. I will tweak it as I go along but if you want to make it brighter solely in overwatch change convertLedColor in CorsairSDK.cpp to

#define gamma (1.0/1.7)

int addGamma(int color) {
	return (int) (pow(color / 255.0, gamma) * 255.0);
}

CorsairLedColor CorsairSDK::convertLedColor(const COLORREF& color) {
	CorsairLedColor ledColor;
	ledColor.r = addGamma(GetRValue(color));
	ledColor.g = addGamma(GetGValue(color));
	ledColor.b = addGamma(GetBValue(color));
	ledColor.ledId = CLI_Invalid;

	return ledColor;
}

Build it in visual studio and put the new exe in the main folder and it should run fine. I need to tweak the gamma functions value but it generally looks nicer for the standard colors and stuff like Lucio and Mercy.

I don't believe this is a feature that warrants being added to the actual version though it could be nice to have a config file for gamma correction.

Also I literally only just started C++ the other day for coding some chips xD Don't judge too harsh but if I'm doing anything wrong with general coding standards feedback would be appreciated.

@TobyMoose if you dont know how to rebuild it you can use this but I personally would suggest editing it yourself and compiling it just so you know what is in it.

Also @MartB the colors seem closer to what are displayed on my deathadder so possibly a gamma function would actually line it up with razer hardware better. Though that could just be this device i have (See photo and video in this link https://photos.app.goo.gl/7HEFz6GhjdydcCjU7)

The main difference you can see is with Moira (In the video the one just before the last which is red)

The changes can be found here https://github.com/sekwah41/RETC/blob/master/server-exe/CorsairSDK.cpp#L384

Recompiled Server x64.zip

MartB commented

@sekwah41 sounds like a plan!
It really seems to look better.

I will implement something like your gamma correction soon. (adjustable through the config)

Edit:
Code wise it looks fine to me, you could only do some minor optimizations that i personally love doing but they wont matter much haha.

What sort of optimizations would you personally do? I'm curious :)

Edit: for starters i would convert the divide to a multiply, or does it compile into that anyway? I know java that has a performance difference (well slight but its there)

MartB commented

Probably the following:

  • make addGamma static
  • rewrite it so it takes colorref and extracts the color itself giving back r,g,b as reference params.
    (sth like void TRANSFORM_COLORS(const COLORREF& color, int &r, int &g, int &b) where r,g,b is the transformed output)
  • pass the arguments by const reference
  • use c++ style casts instead of (int)
MartB commented

@sekwah41 you can build the latest master and try out what i implemented.
Check https://github.com/MartB/RETC/wiki/Config-options for the required config keys.

MartB commented

Heh typo madness sorry for the notification spam!

Its alright, thanks for the info btw :)

Oh good idea with the lookup table, completely passed my mind to do that :)

Hopefully I get to make some fun projects in C++ too, im going to use what youve done to learn some stuff. Anywhere you would suggest has good examples of C++ or any resources to learn a bit faster? I wanna learn some of the standards because pointers and such rather than randomly messing to get stuff working as i dont feel itll have the same effect as trying to learn in java xD

Shouldn't this be closed if it has been implemented?

MartB commented

@sekwah41 you are right, but i wanted to get the original author of the issue to check.
Closing this as this will probably not happen anymore.

Regarding your question about good materials/resources i think learning by doing suits programming/coding best. For the use of (old-school) pointers it should be sufficient to read this page: http://www.cplusplus.com/doc/tutorial/pointers/

If you want a document detailing best practices check out.
http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
(keep in mind that its not a definitive guide to good code)

You can also go ahead and dive into the more theoretical aspects of computer science.
(https://introtcs.org/public/index.html) seems to be a good wip book only gave it a quick glance though.