Jump to content
  • Advertisement
Sign in to follow this  
Alessandro Pozzer

Color interpolation between orange and blue

This topic is 391 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 guys, 

I dont know if this is the right section, but I did not know where to post this. 

I am implementing a day night cycle on my game engine and I was wondering if there was a nice way to interpolate properly between warm colors, such as orange (sunset) and dark blue (night) color. I am using HSL format.

Thank  you.

Share this post


Link to post
Share on other sites
Advertisement

I've spent a lot of time studying sunsets for this exact same reason.  The end of the sunset is fine - you can fade from orange to purple to dark blue.  The start of sunset can look odd though - fading from blue sky directly to yellow goes through an unnatural greenish colour.  Try fading to a whitish colour first.  This only applies to colours on the horizon - your upper sky colour can fade straight from blue (day) to black (night) over the entire sunset length.

Edited by xbattlestation

Share this post


Link to post
Share on other sites
41 minutes ago, xbattlestation said:

The start of sunset can look odd though - fading from blue sky directly to yellow goes through an unnatural greenish colour.

Actually, it's not unnatural - it's entirely natural. Go on images.google.com and type in "sunset colors," and you will find some that have green, and it's beautiful. You'll also find some images with no green, and you can study the transitional hues in those.

Share this post


Link to post
Share on other sites
21 hours ago, xbattlestation said:

I've spent a lot of time studying sunsets for this exact same reason.  The end of the sunset is fine - you can fade from orange to purple to dark blue.  The start of sunset can look odd though - fading from blue sky directly to yellow goes through an unnatural greenish colour.  Try fading to a whitish colour first.  This only applies to colours on the horizon - your upper sky colour can fade straight from blue (day) to black (night) over the entire sunset length.

Thank you for your answer. Can you, please, help me with the colours you think it should be better to use? Currently I am using:

NOON : horizon = blue, upper = blue.

SUNSET: horizon = orange, upper = blue

NIGHT: horizon = dark blue, upper = black

DAWN: horizon = light orange, upper = light blue

Do you think it could work? and What colorus would you suggest me to use for interpolate better between them? Thank you so much for your help.

Share this post


Link to post
Share on other sites

Yeah you've pretty much got it.  I find a solid blue for daytime doesn't quite look right - but it'll depend on the art style you want your game to have.  Personally I think a blue fading to a very light blue on the horizon looks great.

As for the general flow - yeah I think you have that right.  Just remember from blue to orange via extremely light blue / white otherwise you'll get green (which just looks very unnatural in my eyes), and fade from orange to dark blue via purple for a dusky look.

Again, depending on your art style, realistic sky colours are not necessarily as vivid as you'd think.  Take some sunset photos from a google search, and run a colour picker tool on them - they aren't outright orange, but rather a washed out version.  Clouds on the other hand tend to reflect very vivid colours.  But half the fun is working this stuff out for yourself, and experimenting to find what works for you.

Share this post


Link to post
Share on other sites

If you just want to know how to do a gradient, I'm not sure you need much help. But if you want to learn about sunsets and sky colour, you may want to look up Rayleigh scattering and associated phenomena.

A good start would be this article linked from the Wikipedia page on Rayleigh scattering.

I get a feeling you might want to reformulate your original question. What do you want to know, really? The colour of the sky throughout a day/night cycle? The colours to use to properly light your scene?

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!