Jump to content
  • Advertisement
Sign in to follow this  
quasty

changing color, preserving luminance

This topic is 4382 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, does anybody knows how do I modify a RGB color vaue (for example make it 10% more yellow or 5% less red) but preserve the luminance of the color value? thank you

Share this post


Link to post
Share on other sites
Advertisement
You can define the luminance as (min(R,G,B)+max(R,G,B))/2. Then do something like the following pseudo-code:
original_luminance = luminance(color);
// modify color somehow
color = color * (original_luminance / luminance(color));


Well, at least that's the luminance they use in HSL. You can try to use a different definition, something like .3*R + .59*G + .09*B. You may have to do some gamma correction too. See which of the definitions produces the results you want.

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!