Sign in to follow this  
schupf

Blending question

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this