# Modifying color bright.

This topic is 4933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everybody. I need some help making my color pallete brighter. Is there a fomrmula to make one color brighter? i mean RGB.

##### Share on other sites
multiplying your colours is probably the simplest way of doing things. Although it is going to be prone to precision if you're talking regular 24bit RGB - and it's very possible to "wash out" your image. There are a few simple luminance algorithms around that will re-map an image to a brighter colour range.

A better, but much more complex, solution is to look into High Dynamic Range Imaging (HDRI)..

hth
Jack

##### Share on other sites
Ok. What im doing is to make a table of 65536 colors from values given(llike translating colors from one format to another:

long create_color(WORD gbvalues){	int lum=5;	unsigned char red, green, blue, r, g, b;	red=(((gbvalues&31)*0xFF)/31);	green=((((gbvalues>>5)&31)*0xFF)/31);	blue=((((gbvalues>>10)&31)*0xFF)/31);          //This operations transforme the encoded color format to normal ones.	r = ((red*10+green*3+blue)/14);	g = ((green*10+blue*2+red*2)/14);	b = ((blue*10+red*2+green*2)/14);        //This code is to wash the colors but with the cost of less bright.        //With this formula i got the real colors i wanted, but i still need to make them brighter.	return ((r<<16)|(g<<8)|b);}

This function is called 65536 times to produce all the color values so here i where i want to implement the formula which makes color brighter.

##### Share on other sites

int add_intensity = 50;int i_r = ((red*10+green*3+blue)/14) + add_intensity;int i_g = ((green*10+blue*2+red*2)/14) + add_intensity;int i_b = ((blue*10+red*2+green*2)/14) + add_intensity;if (i_r > 255) i_r = 255;if (i_g > 255) i_g = 255;if (i_b > 255) i_b = 255;r = i_r;g = i_g;b = i_b;

##### Share on other sites
I have already tried something like that bu with a better way of max intensity calcultion, and it "woks" but it changes some colors.

##### Share on other sites
It depends what you need this for - if it's a global "brightness" setting for your game, I'd recommend looking at the gamma setting. If you're using Direct3D, then use the IDirect3DDevice9::SetGammaRamp call.

For adjusting common properties of a palette in an intuitive way, I've always been fond of the following:
http://www.sgi.com/misc/grafica/interp/index.html

[Assuming you're already satisfied that a lerp makes sense in the colour space you're already using]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 12
• 15
• 11
• 12
• ### Forum Statistics

• Total Topics
634153
• Total Posts
3015844
×