Preetham Sun, spectral rendering back
Board:
Home
Board index
Raytracing
General Development
(L) [2011/12/20] [ost
by amaan] [Preetham Sun, spectral rendering] Wayback!Greetings everyone,
This is my first post here, so a big Hello to you all. I have been a long time lurker at the ompf forum and just today discovered this place.
I have been meaning to finish the 'Physical Sun' part of my implementation of the original Preetham paper. I am stuck on a few things so I hope you guys can help.
a) Units: The sky seems to be in cd/m^2 but the sun spectral intensity on page 28 is in W/cm^2/um/sr. First, why is there a "per micro-meter" part to the units. Second, what is the correct way to go from these units for the sun to cd/m^2? I've google'd, but I'd rather trust the answers here [SMILEY :)]
b) Spectral Sampling: In the paper, the Sun's spectral radiance just outside the earth's atmosphere is attenuated/scaled by various absorption factors. The attenuation factors are listed for some, but not all wavelengths in the visible spectrum. The question is what values do you use for these absorption factors for wavelengths for which there is nothing listed? Should I use a value of 1 to eliminate attenuation of sunlight for these wavelengths? And what is a good resource for looking up how to best treat irregularly sampled spectral data?
Many thanks for taking the time to go through this. All help greatly appreciated.
Amaan
(L) [2011/12/20] [ost
by dr_eck] [Preetham Sun, spectral rendering] Wayback!First, I assume that you know how to convert between lumens/m^2/sr and cd/m^2 and cm^2 to m^2. [SMILEY ;)]   The challenge is to convert from Watts to lumens.  This conversion factor depends on the wavelength, because lumens take the response of the human eye into account.  Thus, to convert from W/um (I use 'u' to mean micro-) to lumens, you need the appropriate photopic lumen/Watt conversion factor for the wavelength.  To get the total lumens, you numerically integrate over the visible wavelengths.  Wikipedia gives a pretty good description here: [LINK http://en.wikipedia.org/wiki/Luminosity_function].  I'd use the y2bar values from here: [LINK http://www.cie.co.at/publ/abst/datatables15_2004/y2.txt] for the integration, although someone more knowledgeable could possibly argue me into the y10 values.  It just feels better to use 2 degree observer values for the sun rather than 10 degree because the sun only subtends half a degree.  Either one should be close enough for computer graphics.
The missing values in Table 2 are all 0 (there is no attenuation).
(L) [2011/12/20] [ost
by amaan] [Preetham Sun, spectral rendering] Wayback!Thanks for the help with the conversion and for confirming the attenuation values.
(L) [2011/12/22] [ost
by necro] [Preetham Sun, spectral rendering] Wayback!a) be careful about the sun radiance data in Preetham paper, I think of by a factor (10 times too low if I remember correctly) w.r.t. the units cited in the paper. Compare it to other sources.
b) In general I recommend "Wyszecki & Stiles - Color science", if you can gain acces to that book. For the attenuation factors with little data: all those components have very little attenuation, so you might as well omit them. Given the approximate nature of the rest of the Preetham model, the sun attenuation is almost ridiculously exact - up to the point where you don't really see a difference in the rendering [SMILEY ;)]
(L) [2011/12/22] [ost
by amaan] [Preetham Sun, spectral rendering] Wayback!thanks for the tips, necro.
(L) [2011/12/29] [ost
by amaan] [Preetham Sun, spectral rendering] Wayback!one quick question about the units for sun's radiance. The sample code that is available with the paper makes a correction by multiplying the radiance data by a factor of 100, citing incorrect units as also pointed about by Necro. What is the source of this discrepancy? The data that I am looking at is the sun's extra-terrestrial Irradiance, and Preetham quotes the sun's extra-terrestrial Radiance. An example, looking at just 550nm spectral data
Preetham(Iqbal?) Radiance:
Wavelength(nm)      SPD(W/cm2/µm/sr)     
550                      2550                           
Irradiance data from another source
Wavelength(nm)      SPD(W/m2/µm)             
550.5                         1864          
There's the obvious per-meter-squared vs. per-centimeter-squared difference, but that implies a different scaling factor than 100. Seems the Radiance/Irradiance is not relevant here too. So where does this 100 come from?
Thanks very much,
Amaan
(L) [2011/12/31] [ost
by tstanev] [Preetham Sun, spectral rendering] Wayback!I think it's a factor of 10 overall as someone stated previously, and it is to convert the cm^2 to m^2 and the um to nm:
        /* from W/cm^2/um/sr to W/m^2/nm/sr */
        double unit_factor = 1.0e4 * 1.0e-3; /* 1/cm^2 to 1/m^2 and 1/um to 1/nm */
Confusingly, the attenuation factors still need um wavelength in their formulas, but then you integrate over nm wavelength spectrum (I use the 10 degree CIE). Something you may want to do as well is convert the final answer to (kilo)candela, because this is what the sky part of the sun-sky model uses. The factor for that is 683(/1000).
Actually someone posted the implementation used by Optix on the old forum, which was a helpful reference to correct similar problems in my code, but looking back in the Google cache I couldn't find the post. Even with two references, I still don't think I got it fully right myself. Sometimes I end up having to resort to scaling down the sun's brightness to keep the dynamic range of the scene under control.
(L) [2011/12/31] [ost
by cozdas] [Preetham Sun, spectral rendering] Wayback!When I was implementing it, the values in the original paper didn't make much sense to me; it looked like off by a factor of 100 not 10. Therefore I ignored them and used a reliable data source with usual units: actual readings form satellites [LINK http://lasp.colorado.edu/lisird/sorce/sorce_ssi/]
Once the units are well-known and the values are reliable the implementation and verification became much easier.
/Cuneyt
(L) [2012/01/01] [ost
by apaffy] [Preetham Sun, spectral rendering] Wayback!Also beware of the paper errata: in appendix A1 in the equations for tor_{r,gamma} and tor_{a,gamma} the relative optical mass m should be part of the product for the power of e, not the power of gamma.  This is fixed in the example code provided with the paper, and in the Optix SDK example too, so I recommend comparing code.
(L) [2012/01/02] [ost
by amaan] [Preetham Sun, spectral rendering] Wayback!tstanev, Cuneyt and apaffy, thank you so much for all these insights.
I happened upon the Colorado LISIRD website a few days back but found that the SPD was not plotted over visible range. Was I just looking in the wrong place?
And does anyone have the OPTIX code lying around for reference?
Thanks again,
amaan
back