Jump to content
  • Advertisement
Sign in to follow this  
Dospro

Modifying color bright.

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
How about:

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 this post


Link to post
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 this post


Link to post
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!