Preetham Sun, spectral rendering

Practical and theoretical implementation discussion.
amaan
Posts: 8
Joined: Tue Dec 20, 2011 12:59 pm

Re: Preetham Sun, spectral rendering

Post by amaan » Mon Jan 02, 2012 6:40 pm

OK just found the Optix SDK code (Haven't looked at optix at all before this)

...\OptiX SDK 2.1.1\SDK\sutil\SunSky.

Thanks,
Amaan

amaan
Posts: 8
Joined: Tue Dec 20, 2011 12:59 pm

Re: Preetham Sun, spectral rendering

Post by amaan » Thu Jan 05, 2012 6:11 pm

Hi all,

At the risk of further embarrassing myself, here are a few more questions if you have time. I've seen the the Optix code and it's been helpful in tracking down the units issue. In the spectrum-to-XYZ conversion code, a multiplicative factor pops up again

Code: Select all

for (int i = 0; i < 38; ++i)
{
        XYZ.X += attenuated_sunlight[i] * cie_table[i][1] * 10.0f;
        XYZ.Y += attenuated_sunlight[i] * cie_table[i][2] * 10.0f;
        XYZ.Z += attenuated_sunlight[i] * cie_table[i][3] * 10.0f;
}
Where does this factor of 10 come from? Is this because of the 10nm wavelength data interval that we need to take in to account when integrating?

Also, I am converting to RGB from XYZ using sRGB primaries matrix, and have a linear multiplier to scale down the super-bright values returned. The generated output is then transformed from linear colour space to gamma-encoded (1/2.2 as an approximation to sRGB) for viewing. Are you guys using this method as well?

Also, when the sun is at zenith, I get an undesirable pink shade around the horizon. I have seen this in some implementations, and not in others. (Mine does not yet have Aerial Perspective implemented. I am not sure if that has any impact on the look of the horizon). Have you guys noticed this too?

Thanks again,
Amaan

graphicsMan
Posts: 167
Joined: Mon Nov 28, 2011 7:28 pm

Re: Preetham Sun, spectral rendering

Post by graphicsMan » Fri Jan 06, 2012 12:11 am

The preetham model has issues when the sun is near the horizon.

tstanev
Posts: 6
Joined: Mon Dec 26, 2011 6:20 am

Re: Preetham Sun, spectral rendering

Post by tstanev » Sat Jan 07, 2012 4:11 am

amaan wrote:
Where does this factor of 10 come from? Is this because of the 10nm wavelength data interval that we need to take in to account when integrating?

Also, when the sun is at zenith, I get an undesirable pink shade around the horizon. I have seen this in some implementations, and not in others. (Mine does not yet have Aerial Perspective implemented. I am not sure if that has any impact on the look of the horizon). Have you guys noticed this too?
The 10 there is due to the integration over increments of 10 nm.

You may try playing with the "turbidity" value to make the horizon less pink. Also there is some dependence on the lat-lon location, though I have not experimented much with that myself.

amaan
Posts: 8
Joined: Tue Dec 20, 2011 12:59 pm

Re: Preetham Sun, spectral rendering

Post by amaan » Sat Jan 07, 2012 10:12 am

Thanks graphicsMan and tstanev. Good to confirm the integration bit.

Any more info on this lat-long dependence?

spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Preetham Sun, spectral rendering

Post by spectral » Wed Feb 20, 2013 11:32 am

And does someone know what mean the sun_scale factor (1 / 3200000) in the OptiX implementation ?

Post Reply