Jump to content
  • Advertisement
Sign in to follow this  
schupf

Blending question

This topic is 3789 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

Hello, I want to apply aerial perspective to my terrain (desaturation and blue shifting of far distanced mountains). I have these 2 formulas: 1) Ie * Fatt + Iv 2) Ie * Fatt + Iv * (1 - Fatt) Ie is the color of the terrain (from a texture), Fatt an attenuation factor in [0,1] (Fatt becomes smaller as the distance increases) and Iv the inscattered light (blue at day). The problem is: the first question is physically accurate, but makes my terrain to bright/bluish. The second formula produces nice results. Does anybody have an idea why formula 2) produces better results even though forumla 1) is physically more accurate?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by schupf
Hello,

I want to apply aerial perspective to my terrain (desaturation and blue shifting of far distanced mountains).

I have these 2 formulas:

1) Ie * Fatt + Iv

2) Ie * Fatt + Iv * (1 - Fatt)

Ie is the color of the terrain (from a texture), Fatt an attenuation factor in [0,1] (Fatt becomes smaller as the distance increases) and Iv the inscattered light (blue at day).

The problem is: the first question is physically accurate, but makes my terrain to bright/bluish. The second formula produces nice results.

Does anybody have an idea why formula 2) produces better results even though forumla 1) is physically more accurate?


Are you using high dynamic range lighting, or do you consider any result outside the range [0, 1] to be invalid?

Assuming you're not using HDR:

Without digressing into colourspaces, the human eye, nonlinearity etc. the first formula isn't guaranteed to produce a result in the range [0, 1] even if Ie and Iv are. The hardware will either clamp the result to [0, 1], or normalize it somehow, either of which will be noticeably nonlinear for certain values of Ie and Iv.

The second formula is linear interpolation where Fatt is the parameter. So it guarantees a result in the range [0, 1] (assuming that Ie and Iv are also in the range [0, 1]) and therefore looks "nice".

I think you have a few choices:

1. Use formula 2.

2. Convert to HSV colourspace, do whatever desaturation or hue modifications you want, and convert back to RGB colourspace.

3. Use high dynamic range lighting.

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!