tag:blogger.com,1999:blog-68882878967133305742024-03-05T13:11:59.799-08:00Sky Renderer by Peter KutzPeterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-6888287896713330574.post-85831897603234391622013-05-03T19:53:00.002-07:002013-05-03T19:57:42.642-07:00The Importance of OzoneAs I've written about before (in particular <a href="http://skyrenderer.blogspot.com/2012/10/ozone-absorption.html">here</a> and <a href="http://skyrenderer.blogspot.com/2012/10/vertical-distribution-of-ozone.html">here</a>), ozone absorption has a big influence on the color of the sky during twilight. In particular, ozone absorption gives the sky its increasingly saturated blue color as the sun sinks below the horizon. You can easily see this effect in real life, especially if you are looking out the window from inside and your eyes are adjusted to the unchanging hue of indoor light. I recently rendered a new pair of images (below) to clearly illustrate the effects of ozone. I hadn't rendered before-and-after ozone pictures since adding aerosols to the atmosphere, so I wanted to create these updated images. The solar elevation angle in these renders is −4°. These are display-linear images—I haven't done anything to increase the saturation or contrast.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5bpRQtUDcFc9LXSkyBNLI3PlIzfxGgLMs5QjxZ9stBLVhdwqBz7ewa-MNFHMbXT1B4ovdK2O3bULLKs-EK45GsBGJA3vGgJx_ac7urFIGmagtSgVnNDJCFQXpdgyE_JHZmq0xup1pYLvc/s1600/TwilightWithOzoneDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5bpRQtUDcFc9LXSkyBNLI3PlIzfxGgLMs5QjxZ9stBLVhdwqBz7ewa-MNFHMbXT1B4ovdK2O3bULLKs-EK45GsBGJA3vGgJx_ac7urFIGmagtSgVnNDJCFQXpdgyE_JHZmq0xup1pYLvc/s1600/TwilightWithOzoneDoubled.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight with ozone.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPTgr-vc5e76K4SQrI9_JRyP7MsZY7Ha-9SYsxT1ij06UGblNGajLv5fTkwfB6GDUWvSkP0_BvMywBMMLFIumpF7bZMfeuiwQ0NuonmI7M3RfcLqLVyiikT6UxYAhXn33t0vDYrtOSOFMB/s1600/TwilightWithoutOzoneDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPTgr-vc5e76K4SQrI9_JRyP7MsZY7Ha-9SYsxT1ij06UGblNGajLv5fTkwfB6GDUWvSkP0_BvMywBMMLFIumpF7bZMfeuiwQ0NuonmI7M3RfcLqLVyiikT6UxYAhXn33t0vDYrtOSOFMB/s1600/TwilightWithoutOzoneDoubled.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight without ozone.</td></tr>
</tbody></table>
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com2tag:blogger.com,1999:blog-6888287896713330574.post-74787049134032170492013-04-25T01:17:00.003-07:002013-05-06T12:46:29.352-07:00Poster and PresentationHere's a simple poster that summarizes my sky renderer project:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzpg6eaYyaj1CzAigAuMugsGGCOMp8goLBWq07nHEG5_5HP4zUVOs18sNOkev9LKgkJWvBkM9mU7WZKxyKLY4zXlL7TcVpizT6XPlI4gSvbKhjP_hnnE2tuNDv8QkRIV0ygKta3RN9dzuw/s1600/PeterKutzSkyPoster.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzpg6eaYyaj1CzAigAuMugsGGCOMp8goLBWq07nHEG5_5HP4zUVOs18sNOkev9LKgkJWvBkM9mU7WZKxyKLY4zXlL7TcVpizT6XPlI4gSvbKhjP_hnnE2tuNDv8QkRIV0ygKta3RN9dzuw/s400/PeterKutzSkyPoster.png" width="400" /></a></div>
<br />
And here's a quick presentation that summarizes the project (I spoke over this when presenting it, so much of it doesn't have words; some of it won't make sense without narration):<br />
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="true" frameborder="0" height="389" mozallowfullscreen="true" src="https://docs.google.com/presentation/d/12dvGD7bPNMROkJ5aOV0yPsj6Xgs8hR4SUNBJxujeHOw/embed?start=false&loop=false&delayms=10000" webkitallowfullscreen="true" width="480"></iframe>
</div>
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com1tag:blogger.com,1999:blog-6888287896713330574.post-48198979299344271922013-02-01T15:18:00.001-08:002013-02-01T15:18:44.310-08:00New CMFs and More Accurate Spectrum RendersI updated the color matching functions (CMFs) that my spectral rendering system uses to convert spectral power distributions to CIE XYZ. My new CMFs are the new, physiologically-relevant, <a href="http://cvrl.ioo.ucl.ac.uk/">2-deg XYZ CMFs transformed from the CIE (2006) 2-deg LMS cone fundamentals</a>. My old ones were the <a href="http://cvrl.ioo.ucl.ac.uk/">CIE 1931 2-deg, XYZ CMFs modified by Judd (1951) and Vos (1978)</a>.<div>
<br /></div>
<div>
I made some new images of the visible spectrum rendered into the sRGB color space. When you convert XYZ to sRGB you get negative color components when the color lies outside the sRGB gamut. Clipping these negative components to zero distorts the color. But if you <a href="http://en.wikipedia.org/wiki/Visible_spectrum#Color_display_spectrum">add white light</a> to the entire spectrum, you can bring the negative components into the displayable range, resulting in an accurate picture of what the spectrum looks like on a gray background. In each gray background image below, I added just enough white light to bring the most negative value to zero, and I set the range so that the most positive value maps to one. In each of the darker, black background images, I simply removed the white light. And in each of the brighter, black background images, I brightened the spectra just enough to utilize the entire displayable range.<br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh8d8pDDSftG5keuWAtyBcKU00RuqJeOZv6In0YwXo3M7N6e9OETnStL0WslqENpN2roReDjjijJxaK8BZxCEiUIr3hsqgyDuHciZ6cZFpQXc2fYST76ETxykz9lldgeQrUb3tadkYb5Nr/s1600/NewVisibleSpectrumOnGray.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh8d8pDDSftG5keuWAtyBcKU00RuqJeOZv6In0YwXo3M7N6e9OETnStL0WslqENpN2roReDjjijJxaK8BZxCEiUIr3hsqgyDuHciZ6cZFpQXc2fYST76ETxykz9lldgeQrUb3tadkYb5Nr/s400/NewVisibleSpectrumOnGray.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New spectrum on gray.<br />Wavelength range: 390–830 nm.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3lpyrkFQizMPMWY4ie3gXTiTyJgw0wDr4o7_3B-o46wrONv8_ppRt3XpO-7zI-yGH5ky3yz2gn7URZb4Dr2i25Y6RNePXbmuaG2cZfRBpRCBCN7BAQEaNcDoNnVfx7XO7ULBq9_N6Rr1L/s1600/NewVisibleSpectrumOnBlack.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3lpyrkFQizMPMWY4ie3gXTiTyJgw0wDr4o7_3B-o46wrONv8_ppRt3XpO-7zI-yGH5ky3yz2gn7URZb4Dr2i25Y6RNePXbmuaG2cZfRBpRCBCN7BAQEaNcDoNnVfx7XO7ULBq9_N6Rr1L/s400/NewVisibleSpectrumOnBlack.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New spectrum on black.<br />Wavelength range: 390–830 nm.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjBLj3dnFfUTIZnS0hdlyviqzbNDOo1oCsPN2UlUHoiTL3yXu9UkWlNvyg1ezTG7ezxTFAWvuwbf9gBR2vGwjOSLSxTTx1_h9TdNRe0I3LVc69dQDNt1T6DksKbD1C78hmzEg-rt29EQp/s1600/NewVisibleSpectrumOnBlackBrighter.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjBLj3dnFfUTIZnS0hdlyviqzbNDOo1oCsPN2UlUHoiTL3yXu9UkWlNvyg1ezTG7ezxTFAWvuwbf9gBR2vGwjOSLSxTTx1_h9TdNRe0I3LVc69dQDNt1T6DksKbD1C78hmzEg-rt29EQp/s400/NewVisibleSpectrumOnBlackBrighter.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New spectrum on black, brightened. <br />Wavelength range: 390–830 nm.</td></tr>
</tbody></table>
<br /><br /><br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcJRBab7Rr3jklsutLsXtmz6NKpvKrtqaK8zF8Lr6e0k6EXOwyw3me8YgJBE8yluUf5TilZxusf9MWrWJ9q_fdCpy73ddRCQMgOavUoBXmCFKskLu2Q9-dpFWScW-RgFmUZrdBmU7zSy3n/s1600/NewAndOldOnGray.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcJRBab7Rr3jklsutLsXtmz6NKpvKrtqaK8zF8Lr6e0k6EXOwyw3me8YgJBE8yluUf5TilZxusf9MWrWJ9q_fdCpy73ddRCQMgOavUoBXmCFKskLu2Q9-dpFWScW-RgFmUZrdBmU7zSy3n/s400/NewAndOldOnGray.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New (top) and old (bottom) spectra on gray.<br />Wavelength range: 380–830 nm.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuQsNPhsWxkXOhZdABdF_Ap4GwH8bfaMhwXVw2Hpz31_iQZB6d248kyPAV_nBqx-OwxsYn2MeKfciaG65Ok4R4FoAlVm-9uMW8TAQlkGyVdJ37bgACQ344hrQhDgq8y55dT8QAXc_SYbL-/s1600/NewAndOldOnBlack.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuQsNPhsWxkXOhZdABdF_Ap4GwH8bfaMhwXVw2Hpz31_iQZB6d248kyPAV_nBqx-OwxsYn2MeKfciaG65Ok4R4FoAlVm-9uMW8TAQlkGyVdJ37bgACQ344hrQhDgq8y55dT8QAXc_SYbL-/s400/NewAndOldOnBlack.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New (top) and old (bottom) spectra on black.<br />Wavelength range: 380–830 nm.</td></tr>
</tbody></table>
<br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitBW8iz6MAIzoovvCREMQ_BG_vB0yz4za97RAdIoOIrqxPtosJy_RgUWmwQGo6IM7813TLPmnBe4BoCTxZ7ddQIWFpHippksW4eN3wr55LVnWdn2yhqaat2jIzcVXAxpAU66fxZvl7IwgN/s1600/NewAndOldOnBlackBrighter.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitBW8iz6MAIzoovvCREMQ_BG_vB0yz4za97RAdIoOIrqxPtosJy_RgUWmwQGo6IM7813TLPmnBe4BoCTxZ7ddQIWFpHippksW4eN3wr55LVnWdn2yhqaat2jIzcVXAxpAU66fxZvl7IwgN/s400/NewAndOldOnBlackBrighter.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New (top) and old (bottom) spectra on black, brightened.<br />Wavelength range: 380–830 nm.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1AlqPmECTrvdlRRXZSjpFOS-AZmPweGuEGrMio20SbipAjMcuvUuJTq1rxPpuGwN_9u7K4a5ihBP4PR1S7XsmFzmSwkf4Jj3UgqZgR2045dpEJSDQXHE9ogHx8XQTIjJVU66yeK6Sar3G/s1600/OldVisibleSpectrumOnGray.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1AlqPmECTrvdlRRXZSjpFOS-AZmPweGuEGrMio20SbipAjMcuvUuJTq1rxPpuGwN_9u7K4a5ihBP4PR1S7XsmFzmSwkf4Jj3UgqZgR2045dpEJSDQXHE9ogHx8XQTIjJVU66yeK6Sar3G/s400/OldVisibleSpectrumOnGray.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Old spectrum on gray.<br />Wavelength range: 380–825 nm.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw4wSHxqSG75xZvzag-us49GUIasAg90FpAV1-K6WfTjuOG-JvWkJo0G3rSm7N7oC0sf33DgPKE1l6XMp56WVyjNP6vGp0ApDQrHdkAJT5md5eEkRZsUbbdXoOoPpzvH4x1NmnUaxzVNiI/s1600/OldVisibleSpectrumOnBlack.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw4wSHxqSG75xZvzag-us49GUIasAg90FpAV1-K6WfTjuOG-JvWkJo0G3rSm7N7oC0sf33DgPKE1l6XMp56WVyjNP6vGp0ApDQrHdkAJT5md5eEkRZsUbbdXoOoPpzvH4x1NmnUaxzVNiI/s400/OldVisibleSpectrumOnBlack.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Old spectrum on black.<br />Wavelength range: 380–825 nm.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2sEeX3WthKsPZxht-w4OURC8PmvKEPyreG8ohwByURcxJOSmFvxNgeV5mxGSc7jE5ow2Usu1EC0I_80aK_tqIRX6Hu2zwX-k1G49jFCIfU9LT8BELJigYgtMijh861fvHjdnZT_5IFv9-/s1600/OldVisibleSpectrumOnBlackBrighter.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2sEeX3WthKsPZxht-w4OURC8PmvKEPyreG8ohwByURcxJOSmFvxNgeV5mxGSc7jE5ow2Usu1EC0I_80aK_tqIRX6Hu2zwX-k1G49jFCIfU9LT8BELJigYgtMijh861fvHjdnZT_5IFv9-/s400/OldVisibleSpectrumOnBlackBrighter.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Old spectrum on black, brightened.<br />Wavelength range: 380–825 nm.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
</div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-76439592190332074872013-01-13T12:46:00.001-08:002013-01-27T21:59:25.218-08:00Sunny BunnyBelow is a new bunny render, lit by a new sky render with a solar elevation angle of 45°. Apart from the sky map and the exposure, the setup is identical to the bunny images in the previous post.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYdyKNQ2ZfqELt81j1H8CLXzBV9eT0wTwLa_27ieK6CPc_ZMe5nyF9deBJUgdFXvFl2OCKHYyNKn0rAkmPIB84dpyVlczwE1NXcVwv_-I7KO1Vge2guzabNV0srKpwPUGpF9X0hwMpLYnz/s1600/FortyFiveDegreesBunny.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYdyKNQ2ZfqELt81j1H8CLXzBV9eT0wTwLa_27ieK6CPc_ZMe5nyF9deBJUgdFXvFl2OCKHYyNKn0rAkmPIB84dpyVlczwE1NXcVwv_-I7KO1Vge2guzabNV0srKpwPUGpF9X0hwMpLYnz/s400/FortyFiveDegreesBunny.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Bunny lit by 45° sun.</td></tr>
</tbody></table>
<br />
Here's a low dynamic range version of the sky render that I used to light the image above:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEqpmhaGR6LX7bKqkbaW7MmZS2W_bLXCXn9skg4QI_mDkuId3YmtUX6R2aRfVRetVrXndWUMgbUMD2lIvJPUdugWshm9XIeVpbQh1Akf3zlcEC2DWL2H-lsQGgpThvRoRBMYghmXGOMuwa/s1600/FortyFiveDegreesDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEqpmhaGR6LX7bKqkbaW7MmZS2W_bLXCXn9skg4QI_mDkuId3YmtUX6R2aRfVRetVrXndWUMgbUMD2lIvJPUdugWshm9XIeVpbQh1Akf3zlcEC2DWL2H-lsQGgpThvRoRBMYghmXGOMuwa/s320/FortyFiveDegreesDoubled.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">45° solar elevation angle.</td></tr>
</tbody></table>
<br />
Here's another new sky with a lower sun, shown here with the same exposure as the image above:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtrpioKR5lFomUXYb7lYeWd9lXyjhZbU_cjE6vmxj85tTRiRmwm6vP-aAwega4l5nIxaCymQjTbed6Qq-BS7HdKuwwgZj2kse_lPMjKiQzXB3n21WpqlvdbljA09kc8z8wPVULTOKFXODp/s1600/ThirtyDegreesDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtrpioKR5lFomUXYb7lYeWd9lXyjhZbU_cjE6vmxj85tTRiRmwm6vP-aAwega4l5nIxaCymQjTbed6Qq-BS7HdKuwwgZj2kse_lPMjKiQzXB3n21WpqlvdbljA09kc8z8wPVULTOKFXODp/s320/ThirtyDegreesDoubled.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">30° solar elevation angle.</td></tr>
</tbody></table>
<br />
I rendered these sky renders directly to equirectangular format. I rendered them at high resolution to more accurately capture the shape of the sun. The sun isn't visible in the images above because the sky around the sun is blown out. The images above are both re-exposed so that you can see the blueness of the sky, but I originally rendered them 3 stops lower to ensure that the bright sun could not exceed the <a href="http://en.wikipedia.org/wiki/Half-precision_floating-point_format">half-precision floating-point</a> maximum value (because the renders are saved as 16-bit OpenEXR images).<br />
<br />
Here are LDR versions of the images with unmodified exposure:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCG8VKY8HMDQVPEjFw3xKqobWMgucwRdnhyZ7_-BwPIh110owEgropoBJvTMHXyUyNTXzsNWk4pw-c1uPXlmVy5piDmSuoOaCLGHmGW6Cf4CaaNxQ-Jf0aUGN-QmBYFqEGV3Q3v05hRFk1/s1600/FortyFiveDegreesDoubledOriginalExposure.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCG8VKY8HMDQVPEjFw3xKqobWMgucwRdnhyZ7_-BwPIh110owEgropoBJvTMHXyUyNTXzsNWk4pw-c1uPXlmVy5piDmSuoOaCLGHmGW6Cf4CaaNxQ-Jf0aUGN-QmBYFqEGV3Q3v05hRFk1/s320/FortyFiveDegreesDoubledOriginalExposure.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">45° solar elevation angle.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYJ2eTYqbtwJK0n1DmNCsjHY7CP2Uk9ncVpBLAVOpPt6zoYZxCkTxXphleew3YO3eWzr79Z8e-PPH4UbNkEVCos7coZWOLc9fhzyfMeSIeESyXg046VzRZCmxeLarraqcWx8UP0U6K73bQ/s1600/ThirtyDegreesDoubledOriginalExposure.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYJ2eTYqbtwJK0n1DmNCsjHY7CP2Uk9ncVpBLAVOpPt6zoYZxCkTxXphleew3YO3eWzr79Z8e-PPH4UbNkEVCos7coZWOLc9fhzyfMeSIeESyXg046VzRZCmxeLarraqcWx8UP0U6K73bQ/s320/ThirtyDegreesDoubledOriginalExposure.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">30° solar elevation angle.</td></tr>
</tbody></table>
<br />
By the way, the ground color in the bunny render doesn't match that in the sky render—the bunny render ground is tan, and the sky render ground is gray.<br />
<br />
I also rendered some images of a gold bunny lit by the same 45° sun and sky, featuring photon-mapped caustics: <a href="http://photorealizer.blogspot.com/2013/01/gold-bunny-lit-by-sun-and-sky.html">http://photorealizer.blogspot.com/2013/01/gold-bunny-lit-by-sun-and-sky.html</a><br />
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-42928588845661485702012-12-31T08:30:00.000-08:002013-02-23T22:55:37.018-08:00Rendering Using Sky Images as Light SourcesI rendered the following bunny images in <a href="http://photorealizer.com/">Photorealizer</a> using equirectangular HDR sky images as light sources.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD2vyyI2bUwgBUtNaqpIckcHdNBHzbdtIoYhCVJ-HzL5bLrJKT0UgC8oMWsekxKkgNhfU70Me6yM6qCkMlRBgB7MPA57EUMp7fNgQfEXnIjmcGIjE0REcs2n6vIItCqF_qGfsvht0N3882/s1600/FourDegreesBunny.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD2vyyI2bUwgBUtNaqpIckcHdNBHzbdtIoYhCVJ-HzL5bLrJKT0UgC8oMWsekxKkgNhfU70Me6yM6qCkMlRBgB7MPA57EUMp7fNgQfEXnIjmcGIjE0REcs2n6vIItCqF_qGfsvht0N3882/s400/FourDegreesBunny.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Bunny at sunrise / sunset.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWLsvndjjGO-qZenF2oeO5ZdhTKnAC-V8Cv1-n7FhyW0WukX6IZVHOfZdP2PKt4W-ii91nA8UpBedHuUTktFbQgn-azoPRnDfG7Q1Q_BBUVGplwqP7ePl8y7NynlhcHmo8KwOWj4lSzB3p/s1600/TwilightBunny.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWLsvndjjGO-qZenF2oeO5ZdhTKnAC-V8Cv1-n7FhyW0WukX6IZVHOfZdP2PKt4W-ii91nA8UpBedHuUTktFbQgn-azoPRnDfG7Q1Q_BBUVGplwqP7ePl8y7NynlhcHmo8KwOWj4lSzB3p/s400/TwilightBunny.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Bunny during twilight.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Below are LDR versions of the sky images that I used for the bunny renders above. These are the same images that I posted and described in the previous post.</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoFYT2zzIxhn6WqNYkT8L50vfufhsy8tOdIjjT66s6iMCBa4CB-ZwQnS4bYuIxQP69Kt34racAPxflv2wZXcoYvsIBYHZnuPgzTAPufTC-qqxRUUkG9FUcH2SboxBQbvKZJvUpooYJMa4m/s1600/FourDegrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoFYT2zzIxhn6WqNYkT8L50vfufhsy8tOdIjjT66s6iMCBa4CB-ZwQnS4bYuIxQP69Kt34racAPxflv2wZXcoYvsIBYHZnuPgzTAPufTC-qqxRUUkG9FUcH2SboxBQbvKZJvUpooYJMa4m/s320/FourDegrees.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sunrise / sunset.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik5iBTp7PjjJ3RDZki5aQ4m5y4KKZe7VDPjeuv_6MoTDXI8heRM3XTiE9YLA1cjE7U_25Lfwhh2QZDbThBZNfZVW_FXi_phYzM94PnGjTHRUbM00WVs7_PU8B6Q8SfZm6iuKrv7ApzEqWl/s1600/Twilight.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik5iBTp7PjjJ3RDZki5aQ4m5y4KKZe7VDPjeuv_6MoTDXI8heRM3XTiE9YLA1cjE7U_25Lfwhh2QZDbThBZNfZVW_FXi_phYzM94PnGjTHRUbM00WVs7_PU8B6Q8SfZm6iuKrv7ApzEqWl/s320/Twilight.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight.</td></tr>
</tbody></table>
<br />
Note the realistic deep blue tone of the twilight images. This blue is a result of ozone absorption. Without ozone, these images would be a dull gray.<br />
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com1tag:blogger.com,1999:blog-6888287896713330574.post-76006598700398775182012-12-30T13:00:00.000-08:002013-01-31T15:24:22.226-08:00Converting Between Fisheye and EquirectangularI used Photorealizer to convert some of my recent fisheye sky renders to equirectangular (latitude–longitude) format. To give Photorealizer the capability to do this, I copied the panoramic cameras from the sky renderer to Photorealizer, and gave Photorealizer the ability to use a high dynamic range fisheye image as an environment map. Then, to do the actual conversion, I simply set up an environment map using a sky renderer render, and rendered a picture of it using the equirectangular camera (an analogous process could be used to convert from equirectangular to fisheye).<br />
<br />
I wanted to convert the fisheye images to equirectangular format because Photorealizer already supports importance sampling for equirectangular environment maps. I plan to use these images as light sources for Photorealizer renders, so being able to sample them efficiently—even when they contain the sun—is very important.<br />
<br />
Alternatively, I could have used existing software to do the conversion, but I prefer to do things myself when possible. Or I could have re-rendered the sky images in equirectangular format, but that would have taken a long time. The way I did the conversion worked very well, and it let me add features to and make improvements to Photorealizer in the process.<br />
<br />
Here are two sets of before and after images:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqMRotCJyyvTGJgAOSyrVHOUTswnQSggiWJ5gcHHyTeAHHmJuz2guZUxX7XuKViErJEUMJx-YICc8hFpuBRJSn4fu-HjNIta6sNEjNGhtD7nW-HEkg10QdxOnqyRllXN9qHkG6xvvnkzHr/s1600/FourDegreesFisheye.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqMRotCJyyvTGJgAOSyrVHOUTswnQSggiWJ5gcHHyTeAHHmJuz2guZUxX7XuKViErJEUMJx-YICc8hFpuBRJSn4fu-HjNIta6sNEjNGhtD7nW-HEkg10QdxOnqyRllXN9qHkG6xvvnkzHr/s200/FourDegreesFisheye.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Before: sunrise / sunset fisheye render.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoFYT2zzIxhn6WqNYkT8L50vfufhsy8tOdIjjT66s6iMCBa4CB-ZwQnS4bYuIxQP69Kt34racAPxflv2wZXcoYvsIBYHZnuPgzTAPufTC-qqxRUUkG9FUcH2SboxBQbvKZJvUpooYJMa4m/s1600/FourDegrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoFYT2zzIxhn6WqNYkT8L50vfufhsy8tOdIjjT66s6iMCBa4CB-ZwQnS4bYuIxQP69Kt34racAPxflv2wZXcoYvsIBYHZnuPgzTAPufTC-qqxRUUkG9FUcH2SboxBQbvKZJvUpooYJMa4m/s400/FourDegrees.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">After: converted to equirectangular format using Photorealizer.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2-c2do0VhkkwqaUkAD_7EO7PCb65Z70Gj-dhvN6bo5YFQJA2JU36EVyH1udtKIycrp843i5OuuP6oONuPLHj5pg_J9O35i_Ye46ZvHboNv7nKs9NUZ7QCkE9JSp4tLt_x2aSv722cM1mT/s1600/TwilightFisheye.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2-c2do0VhkkwqaUkAD_7EO7PCb65Z70Gj-dhvN6bo5YFQJA2JU36EVyH1udtKIycrp843i5OuuP6oONuPLHj5pg_J9O35i_Ye46ZvHboNv7nKs9NUZ7QCkE9JSp4tLt_x2aSv722cM1mT/s200/TwilightFisheye.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Before: twilight fisheye render.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik5iBTp7PjjJ3RDZki5aQ4m5y4KKZe7VDPjeuv_6MoTDXI8heRM3XTiE9YLA1cjE7U_25Lfwhh2QZDbThBZNfZVW_FXi_phYzM94PnGjTHRUbM00WVs7_PU8B6Q8SfZm6iuKrv7ApzEqWl/s1600/Twilight.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik5iBTp7PjjJ3RDZki5aQ4m5y4KKZe7VDPjeuv_6MoTDXI8heRM3XTiE9YLA1cjE7U_25Lfwhh2QZDbThBZNfZVW_FXi_phYzM94PnGjTHRUbM00WVs7_PU8B6Q8SfZm6iuKrv7ApzEqWl/s400/Twilight.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">After: converted to equirectangular format using Photorealizer.</td></tr>
</tbody></table>
<br />
<div>
I recently made some other relevant improvements to Photorealizer as well, which you can read about on my Photorealizer blog:<br />
<a href="http://photorealizer.blogspot.com/2012/12/environment-map-improvements.html">http://photorealizer.blogspot.com/2012/12/environment-map-improvements.html</a><br />
<a href="http://photorealizer.blogspot.com/2012/12/photon-mapping-with-hdr-environment-maps.html">http://photorealizer.blogspot.com/2012/12/photon-mapping-with-hdr-environment-maps.html</a></div>
<div>
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com1tag:blogger.com,1999:blog-6888287896713330574.post-78132216153812165212012-12-03T22:17:00.001-08:002012-12-07T13:51:56.668-08:00Twilight with AerosolsHere are two new twilight images that I rendered with aerosols. I haven't tone-mapped either of these images—they are display-linear. In the second image, the sun is lower, there is a lower concentration of aerosols in the atmosphere, and the ground has a desert-like reflectivity. Because the aerosol concentrations and ground reflectivities differ, the images are not directly comparable, but I believe that a few of the differences are due to factors besides the aerosols. Based on my research (including <a href="http://www.colorandlightinnature.com/">Color and Light in Nature</a> and <a href="http://journals.ametsoc.org/doi/pdf/10.1175/1520-0469(1974)031%3C1662%3ATIOOAA%3E2.0.CO%3B2">The Influence of Ozone and Aerosols on the Brightness and Color of the Twilight Sky</a>) and observations, at −4.8° I would expect a more defined twilight arch, an area of low saturation purple above the twilight arch, and more saturated blue in the zenith direction. All of these phenomena seem to be present in the −4.8° render.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1GFJxLTjdsRKtuSnFeUkRFQfYQI7HvEcryrHMHC8hYzsONKMjf2NVkA4eobjtFxL77YRVGp056wcKohaYDSu4NVht7YhMCd8UEO8TEYWEnMgdIJuJ9LLJMsliiE-A5541TXnAUXUCMTjl/s1600/TwilightWithAerosolsDoubledDarkened.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1GFJxLTjdsRKtuSnFeUkRFQfYQI7HvEcryrHMHC8hYzsONKMjf2NVkA4eobjtFxL77YRVGp056wcKohaYDSu4NVht7YhMCd8UEO8TEYWEnMgdIJuJ9LLJMsliiE-A5541TXnAUXUCMTjl/s1600/TwilightWithAerosolsDoubledDarkened.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">−3° solar elevation angle.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigrWNx3CKZimeED2vRViNb9kmpdTIwJyawpzdR2P_eQof5aj2_FO8wd8ZsUBN65WUC4DMSQ4IgGOLTwA_1JSr8rjWoaDw0vX4eu74faOaeQv5vo4hVLE6oCkKXJvuzZesxQf04FWR7KuwU/s1600/DeepTwilightWithAerosolsDoubledDarkened.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigrWNx3CKZimeED2vRViNb9kmpdTIwJyawpzdR2P_eQof5aj2_FO8wd8ZsUBN65WUC4DMSQ4IgGOLTwA_1JSr8rjWoaDw0vX4eu74faOaeQv5vo4hVLE6oCkKXJvuzZesxQf04FWR7KuwU/s1600/DeepTwilightWithAerosolsDoubledDarkened.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">−4.8° solar elevation angle. Half the amount of aerosols as in the<br />
image above.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-63012748386932293242012-11-28T01:09:00.003-08:002013-05-06T15:20:15.397-07:00ComparisonHere's a current render from my sky simulator compared with one from <a href="http://cgg.mff.cuni.cz/projects/SkylightModelling/">Hosek and Wilkie's</a> (one of the path tracer renders from their paper, scaled up to the same size as my render). I purposely matched the lens, the solar elevation angle, and the exposure, however I did not try to match the atmospheric properties, ground albedo, or tone-mapping. There are a few images in the Hosek–Wilkie paper with a solar elevation angle of 4°, and I simply chose the one that matched my render from the previous post most closely (which was the one with a turbidity of 6), then I re-exposed my (HDR) render to match the Hosek–Wilkie one as well as possible. Besides the numerous differences in the simulations themselves, there a few notable differences between these two images: Hosek and Wilkie's is tone-mapped while mine is not, mine uses a fisheye lens that extends beyond 180° to show the ground, and mine includes the solar disc. In spite of the differences, the images look remarkably similar to me. Using the lightbox, you can toggle between the two images.<br />
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Nj4vLlWfeaqI2CxzAnyfnAyC9ebzToTVgeGC0q_lBc400tfcTIDeYFyGUxQx69d7T2RUBVDwRkMxPgzgbxJnAQNLSA0CbmsbQblZrR6wIS7FMCx9NReysLm4HsH2dBaSxxSc8aSH4xWk/s1600/FourDegreesWithAerosolsDoubledDarkened.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Nj4vLlWfeaqI2CxzAnyfnAyC9ebzToTVgeGC0q_lBc400tfcTIDeYFyGUxQx69d7T2RUBVDwRkMxPgzgbxJnAQNLSA0CbmsbQblZrR6wIS7FMCx9NReysLm4HsH2dBaSxxSc8aSH4xWk/s1600/FourDegreesWithAerosolsDoubledDarkened.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">My sky simulator.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2puJkjutE-SjloPibdrLg3JKoa05AwP1ZlS6nPChvsY1_CHWi5_hZ7JyHvfP3ye5V1d466HndbzYMjgYGQI5QsN1L3ouCDfvstjik-nqSfOcMQrZApX1WERHBNSfuE0_xzUm5g6wuQZfI/s1600/HosekWilkieT6Enlarged.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2puJkjutE-SjloPibdrLg3JKoa05AwP1ZlS6nPChvsY1_CHWi5_hZ7JyHvfP3ye5V1d466HndbzYMjgYGQI5QsN1L3ouCDfvstjik-nqSfOcMQrZApX1WERHBNSfuE0_xzUm5g6wuQZfI/s1600/HosekWilkieT6Enlarged.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Hosek and Wilkie's sky simulator.</td></tr>
</tbody></table>
<div>
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-58561360244349292962012-11-27T22:33:00.000-08:002013-01-31T18:01:03.131-08:00Aerosols<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr6qqLssrLmXh8PUo_kPRId2FhowiKP2aD41XRwVe1sCmdUEjOwWu0igz9vcnacEGWZFfWg4Ri-ovVyeTt_qvdjVg0aekgkGLm_pwgT7SkulNn3xMQj0R9-jPcMCcd-WJbrdvJJrdwAOzV/s1600/FourDegreesWithAerosolsDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr6qqLssrLmXh8PUo_kPRId2FhowiKP2aD41XRwVe1sCmdUEjOwWu0igz9vcnacEGWZFfWg4Ri-ovVyeTt_qvdjVg0aekgkGLm_pwgT7SkulNn3xMQj0R9-jPcMCcd-WJbrdvJJrdwAOzV/s1600/FourDegreesWithAerosolsDoubled.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">With aerosols. Solar elevation angle 4°.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3y23PKPBDZd9PFJHPI5szGDOzExzU6SVYDoZCtYpD1qWnE8H4ww-Ldh0zl6PcseJ9EDDuappS6UxXldP_3nBmU4H6Y6oRI8y76P0TtuIn9W-VS8qNrldKmXTX62rcKY8UhEcFeyjPw-cL/s1600/FourDegreesClearDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3y23PKPBDZd9PFJHPI5szGDOzExzU6SVYDoZCtYpD1qWnE8H4ww-Ldh0zl6PcseJ9EDDuappS6UxXldP_3nBmU4H6Y6oRI8y76P0TtuIn9W-VS8qNrldKmXTX62rcKY8UhEcFeyjPw-cL/s1600/FourDegreesClearDoubled.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">No aerosols. Solar elevation angle 4°. Same exposure as the image above.</td></tr>
</tbody></table>
<br />
I made a first pass at adding <a href="http://en.wikipedia.org/wiki/Aerosol">aerosols</a> to the atmosphere. Aerosols have a significant impact on the appearance of the sky, but simulating them isn't particularly straightforward: the types and levels of aerosols vary widely by region (e.g., city vs. forest vs. ocean) and other factors, and computing their scattering properties is quite complicated.<br />
<div>
<br /></div>
<div>
I used the representative profile of aerosols in Elterman's paper <a href="http://www.dtic.mil/cgi-bin/GetTRDoc?AD=AD0671933">UV, Visible, and IR Attenuation for Altitudes to 50 km, 1968</a>. The paper provides aerosol extinction coefficients that vary based on altitude and wavelength. It's the same data used in <a href="http://journals.ametsoc.org/doi/pdf/10.1175/1520-0469(1974)031%3C1662%3ATIOOAA%3E2.0.CO%3B2">The Influence of Ozone and Aerosols on the Brightness and Color of the Twilight Sky</a>, which is what led me to the paper in the first place. I used the provided scale height relationship (scale height of 1.2 km) to extrapolate the data beyond 50 km.</div>
<div>
<br /></div>
<div>
For the scattering phase function, for now I just used the Henyey-Greenstein phase function, which I had already implemented for Photorealizer, including analytic scattering direction sampling. For now I used a constant asymmetric parameter of 0.7 (which means that the mean cosine of the scattering angle is 0.7, which implies strong forward scattering), which seems to be a pretty good average value based on my research. I plan to implement Cornette and Shanks's modified version of the Henyey-Greenstein phase function, which better approximates actual Mie scattering phase functions and converges to the Rayleigh phase function as the asymmetry parameter approaches zero.</div>
<div>
<br /></div>
<div>
I used a constant single scattering albedo of 0.9, which, like my asymmetry parameter, seems to be a pretty good average value based on my research. At the sampled extinction distance, I scatter the photon/ray with 90% probability, and absorb it with 10% probability.</div>
<div>
<br /></div>
<div>
I changed the Earth's surface to have an albedo of 31%, which seems to be the accepted average albedo of Earth's surface. At some point, I would like to make a procedural ground, or use a map of the actual Earth. Procedural mountains would be particularly nice for showing off atmospheric effects.</div>
<div>
<br /></div>
<div>
My aerosols system could be improved in many ways. In particular, I could use a realistic particle size distribution, use realistic particle type proportions (each type having a certain index of refraction, with real and imaginary parts), and then compute scattering and absorption properties using the <a href="http://en.wikipedia.org/wiki/Mie_scattering">Mie solution to Maxwell's equations</a>. That sounds like it might be overkill for now, although I'm sure I would learn a lot in the process. </div>
<div>
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-79118104719577680072012-11-21T20:29:00.000-08:002012-11-29T13:58:52.129-08:00Unbiased Distance SamplingI implemented an algorithm for unbiased distance sampling in heterogeneous media, which replaces the biased ray marching in my sky renderer. It's a Monte Carlo algorithm, "Algorithm 1" in the paper <a href="http://www.uni-ulm.de/fileadmin/website_uni_ulm/iui.inst.100/institut/Papers/ugiwpm.pdf">Unbiased Global Illumination with Participating Media</a>. I learned about that paper from <a href="http://cgg.mff.cuni.cz/projects/SkylightModelling/">Hosek and Wilkie's sky model paper</a>. The algorithm originates from a <a href="http://www.osti.gov/energycitations/product.biblio.jsp?osti_id=4537557">1968 paper by Coleman</a>, which I'm interested in looking at, but which I haven't been able to locate.<br />
<br />
The algorithm samples a random distance based on the highest extinction (or scattering or absorption) coefficient along the ray (or line segment in my case), or any coefficient greater than or equal to that (such as the highest in the entire medium, which is often easier to find). Then it probabilistically takes another leap based on the actual coefficient at the sampled location.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN6Xc5bPMH0H6iqhfAm1qcW33uGjI-tMZCNLfQ0crRTmPOEMO8XZ_y_PdncPziBTe9wj8GRD7Ju-IzGF6c2wFLwkZ03xAsey2vjTqW2BnbH5EwL2qudtjPm0mFmjLTLIbSiO3zpZ0aOkYz/s1600/UnbiasedDistanceSamplingAlgorithm.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="166" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN6Xc5bPMH0H6iqhfAm1qcW33uGjI-tMZCNLfQ0crRTmPOEMO8XZ_y_PdncPziBTe9wj8GRD7Ju-IzGF6c2wFLwkZ03xAsey2vjTqW2BnbH5EwL2qudtjPm0mFmjLTLIbSiO3zpZ0aOkYz/s400/UnbiasedDistanceSamplingAlgorithm.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Algorithm from <a href="http://www.uni-ulm.de/fileadmin/website_uni_ulm/iui.inst.100/institut/Papers/ugiwpm.pdf">Unbiased Global Illumination with Participating Media</a>.</td></tr>
</tbody></table>
<br />
Using the lowest max coefficient allows larger steps to be taken, which decreases the number of steps needed and increases performance. Since Rayleigh and ozone scattering and absorption coefficients vary predictably based on wavelength, the lowest max coefficient can be found for given wavelength, and with Rayleigh scattering, the lowest coefficient along the line segment can be found by using the coefficient at the point on the line segment that is closest to the center of the Earth (assuming density is monotonically decreasing with altitude).<br />
<br />
After implementing this algorithm and the related optimizations, not only are my renders unbiased, but they are also 5 to 10 times faster—a pretty huge speed increase.<br />
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com1tag:blogger.com,1999:blog-6888287896713330574.post-91444802639555999962012-11-18T14:14:00.000-08:002012-11-20T16:13:52.477-08:00Earth from Space<div>
Because I'm performing a brute force atmospheric simulation, I'm able to render the atmosphere from any point of view. After a few tweaks, I'm now able to render images from outside the atmosphere. Here are a few images that show what the Earth looks like from space. The planet's surface is currently an 18% gray Lambertian diffuse reflector.</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9OqOCexp9Zkm4JHNSbqOm5rReoxhqg8A4vtS4t_Ec5eaAP-TMGWLFwcA14JYUScOcUg8vsmRr03OcrN0uL1ILTY-1A7u2nyIGw-llvP4sJDDdAqPddnORxHixDhsLBIzTdtctOLrBOTaq/s1600/FromSpaceDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="75" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9OqOCexp9Zkm4JHNSbqOm5rReoxhqg8A4vtS4t_Ec5eaAP-TMGWLFwcA14JYUScOcUg8vsmRr03OcrN0uL1ILTY-1A7u2nyIGw-llvP4sJDDdAqPddnORxHixDhsLBIzTdtctOLrBOTaq/s400/FromSpaceDoubled.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The planet as seen from 200 km up.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9GhTGwFjhbNeDJ0HG8Yf_N_jIgskPs4tMEqhXwktMNUicUP_q2UW2hzQoZhaiIjq2KmZ91mKlhw9gy1q45enAdP_qIMWUI7_SmNj7aZs7Pyqbj60kiVI-uTFgFFfJ3dbJrUlugOCzGNN0/s1600/FromSpaceNoAtmosphere.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="75" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9GhTGwFjhbNeDJ0HG8Yf_N_jIgskPs4tMEqhXwktMNUicUP_q2UW2hzQoZhaiIjq2KmZ91mKlhw9gy1q45enAdP_qIMWUI7_SmNj7aZs7Pyqbj60kiVI-uTFgFFfJ3dbJrUlugOCzGNN0/s400/FromSpaceNoAtmosphere.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Same view as above, but with no atmosphere.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy6zZJhFdHhGhSEKUgpB7McKmt-2d7IomiPYtQnGJUx7txgjmAy8MLhPPAdXuxyx6Bg4sDmtSxefNv9oQKRCNPNVbvAJ0zfJWWGcLYHhWttJgnaSPzEijSMUiMfOL0sUpUpd5inb-kz7bl/s1600/SunBelowHorizonFromSpaceDoubled.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="56" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy6zZJhFdHhGhSEKUgpB7McKmt-2d7IomiPYtQnGJUx7txgjmAy8MLhPPAdXuxyx6Bg4sDmtSxefNv9oQKRCNPNVbvAJ0zfJWWGcLYHhWttJgnaSPzEijSMUiMfOL0sUpUpd5inb-kz7bl/s400/SunBelowHorizonFromSpaceDoubled.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A different view. Also 200 km up. Sun right below the horizon.</td></tr>
</tbody></table>
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com2tag:blogger.com,1999:blog-6888287896713330574.post-1035691169299321312012-11-17T21:30:00.000-08:002012-11-18T21:21:02.828-08:00Adaptive Step SizeTo increase accuracy and significantly decrease simulation times, I made the ray marching step size vary based on a few heuristics: the rate of change of the altitude at the current location, the altitude of the current location, and an element of randomness.<br />
<br />
The first heuristic, the rate of change of the altitude, has the biggest impact on the step size. When a short line segment is nearly parallel to the ground, the altitude doesn't varying much along the segment, which means that the density and other properties of the air also don't vary much along the segment. So if we're travelling parallel to the ground we can take much larger step sizes than if we're travelling perpendicular to the ground. When we're travelling up and down, the atmospheric properties change much more quickly and we need to smaller step sizes to accurately capture the changes and details of atmospheric properties.<br />
<br />
These are all just a temporary improvements because I just realized that I could replace ray marching with an unbiased technique, which should also be cleaner and faster. I'll write more about this later, after I implement it.<br />
<br />
If I were to stick with ray marching, I would want to additionally vary the step sizes based on wavelength and other factors, and I would want to take different step sizes when computing different types of scattering and absorption.<br />
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-27315521693600619262012-11-04T16:53:00.002-08:002012-11-05T15:12:49.589-08:00Twilight FisheyeHere's a new angular fisheye render taken at twilight (solar elevation angle −3°) in which you can clearly see the twilight arch, the anti-twilight arch, and the Earth shadow.<br />
<br />
To produce the image below, I first took advantage of the symmetry of the render to effectively double the number of samples, using Photoshop to duplicate the high-dynamic range EXR image, flip it horizontally, and composite it onto the original. Then I used Photomatix to tone-map the processed image. The solar (top) side is much brighter than the anti-solar (bottom) side, so without tone-mapping it wouldn't be possible to expose the entire sky nicely at one time—part of the image would be overexposed or part would be underexposed. The tone-mapped image is over-saturated and the relative intensities of different parts of the sky are not accurate, but you can see the entire sky and you can see the colors clearly.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8nLHHQeAjzJsEJOBa0XDhc_AAgyHjJrm8oasSVEZRklkCBa54-SjMOjdytbftHLwCiNSX1Py4vJb3mYp3M_u8TYYT2w_G91ll35a0CRvZFrJnqm2sF2QNvGuDiCRRlt8wRqMCkFpRpV6-/s1600/TwilightFisheyeDoubledTonemapped.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8nLHHQeAjzJsEJOBa0XDhc_AAgyHjJrm8oasSVEZRklkCBa54-SjMOjdytbftHLwCiNSX1Py4vJb3mYp3M_u8TYYT2w_G91ll35a0CRvZFrJnqm2sF2QNvGuDiCRRlt8wRqMCkFpRpV6-/s1600/TwilightFisheyeDoubledTonemapped.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight, tone-mapped.</td></tr>
</tbody></table>
<br />
And below is the PNG that came directly out of my renderer. I applied a mild S-shaped transfer curve before writing to PNG.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnZ5vC-5wZkJxkFlU4Xy3xz_HZQ3OcaaHMtTgLV9g9nXxRa9M4Jbi0QFIt3ZRzIpPyA3zFEaF2twjJMsk_llmX4Dv9OB0yRrvWwX6XnIt6liA8hOTXBap473EhIzPAE3GEWaoq1o0JSi10/s1600/TwilightFisheye.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnZ5vC-5wZkJxkFlU4Xy3xz_HZQ3OcaaHMtTgLV9g9nXxRa9M4Jbi0QFIt3ZRzIpPyA3zFEaF2twjJMsk_llmX4Dv9OB0yRrvWwX6XnIt6liA8hOTXBap473EhIzPAE3GEWaoq1o0JSi10/s1600/TwilightFisheye.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight, directly from my renderer.</td></tr>
</tbody></table>
<br />
The sky was clear this evening in Philadelphia and I was able to see the Earth shadow. The colors in the real sky closely resembled those in this render.<br />
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-12385948426284301962012-10-31T14:21:00.000-07:002012-11-06T05:51:55.445-08:00New Panorama CamerasI made two cool new cameras that allow the entire sky to be viewed in a single image.<br />
<br />
The first uses <a href="http://gl.ict.usc.edu/Data/HighResProbes/">latitude-longitude panoramic format</a>, also known as an <a href="http://en.wikipedia.org/wiki/Equirectangular_projection">equirectangular mapping</a>. This is the same format that I use for HDR environment maps in <a href="http://photorealizer.com/">Photorealizer</a>, and my sky renderer already saves images to EXR (in addition to PNG), so I will be able to use my sky renderer renders as HDR environment maps for my Photorealizer renders. Plus, I have HDR environment map importance sampling in Photorealizer, so I can leave the tiny, bright, influential sun in the sky images and Photorealizer will automatically know to heavily sample the sun.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0H4LILGKRYC_ippDcvk5hA74OXOQPWQlPEoyqBCv9w0rZKzbwIB39S1jehjjQYuvLqr3wN9_tJl6qmV5N2SrW8gTkTfyhahiERTg0MBH1_MPuvmXv49vjvnLgfGg3g5rLbgklJZcc9AlX/s1600/FirstLatLong.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0H4LILGKRYC_ippDcvk5hA74OXOQPWQlPEoyqBCv9w0rZKzbwIB39S1jehjjQYuvLqr3wN9_tJl6qmV5N2SrW8gTkTfyhahiERTg0MBH1_MPuvmXv49vjvnLgfGg3g5rLbgklJZcc9AlX/s1600/FirstLatLong.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Equirectangular projection.</td></tr>
</tbody></table>
<br />
The second new camera uses an <a href="http://paulbourke.net/dome/fisheye/">angular fisheye projection</a>. This is a pretty intuitive way to view the entire sky (and part of the ground in my implementation). This kind of picture can be captured in real life in a single shot with a fisheye lens. Real fisheye lenses are pretty advanced. <a href="http://www.pierretoscani.com/echo_fisheyes_english.html">Here</a> is a site that shows how a real fisheye lens works, with nice diagrams of the fancy optics.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHMgBa14rGnQMmimWKktn3147KQ_pysKfk8VQ6zOP7BeerQAB7KVGWs-G4XY25zakWa7YkQBehTWhmKVktEzpC7lg8vZ8eCPlGJ3PcJGaIAN91uK70bizYEymfGlNRKoScPnK3Ca2w9KYM/s1600/FirstFisheye.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHMgBa14rGnQMmimWKktn3147KQ_pysKfk8VQ6zOP7BeerQAB7KVGWs-G4XY25zakWa7YkQBehTWhmKVktEzpC7lg8vZ8eCPlGJ3PcJGaIAN91uK70bizYEymfGlNRKoScPnK3Ca2w9KYM/s1600/FirstFisheye.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Angular fisheye projection.</td></tr>
</tbody></table>
<br />
<br />
The environment is identical in both images above. The solar elevation angle is 10°. I think that the two bright peaks above the horizon in the solar and anti-solar directions are due to the forward and backward peaks of the Rayleigh scattering phase function.<br />
<div>
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com1tag:blogger.com,1999:blog-6888287896713330574.post-87653412155387198642012-10-23T21:59:00.000-07:002013-05-06T12:22:07.810-07:00Vertical Distribution of OzoneI noticed that the sky right above the horizon seemed too blue after I implemented ozone absorption. I realized that since the most Rayleigh scattering happens in the low, dense part of the atmosphere near the ground, scattered light would be passing through too much ozone if the concentration were too high at these altitudes. I also thought more generally about the geometry of the atmosphere and the differing amounts of ozone that light would pass through based on the distribution of the ozone. I had made the ozone concentration a constant value of 0.6 parts per million, which had made the total ozone amount correct, but it had also made the amount near the ground far too high, and the amount higher in the atmosphere far too low. That amount of ozone at ground level would be dangerous to your health. In reality, most of the ozone in the atmosphere is found in the ozone layer in the stratosphere. The ozone layer is responsible for absorbing most of the sun's harmful UV rays.<br />
<br />
To improve my results, I implemented a realistic distribution of ozone. Average data for the Earth's atmosphere was difficult to find, and the exact distribution of ozone is pretty variable anyway, so I read data from the NASA graph below, and made a few tweaks based on other information I had found (namely, lowering the concentration in the troposphere, and weighting the data up to make the total concentration closer to 0.6 ppm). I might want to tweak or replace the data in the future, but it's already much more accurate than the constant value I was using before.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLPCf1nn7F9gx3BsQLrRDcK9QdRpIFS0Oa_zjuCEOVDLCouq9hj0RrrrAUqn5XGhrYsHJexvicJpWW7gq6WsA5oLma0J5wAJJDczl4jCf3Q0XUya1tLQprjiKPTSke8lDDx7GFqDwFUkwX/s1600/ozone_concentration_graph.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLPCf1nn7F9gx3BsQLrRDcK9QdRpIFS0Oa_zjuCEOVDLCouq9hj0RrrrAUqn5XGhrYsHJexvicJpWW7gq6WsA5oLma0J5wAJJDczl4jCf3Q0XUya1tLQprjiKPTSke8lDDx7GFqDwFUkwX/s400/ozone_concentration_graph.gif" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ozone concentration in the atmosphere. Image from <a href="http://ozonewatch.gsfc.nasa.gov/facts/ozone.html">NASA</a>.</td></tr>
</tbody></table>
<br />
Below is a new render, and some old ones for comparison. In the new render, compared to the old ozone render, the sky around the zenith is bluer, and the the color and brightness near the horizon is more accurate.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjApHw6OqTVvCaxKbCjJVBgMK8gRM6uAdRxutUPVMn7RXO3fmmaubcWP9CKQvwYkgO4QSBh3FRTGp_MlpwH03AWB8tyHw7DheweGcuF5zd0ZdEJG5H1MsJHgTbrH3xYyvEM0V_4GS7enqH/s1600/OzoneLayer1Degree.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjApHw6OqTVvCaxKbCjJVBgMK8gRM6uAdRxutUPVMn7RXO3fmmaubcWP9CKQvwYkgO4QSBh3FRTGp_MlpwH03AWB8tyHw7DheweGcuF5zd0ZdEJG5H1MsJHgTbrH3xYyvEM0V_4GS7enqH/s1600/OzoneLayer1Degree.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ozone with realistic vertical concentration profile.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQqM7CV8Z6ctcWp2qs1ulojqI4GcnaQw1MlkRtSV5XvJYgiQAnrjShFA0Yvh_RnwCmoAcctCAFF_mRzzD0ej0iGk4MKylxm0kNJPd-fS4eu6NnqRjfPBZL6Oz_VFg64GYUkojhg4miwdzl/s1600/AfterOzone1Degree.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQqM7CV8Z6ctcWp2qs1ulojqI4GcnaQw1MlkRtSV5XvJYgiQAnrjShFA0Yvh_RnwCmoAcctCAFF_mRzzD0ej0iGk4MKylxm0kNJPd-fS4eu6NnqRjfPBZL6Oz_VFg64GYUkojhg4miwdzl/s1600/AfterOzone1Degree.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ozone with uniform concentration throughout the atmosphere.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7YnnyXlwG99YEOxgJ7OkjZ-ZwwHbSuxWNvaOj1hSiO4CeBvA3LFI8XS9m15tN8aezJ1JL6LHQpaa3iOCpnTTbaCI4Z99ioql6EOikUG3SIcM5eyAyFXJAflY2JkBac-1TjmH4eZ_grQFj/s1600/BeforeOzone1Degree.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7YnnyXlwG99YEOxgJ7OkjZ-ZwwHbSuxWNvaOj1hSiO4CeBvA3LFI8XS9m15tN8aezJ1JL6LHQpaa3iOCpnTTbaCI4Z99ioql6EOikUG3SIcM5eyAyFXJAflY2JkBac-1TjmH4eZ_grQFj/s1600/BeforeOzone1Degree.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">No ozone.</td></tr>
</tbody></table>
<br />
Here's another new render, this one taken during twilight in the direction of the sun, with the sun −3° below the horizon:<br />
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoVa0gW5OEeUXLKdKzErUrvp4JYfOTEsoY9PLqQ5vzePUZjO1wdG4_ugoyHXw2CCADeajn1BXJNCeNlCCcyXb6NfPcdrFXg8PSrc2t0PMrRxAF_KhTvCdRfyJs3w7I-iHdiL9MvK-Zx-sl/s1600/Twilight-3Degrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoVa0gW5OEeUXLKdKzErUrvp4JYfOTEsoY9PLqQ5vzePUZjO1wdG4_ugoyHXw2CCADeajn1BXJNCeNlCCcyXb6NfPcdrFXg8PSrc2t0PMrRxAF_KhTvCdRfyJs3w7I-iHdiL9MvK-Zx-sl/s1600/Twilight-3Degrees.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight + ozone.</td></tr>
</tbody></table>
<div>
<br />
By the way, ozone absorption should make the color of the Earth shadow at twilight more accurate (darker and bluer), so I'm looking forward to rendering some shots that illustrate that.<br />
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-24801727870485461212012-10-19T22:55:00.000-07:002013-01-31T16:35:45.810-08:00Ozone AbsorptionA couple weeks ago, I noticed that, in my sunset and twilight renders, towards the zenith, the sky looked fairly gray, while in real life it looks fairly blue. I realized that implementing the actual solar spectral irradiance would make the sky appear slightly bluer, but I didn't expect the effect to be strong enough to explain the discrepancy between my images and real life. Then I stumbled across something very interesting on <a href="http://en.wikipedia.org/wiki/Sunlight">Wikipedia</a>:<br />
<blockquote class="tr_bq">
According to Craig Bohren, "preferential absorption of sunlight by ozone over long horizon paths gives the zenith sky its blueness when the sun is near the horizon".</blockquote>
I proceeded to check the referenced <a href="http://homepages.wmich.edu/~korista/atmospheric_optics.pdf">Craig Bohren paper</a>, where the statement was explained in more detail. In particular, the Chappuis absorption band of ozone, "which extends from about 450 to 750 nm and peaks at around 600 nm", is responsible for absorbing light of longer wavelengths in the visible spectrum, thus making the sky appear more blue. He also said that<br />
<blockquote class="tr_bq">
In the absence of molecular absorption, the spectrum of the zenith sky would be essentially that of the zenith sun (although greatly reduced in radiance)</blockquote>
Bohren referenced a 1953 paper by Hulbert, who originally pointed out this explanation of this blueness: <a href="http://www.opticsinfobase.org/josa/abstract.cfm?uri=josa-43-2-113">Explanation of the Brightness and Color of the Sky, Particularly the Twilight Sky</a>. Here's an excerpt from the abstract of that paper:<br />
<blockquote class="tr_bq">
Calculation showed that during the day the clear sky is blue according to Rayleigh, and that ozone has little effect on the color of the daylight sky. But near sunset and throughout twilight ozone affects the sky color profoundly. For example, in the absence of ozone the zenith sky would be a grayish green-blue at sunset becoming yellowish in twilight, but with ozone the zenith sky is blue at sunset and throughout twilight (as is observed), the blue at sunset being due about 1/3 to Rayleigh and 2/3 to ozone, and during twilight wholly to ozone.</blockquote>
I also found a paper from 1973, <a href="http://journals.ametsoc.org/doi/pdf/10.1175/1520-0469(1974)031%3C1662%3ATIOOAA%3E2.0.CO%3B2">The Influence of Ozone and Aerosols on the Brightness and Color of the Twilight Sky</a>, that confirms the effect of ozone on the color of the twilight sky using computer simulations.<br />
<br />
I decided that I needed to include ozone absorption in my sky renderer, so I searched around for spectral ozone absorption data, and eventually came across recent (2011), high-precision, absorption cross-section measurements <a href="http://www.iup.physik.uni-bremen.de/gruppen/molspec/databases/referencespectra/o3spectra2011/index.html">here</a>. The data is provided in 0.01 nanometer increments, which is way too precise for my purposes, so I wrote some code to convert the data to 5 nanometer increments, averaging 500 data points to create each new data point. The data is provided for 11 different temperatures. They're similar enough that I probably could have just used one, or averaged them all together, but I decided to use all of them anyway. When a query is made, I just look up the data at the closest temperature and wavelength—I decided that interpolation was probably overkill in this case.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSXA9_0akEz7JXCshVL_ebaCkfR8xudln4k40QTKja4tCMGG-5REz6857aGMiXXUDl5fEky8PLwuYNvJ9UWfgE-qm0EUHuIszAgjxnucf24lmgPKbpqG-cBERKoYfNApJ08mxC9j2wHtCD/s1600/allchannels.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="282" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSXA9_0akEz7JXCshVL_ebaCkfR8xudln4k40QTKja4tCMGG-5REz6857aGMiXXUDl5fEky8PLwuYNvJ9UWfgE-qm0EUHuIszAgjxnucf24lmgPKbpqG-cBERKoYfNApJ08mxC9j2wHtCD/s400/allchannels.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ozone absorption cross-sections. Image from <a href="http://www.iup.physik.uni-bremen.de/gruppen/molspec/databases/referencespectra/o3spectra2011/">IUP</a>.</td></tr>
</tbody></table>
<br />
To convert the <a href="http://en.wikipedia.org/wiki/Absorption_cross_section">absorption cross-sections</a> (units of cm^2/molecule) to absorption coefficients (units of cm^-1), I multiply by the molecular number density of standard air (units of molecules/cm^3), multiply by the concentration of ozone in the atmosphere (unitless), and then correct for altitude by multiplying by the relative density (unitless) at the altitude in question. The concentration of ozone varies a lot with altitude, but I just used the overall concentration, which is around <a href="http://ozonewatch.gsfc.nasa.gov/facts/ozone.html">0.00006%</a> (I wonder to what extent a more realistic distribution would affect my results). I packaged all of this up in a new Ozone class.<br />
<br />
Below are some new renders with and without ozone absorption. These images are taken during twilight, looking straight up along the zenith.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG4vwsCTCqk6fmHRSKtIXmPntt0waKUXrcQyQIoA4TIe9M8eaxvKhtLUWAQI2YiKdr4pOdVXVUQM7nkyr9w89A4mcSQSpRik0OjfKIytvjnJHukb32B-BY0eoTnMOJUQ-2BAQXCJfo_y3A/s1600/ZenithAfterOzone-5Degrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG4vwsCTCqk6fmHRSKtIXmPntt0waKUXrcQyQIoA4TIe9M8eaxvKhtLUWAQI2YiKdr4pOdVXVUQM7nkyr9w89A4mcSQSpRik0OjfKIytvjnJHukb32B-BY0eoTnMOJUQ-2BAQXCJfo_y3A/s200/ZenithAfterOzone-5Degrees.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight zenith sky with ozone.<br />
Solar elevation angle: −5°.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHEjzLvZ6AmKEZBSKqeKxT-75rsNOoBvEVZqrZ2zghC0bLGXnr_urDEagTikpqo7dNiHFUBvYMaGzm05u_e1cfoEZMGxbkvLrT3ERGvy0FE9Y314xx0nbf5iDGJ2E068l_zUR2hmiCKoMP/s1600/ZenithBeforeOzone-5Degrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHEjzLvZ6AmKEZBSKqeKxT-75rsNOoBvEVZqrZ2zghC0bLGXnr_urDEagTikpqo7dNiHFUBvYMaGzm05u_e1cfoEZMGxbkvLrT3ERGvy0FE9Y314xx0nbf5iDGJ2E068l_zUR2hmiCKoMP/s200/ZenithBeforeOzone-5Degrees.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight zenith sky without ozone.<br />
Solar elevation angle: −5°.</td></tr>
</tbody></table>
<br />
Below are some more new renders (all with the same exposure) that show the effect of ozone absorption on the color of the sky. The previously intense orange at sunset is now much more subdued. The orange should become somewhat more saturated when I add aerosols to the atmosphere—an effect described in <a href="http://journals.ametsoc.org/doi/pdf/10.1175/1520-0469(1974)031%3C1662%3ATIOOAA%3E2.0.CO%3B2">The Influence of Ozone and Aerosols on the Brightness and Color of the Twilight Sky</a> and in <a href="http://www.colorandlightinnature.com/">Color and Light in Nature</a>.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgliD1Edbq6vEmbPKJ85V-dpuA5icooWKuOAMwMnXZLy92xv6hvhAsCYtHdlR4ypftyWkKm4lIe9mWnuwJ7tLysguwu4mEup6pQGw14IVR-eN-Z01jpbpf5dGFd1FIVl_EiBXkiRnlBqfNy/s1600/AfterOzone1Degree.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgliD1Edbq6vEmbPKJ85V-dpuA5icooWKuOAMwMnXZLy92xv6hvhAsCYtHdlR4ypftyWkKm4lIe9mWnuwJ7tLysguwu4mEup6pQGw14IVR-eN-Z01jpbpf5dGFd1FIVl_EiBXkiRnlBqfNy/s1600/AfterOzone1Degree.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">With ozone.<br />
Solar elevation angle: 1°.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoBK3-VouHEoNfXemNCmwoiUzG390K0Ov2dDVZiYjXL99t8J4_HZakar-6veER2Kh6OwMQk6Wphm2LU3eXOS3mlCebKSUEEtm3Vz5l0m-Ax2XDny-2ltSC-obxd1Z8EG3q9VWBAIdopQ2J/s1600/BeforeOzone1Degree.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoBK3-VouHEoNfXemNCmwoiUzG390K0Ov2dDVZiYjXL99t8J4_HZakar-6veER2Kh6OwMQk6Wphm2LU3eXOS3mlCebKSUEEtm3Vz5l0m-Ax2XDny-2ltSC-obxd1Z8EG3q9VWBAIdopQ2J/s1600/BeforeOzone1Degree.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Without ozone.<br />
Solar elevation angle: 1°.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOPs9g_6hoezc5vgE5HXRlAth_Lgqi3t7zK3wrb0RFeOy5c27RZhsCjCdZZTnj4AsN8CFqAUbTEswen4yZTO1y7c_kRm3wS0oxJ9P36NKySu8GLWuEkN45pp_rAY0Y_DL-2INdEFbOCPZI/s1600/AfterOzone30Degrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOPs9g_6hoezc5vgE5HXRlAth_Lgqi3t7zK3wrb0RFeOy5c27RZhsCjCdZZTnj4AsN8CFqAUbTEswen4yZTO1y7c_kRm3wS0oxJ9P36NKySu8GLWuEkN45pp_rAY0Y_DL-2INdEFbOCPZI/s1600/AfterOzone30Degrees.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">With ozone.<br />
Solar elevation angle: 30°.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHPEgPX5VdYYGFqsTTygV7i4v7JtVDdnuEpNLXhz3ZR56kRRamtgcprL_NYy0VZ7Q_7EYV49Vx4QsUCLeTCIyrhSO2FLbW1fKYShASFFPgbnEd9LbTlPBuNSIFE16kvZbDWdDbsoLC2HzF/s1600/BeforeOzone30Degrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHPEgPX5VdYYGFqsTTygV7i4v7JtVDdnuEpNLXhz3ZR56kRRamtgcprL_NYy0VZ7Q_7EYV49Vx4QsUCLeTCIyrhSO2FLbW1fKYShASFFPgbnEd9LbTlPBuNSIFE16kvZbDWdDbsoLC2HzF/s1600/BeforeOzone30Degrees.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Without ozone.<br />
Solar elevation angle: 30°.</td></tr>
</tbody></table>
<br />
I'm pretty excited about these results. I think it's very interesting that Rayleigh scattering alone does not explain the blueness of the sky. According to <a href="http://www.agu.org/pubs/crossref/1968/JB073i022p06897.shtml">The Effect of Stratospheric Dust on the Color of the Twilight Sky</a>, adding dust will increase the blueness of the twilight sky even more. I wonder whether implementing absorption by other gases would have any other noticeable effects on my results.<br />
<br />
By the way, as far as I know, the existing sky simulations and analytic sky models in computer graphics do not consider the effects of ozone absorption.<br />
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-21487036724088184962012-10-13T18:55:00.000-07:002012-10-13T23:07:52.592-07:00Spectral Solar Irradiance<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBucaGa1dNLvN4SQFTP9ApTcIxs-8ftwSceJdOQ6v6x67df56Dkf_8Gsu8wawvxacYz4-i87YTZ35WPeMWANBnupYFgQWSmrJ7i0fFkpLuSrHoHK3LOi0Q_BrK5kai0a2LsL95XE5CfqS_/s1600/Solar_Spectrum.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBucaGa1dNLvN4SQFTP9ApTcIxs-8ftwSceJdOQ6v6x67df56Dkf_8Gsu8wawvxacYz4-i87YTZ35WPeMWANBnupYFgQWSmrJ7i0fFkpLuSrHoHK3LOi0Q_BrK5kai0a2LsL95XE5CfqS_/s400/Solar_Spectrum.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://www.globalwarmingart.com/wiki/File:Solar_Spectrum_png">Image created by Robert A. Rohde / Global Warming Art</a></td></tr>
</tbody></table>
<br />
I implemented the spectral irradiance of the sun based on modern AM0 data. AM0 (Air Mass Zero) means that the data is for sunlight that hasn't passed through any atmosphere, which is what I needed because I am simulating the atmosphere myself. This extraterrestrial spectral solar irradiance data is often used for space applications. <a href="http://rredc.nrel.gov/solar/spectra/am1.5/">AM1.5</a> data is also available, for ground level applications such as solar energy. I found the data on <a href="http://rredc.nrel.gov/solar/spectra/am0/special.html">NREL's website</a>, and it originally came from a <a href="http://www.sciencedirect.com/science/article/pii/S0038092X03003967">2003 paper by Guemard</a>. In my renderer I convert irradiance to radiance instead of using the data directly. Previously, I was using a constant value for the sun's energy, uniform across the spectrum. I could have alternatively used a black body radiation curve to approximate the spectral irradiance, however spectral solar irradiance does not exactly follow a black body radiation curve.<br />
<br />
Here are some renders comparing the new and old solar spectra. To clearly see the differences, you can click an image to bring it up in the lightbox, then you can then switch between images. One of the most noticeable differences is that the new images are bluer.<br />
<div>
<div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxQWTPEgB4mdn7jVwQQVKFCLpRlPow-heX9FP6U1ES22kyeodiFESLN8hPTd492ttoRAbplnu3kyReHqIb1jl9fEOx-v8suRuf9DUAFwIkyCVPqTmXgHar-Q_lBzDCPj3fwQgXJgEfl3lV/s1600/SSI30Degrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxQWTPEgB4mdn7jVwQQVKFCLpRlPow-heX9FP6U1ES22kyeodiFESLN8hPTd492ttoRAbplnu3kyReHqIb1jl9fEOx-v8suRuf9DUAFwIkyCVPqTmXgHar-Q_lBzDCPj3fwQgXJgEfl3lV/s1600/SSI30Degrees.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxGT8Ns3WVOJ0p6kF0rNMZTvYcWHt9ZBqeNwU4BAubF3hdThb2Q1xSwTmlpVfRW5DWliubIzSdGEX8xWAFwvZC2owY6jftcLeS6Hd6QR_zIZ9iEGZgz_qbySttOCXdKn0HOL5cvdacN4f3/s1600/Uniform30Degrees.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxGT8Ns3WVOJ0p6kF0rNMZTvYcWHt9ZBqeNwU4BAubF3hdThb2Q1xSwTmlpVfRW5DWliubIzSdGEX8xWAFwvZC2owY6jftcLeS6Hd6QR_zIZ9iEGZgz_qbySttOCXdKn0HOL5cvdacN4f3/s1600/Uniform30Degrees.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Old.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEichp6Okfw_vstur1xYNZdsIJEN2XJJCj4uzZ4KzNaFsVT4Z0wiQkMirLGckcwd116u0NNjd_EPFbJL0Vn2XjNS6IDdJtpmOGsvmfMWfBmcnQoEHgtyI4Oa2VwQva0itN_1YuC2abT-IPfE/s1600/SSISunset.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEichp6Okfw_vstur1xYNZdsIJEN2XJJCj4uzZ4KzNaFsVT4Z0wiQkMirLGckcwd116u0NNjd_EPFbJL0Vn2XjNS6IDdJtpmOGsvmfMWfBmcnQoEHgtyI4Oa2VwQva0itN_1YuC2abT-IPfE/s1600/SSISunset.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs3KgTcu0GTcEfg2aEic07mEDi_BhqD40SfZjEkWcR1sYmbl-G_t1ld3ANr_x6YCf7ps1kSMptd1aC_Uu-m8cu2qbm4N7f9S1QgZdiGmgrA4MuI4Oxo-t76SDjeOZtJNWOUxmF4gFNSdov/s1600/UniformSunset.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs3KgTcu0GTcEfg2aEic07mEDi_BhqD40SfZjEkWcR1sYmbl-G_t1ld3ANr_x6YCf7ps1kSMptd1aC_Uu-m8cu2qbm4N7f9S1QgZdiGmgrA4MuI4Oxo-t76SDjeOZtJNWOUxmF4gFNSdov/s1600/UniformSunset.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Old.</td></tr>
</tbody></table>
<br />
<div>
<div>
To use the spectral solar irradiance data, I wrote a LookupTable class with a custom binary search and linear interpolation, and then made a SpectralSolarIrradiance subclass with an array of wavelength keys and spectral irradiance values. I made another subclass of LookupTable called RayleighScatteringDepolarizationFactor to store the depolarization factor data for Rayleigh scattering. I could also make my CIEXYZColorMatchingFunctions class extend the LookupTable superclass, however it currently uses optimized code that I wrote specifically for data given in uniform increments. I will probably also use the LookupTable class for ozone absorption data. Ozone absorption is an important factor that I will write about in a future post. I also now have new classes for USStandardAtmosphere1976, RayleighScattering, which I didn't write right away just because the code was in a lot of flux. I'll post more information about the structure of my code another time.</div>
</div>
</div>
</div>
<div>
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-75738659735266540172012-10-08T16:22:00.000-07:002012-10-22T20:55:17.507-07:00Shadow of the EarthWhen flying from San Francisco to Los Angeles this summer, we took off right before sunset, and I was lucky enough to have a window seat. As we emerged from the clouds into the clear sky above, I had a brief but amazing view of the bright orange sun shining and scattering through the clouds. I was on the left side of the plane, so as we turned to the south, the view of the sun went away, but the sun set soon anyway.<br />
<br />
What I saw after the sun had set was really remarkable. The sky was very clear, and above the horizon I started noticing an expansive dark area with a pretty sharp edge, gradually consuming the sky. I soon realized that what I was seeing was the shadow of the Earth in the atmosphere. Inside the shadow, the sun had already set, but in the brighter area above the shadow, the sun would have still been directly visible.<br />
<br />
I am able to replicate this effect in my sky renderer.<br />
<br />
Here's a render at twilight, from the ground, facing away from the sun. You can clearly see the <a href="http://en.wikipedia.org/wiki/Earth's_shadow">shadow of the Earth</a> in the lower part of the image above the horizon (the ground is the sharp, rectangular, solid-colored area at the bottom). You can even see the <a href="http://en.wikipedia.org/wiki/Belt_of_Venus">anti-twilight arch</a>!<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs_fLkWv5lIN1VUnPWFcGz5UcEdEMrWAiqEyMsLx-KCUzX2iuwvZqSX7RjyRVLGI5gon5-XwNicOZOGexQtNN50s9eOKRSNrCfyaaWlN2eiya7vEunck4g1hgP4nFOP6y3s2SiOV5ucLD7/s1600/CIEXYZDuskShadowOfTheEarth.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs_fLkWv5lIN1VUnPWFcGz5UcEdEMrWAiqEyMsLx-KCUzX2iuwvZqSX7RjyRVLGI5gon5-XwNicOZOGexQtNN50s9eOKRSNrCfyaaWlN2eiya7vEunck4g1hgP4nFOP6y3s2SiOV5ucLD7/s1600/CIEXYZDuskShadowOfTheEarth.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight, facing<br />
away from sun.</td></tr>
</tbody></table>
<br />
<div>
And below is my earlier twilight render, looking in the direction of the sun, for comparison. The exposure on this image is three stops lower than the shadow image above. I raised the exposure on the image above because the sky was much darker in the direction opposite the sun.</div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibycWNn8QvJkrnt6vyr-btQVEnAqJJgaenYp7CC7rVV04kn12bQkBlEM9Ri3XL7p4z_6yOX8a7FUCMjkUeyHLW1lLehl7l7yaJ1eVSFQOg1RTq_XrzZJxWwDEj8wdj1eJxdEWnPLAR-F4T/s1600/CIEXYZDusk.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibycWNn8QvJkrnt6vyr-btQVEnAqJJgaenYp7CC7rVV04kn12bQkBlEM9Ri3XL7p4z_6yOX8a7FUCMjkUeyHLW1lLehl7l7yaJ1eVSFQOg1RTq_XrzZJxWwDEj8wdj1eJxdEWnPLAR-F4T/s1600/CIEXYZDusk.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight, facing<br />
towards sun.</td></tr>
</tbody></table>
<br />
<br /></div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-68449545404575938832012-10-07T23:08:00.000-07:002012-10-23T22:11:59.697-07:00Visible SpectrumHere's what the visible spectrum looks like at a few different exposures when rendered in my sky renderer. I used my new spectral rendering and display system (spectrum → CIE XYZ → linear RGB → sRGB) to create these images.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieRIKgGwGFi613VB0_G6W7Yh3abKq8tRC16zJxKW2psXg2_1LYdDqhhZwet1q48tqjwJLae4YEJih_0XvzkHsCVBrbFvK6_9vcmCVISKbljdwdupfp3xUpTjyDxNokunK7VAwGyuwajkbc/s1600/VisibleSpectrumMinusOne.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieRIKgGwGFi613VB0_G6W7Yh3abKq8tRC16zJxKW2psXg2_1LYdDqhhZwet1q48tqjwJLae4YEJih_0XvzkHsCVBrbFvK6_9vcmCVISKbljdwdupfp3xUpTjyDxNokunK7VAwGyuwajkbc/s400/VisibleSpectrumMinusOne.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDqz1tM76z6TDBKHu3iyz0NE2CiOdw9I4qg0jFk7EK8rBsmQROK9oTnQwCEGl2KvRxbINbKeKu0aUrFrrOHt-Bm12Xi_m2JEVYYzymzyVOSRoXFEGjfyLMsOPHircFEpGm6n8Hg_jtLChR/s1600/VisibleSpectrum.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDqz1tM76z6TDBKHu3iyz0NE2CiOdw9I4qg0jFk7EK8rBsmQROK9oTnQwCEGl2KvRxbINbKeKu0aUrFrrOHt-Bm12Xi_m2JEVYYzymzyVOSRoXFEGjfyLMsOPHircFEpGm6n8Hg_jtLChR/s400/VisibleSpectrum.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKDcqLnM9h5hzGsPpDYU646qVkAGkf4x_fEcJPN0ltD3XM1anX94N9A8dizAup6ZBej5AhuX1zRAkgs-vjOVeTtI2eXiJezFb5FzD1GoaTXd16qX9FhfaIEEEJSzA5or9b9AKsmbiVlBqo/s1600/VisibleSpectrumPlusOne.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKDcqLnM9h5hzGsPpDYU646qVkAGkf4x_fEcJPN0ltD3XM1anX94N9A8dizAup6ZBej5AhuX1zRAkgs-vjOVeTtI2eXiJezFb5FzD1GoaTXd16qX9FhfaIEEEJSzA5or9b9AKsmbiVlBqo/s400/VisibleSpectrumPlusOne.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTMOE4zIma87E10FtnFTyH9klt-y-cW67r6Uq-3UVekBuNAh8c7qIjfDeBIUnQlR8WGRtJmApe1LVFGWi1c-r2E8EqHNRYYkqozBFYyaw_D7j5AjMTqLgYZRXZDujqafHzOPmsu02YHeAB/s1600/VisibleSpectrumPlusTwo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTMOE4zIma87E10FtnFTyH9klt-y-cW67r6Uq-3UVekBuNAh8c7qIjfDeBIUnQlR8WGRtJmApe1LVFGWi1c-r2E8EqHNRYYkqozBFYyaw_D7j5AjMTqLgYZRXZDujqafHzOPmsu02YHeAB/s400/VisibleSpectrumPlusTwo.png" width="400" /></a></div>
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-46603169985423451102012-10-07T21:50:00.000-07:002012-10-20T01:33:24.368-07:00CIE XYZ<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgovmDi4_3XETfCI32MNlGAKoIUFNEa_R3gmpGZ_vXyNZBqEVaE3AEfOhFMQDMuLvpYDocU4NvR_uqmtpeB4rqBnr65GHHCkI8MTQ6uwuACe10oJ85ba-lOYkjPXgweW7OIP7MFn9_njLGp/s1600/xybunt.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgovmDi4_3XETfCI32MNlGAKoIUFNEa_R3gmpGZ_vXyNZBqEVaE3AEfOhFMQDMuLvpYDocU4NvR_uqmtpeB4rqBnr65GHHCkI8MTQ6uwuACe10oJ85ba-lOYkjPXgweW7OIP7MFn9_njLGp/s320/xybunt.png" width="288" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The sRGB gamut in the CIE <i>xy</i> chromaticity diagram.<br />Image found on <a href="http://www.itp.uni-hannover.de/~zawischa/ITP/colmetr.html">Dietrich Zawischa's colorimetry page</a>.</td></tr>
</tbody></table>
<br />
One of the first things I did for this project is to write a spectral rendering system that associates each ray with a wavelength instead of an RGB color. Initially, in order to convert the spectral data to RGB primaries, I made up response curves for the camera's RGB sensors, but this was just a rough placeholder system. I considered implementing the response curves of a real-life camera, however, I decided on a more scientific approach. I decided to convert my spectral data to <a href="http://en.wikipedia.org/wiki/CIE_1931_color_space">CIE XYZ</a> by integrating it with the CIE XYZ color matching functions (specifically, the <a href="http://cvrl.ioo.ucl.ac.uk/cmfs.htm">CIE 1931 2° XYZ CMFs modified by Judd and Vos</a>), then transforming XYZ to linear RGB (Rec. 709 primaries), then finally transforming that to sRGB. This approach yields colorimetrically accurate results and is very flexible. I'm very interested in color, so doing this was also fun and good practice.<br />
<br />
Here are after and before shots of twilight. Notice how the hues shift:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMIba1C0e0AUaIThlxrmT-C2HppN9gczZSEmVL-RrsvyC8SV6nwh_gS7hVI0Ub7cRxR5oSHZ9o0c580sLJGjKVlJx-U7FqGpCRcP_4l-fC8srZX6aEipv-mo0NOsjqUZGRFAJZWU7PM7sD/s1600/CIEXYZDusk.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMIba1C0e0AUaIThlxrmT-C2HppN9gczZSEmVL-RrsvyC8SV6nwh_gS7hVI0Ub7cRxR5oSHZ9o0c580sLJGjKVlJx-U7FqGpCRcP_4l-fC8srZX6aEipv-mo0NOsjqUZGRFAJZWU7PM7sD/s1600/CIEXYZDusk.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Updated twilight<br />
image.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEMzJ6Wra-K7xgsbcAdWmF79Xny-Xc4CFUys3kgEPu3EJJdODGuLt4_tM0Zlhkq2dvfzCQ3U8dC4GsiWLklvw8wSlTYNmIHR8KbTd70NSEuEggNwpYzS_ts8qxoy3ZjPhymTL1EIxXGzjH/s1600/HighQualityDusk.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEMzJ6Wra-K7xgsbcAdWmF79Xny-Xc4CFUys3kgEPu3EJJdODGuLt4_tM0Zlhkq2dvfzCQ3U8dC4GsiWLklvw8wSlTYNmIHR8KbTd70NSEuEggNwpYzS_ts8qxoy3ZjPhymTL1EIxXGzjH/s1600/HighQualityDusk.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Old twilight image,<br />
for comparison.</td></tr>
</tbody></table>
<br />
Here are a few more new renders:<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEDapwZ6nGJsCcV9sIRNCBZn8Dqf49QLBlo2-YarnRjHtXRkAC3k9HTi_0utb7Uh1lMoC4GfKYqEtcAok9qYygMqzhhIJA1ArZ0vXkYNi24yx9P6WwOanKPh_CpDKFOaT8okqf_6w64RnF/s1600/CIEXYZAfternoon.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEDapwZ6nGJsCcV9sIRNCBZn8Dqf49QLBlo2-YarnRjHtXRkAC3k9HTi_0utb7Uh1lMoC4GfKYqEtcAok9qYygMqzhhIJA1ArZ0vXkYNi24yx9P6WwOanKPh_CpDKFOaT8okqf_6w64RnF/s1600/CIEXYZAfternoon.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Updated day<br />
image.</td></tr>
</tbody></table>
<br />
Notice the multicolored noise in this quick render, resulting from spectral rendering coupled with Monte Carlo scattering:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8MrlD3pPdyTMC8eLJpbHXco33BHCpngvog7zFkK0RlkUE5MlIBqrHrxDe7OkujI3VjOoq0w5guDCUv2gxdcm2jZXQU97LBBqCamiufzBIQrIBkVqmoVRt1DKsZZ4Mvm4j-kWw4BE91NqR/s1600/CIEXYZSunsetLowerExposure.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8MrlD3pPdyTMC8eLJpbHXco33BHCpngvog7zFkK0RlkUE5MlIBqrHrxDe7OkujI3VjOoq0w5guDCUv2gxdcm2jZXQU97LBBqCamiufzBIQrIBkVqmoVRt1DKsZZ4Mvm4j-kWw4BE91NqR/s1600/CIEXYZSunsetLowerExposure.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Updated sunrise / <br />
sunset image.</td></tr>
</tbody></table>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-54214079043533446932012-10-06T14:26:00.000-07:002012-10-09T10:37:52.004-07:00Latest Results<br />
Below are some renders I made after implementing direct sun sampling. these are images of a clear, dry sky, with only Rayleigh scattering and no Mie scattering.<br />
<br />
I have not yet implemented a realistic spectral emission distribution for the sun, so right now, it's just flat across the visible spectrum. I am using a rough, temporary approach to convert spectral results to RGB. These pictures all use the same exposure, so the luminosities are roughly comparable.<br />
<br />
For now, I made the ground an 18% gray, perfectly diffuse reflector.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgehKkM9-PJmiY-fOfkoKyMxEJzDt-x7UhA9FQfBLbVdrsHrDopynEFmeYF4Jfclkm28HcM9JDIhSIgwWRxi4-zhu6WJQuA2kIpXgLFRU9i5zKzarjQjG-lumqySYKjcDT-fESuXnqzkQN0/s1600/HighQualitySunset.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgehKkM9-PJmiY-fOfkoKyMxEJzDt-x7UhA9FQfBLbVdrsHrDopynEFmeYF4Jfclkm28HcM9JDIhSIgwWRxi4-zhu6WJQuA2kIpXgLFRU9i5zKzarjQjG-lumqySYKjcDT-fESuXnqzkQN0/s1600/HighQualitySunset.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sunrise or sunset.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2FZYu6bZU_p_1rfmT7zoTZZlz1mzDI9PFgq7vGw8yRUXQ54hJRO_G_EIxyFx81Gi1MyF9bWx1MWn1Rd6UbMvZFn99d8L9h4-qmXGuaux6gj9oBdEf1mGf3T9KDQ9F9GFS1e4-D7n2Mjwx/s1600/HighQualityDusk.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2FZYu6bZU_p_1rfmT7zoTZZlz1mzDI9PFgq7vGw8yRUXQ54hJRO_G_EIxyFx81Gi1MyF9bWx1MWn1Rd6UbMvZFn99d8L9h4-qmXGuaux6gj9oBdEf1mGf3T9KDQ9F9GFS1e4-D7n2Mjwx/s1600/HighQualityDusk.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Twilight. Sun<br />
below horizon.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-qiKVmY9C2jYtQV5kjuenZjBxGg7-zEn5v2k_79WZg336dhSJQQ6vmSLHwsYTmaOR0LRXWrk6BtKJZxLT0ZGCPrNBx9SV4CHhAwCPLzT3e5ZbFa-uRZPA8AcR2CL3x-0eHFKeRkVUZCmI/s1600/HighQualityAfternoon.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-qiKVmY9C2jYtQV5kjuenZjBxGg7-zEn5v2k_79WZg336dhSJQQ6vmSLHwsYTmaOR0LRXWrk6BtKJZxLT0ZGCPrNBx9SV4CHhAwCPLzT3e5ZbFa-uRZPA8AcR2CL3x-0eHFKeRkVUZCmI/s1600/HighQualityAfternoon.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Day.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9wxhZ0l5YCuds4lH3BlFFNqTCxVgZ2W90uLOPbZ9wrebBinav27cuaGh_YkpB_e0q9CdF6m0IK0aNy0GkLcrLX19Q1uYvbRSh5J2KENYJaSdoZl_LiDLo7Tb_GCc0Ox4O83Z8TTyvrV4b/s1600/HighQualityEvening.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9wxhZ0l5YCuds4lH3BlFFNqTCxVgZ2W90uLOPbZ9wrebBinav27cuaGh_YkpB_e0q9CdF6m0IK0aNy0GkLcrLX19Q1uYvbRSh5J2KENYJaSdoZl_LiDLo7Tb_GCc0Ox4O83Z8TTyvrV4b/s1600/HighQualityEvening.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Day with<br />
lower sun.</td></tr>
</tbody></table>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-71868354605859516702012-10-05T19:46:00.000-07:002012-10-09T10:37:30.106-07:00Sampling the Sun DirectlyThe sun covers only a tiny fraction of the sky, about <a href="http://en.wikipedia.org/wiki/Solid_angle#Sun_and_Moon">0.00047%</a>, so with naive path tracing, most rays would get lost in space and the image would take forever to converge. By sampling the Sun directly, I was able to speed up my simulation tremendously. At each scattering point, I fire a ray directly towards the Sun, weighted by the Rayleigh scattering phase function in that direction, and weighted by the probability that a ray fired in a random direction would hit the sun. I also still fire a scattered ray in a direction drawn from the Rayleigh scattering phase function, however this ray cannot "see" the Sun. If I were to <i>only </i>sample the Sun, I would lose multiple scattering, which plays an important role in the appearance of the sky. For computing sample directions that are uniformly distributed over the solid angle subtended by the Sun (the Sun is not a point light or a directional light), I used the Sun class that I wrote for <a href="http://photorealizer.blogspot.com/">Photorealizer</a>.Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com2tag:blogger.com,1999:blog-6888287896713330574.post-71695727026889053502012-10-02T20:46:00.000-07:002012-10-13T20:14:37.877-07:00Ray MarchingBecause the properties of the atmosphere vary with altitude, I can't just use the scattering and absorption properties at a single point to compute scattering and absorption along a ray. Instead, I implemented a ray-marching system that takes fixed-size steps along each ray. Each step forms a line segment. For each segment, I use the altitude, density, and Rayleigh scattering coefficient from the midpoint of the segment, and assume that these properties are constant along the span of the segment. This allows me to compute a random scattering distance (or absorption distance, but I've only implemented Rayleigh scattering so far) by importance sampling the exponential falloff of unscattered light. If the sampled scattering distance is less than the length of the segment (i.e., if the scattering point falls within the segment), I scatter it, otherwise I proceed to the next segment. By decreasing the step size, the simulation can be made more accurate, but you get diminishing returns at a certain point, slowing down the program without a noticeable increase in accuracy. I am considering implementing adaptive step sizes based on the density of the air.Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-77013061934271310632012-09-29T18:45:00.000-07:002012-10-23T22:14:41.346-07:00Modeling Earth's AtmosphereIn order to realistically simulate the appearance of the sky, I need an accurate model of the composition of the Earth's atmosphere. To this end, I implemented the <a href="http://en.wikipedia.org/wiki/U.S._Standard_Atmosphere">U.S. Standard Atmosphere 1976</a>, using the <a href="http://www.pdas.com/refs/us76.pdf">original paper</a> from NASA, NOAA, and the USAF. I could have used a simple exponential density falloff, but that wouldn't have been as accurate, or as interesting to implement. I also could have used an existing implementation of the U.S. Standard Atmosphere, but I wouldn't have learned as much from that, and it wouldn't have been very fun.<br />
<br />
The U.S. Standard Atmosphere uses SI units, and I converted to SI any values that were provided in other units. I also had to spot a few errors in the paper, where incorrect values were provided. It's fun working on a project that uses real-world units and measurements. Not just fun—it's also necessary to achieve the correct results.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimpM5UgTsPcl2m7DreEQPHsBThPLJZdVy5T5UE5tTIsKyZ3SNkXjXYYRpzIOEZdDtd9OieiVB_fFqQt8YGc9cprbnQ3iHdS6uXneTHjUXQtgsoZNyIX9V_RS9rB2Oj66se-ShaE5XVwpJS/s1600/Us_standard_atmosphere_model.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimpM5UgTsPcl2m7DreEQPHsBThPLJZdVy5T5UE5tTIsKyZ3SNkXjXYYRpzIOEZdDtd9OieiVB_fFqQt8YGc9cprbnQ3iHdS6uXneTHjUXQtgsoZNyIX9V_RS9rB2Oj66se-ShaE5XVwpJS/s400/Us_standard_atmosphere_model.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Image found on <a href="http://commons.wikimedia.org/wiki/File:Us_standard_atmosphere_model.png">Wikimedia Commons</a></td></tr>
</tbody></table>
<br />Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0tag:blogger.com,1999:blog-6888287896713330574.post-15544449096835237932012-09-26T20:39:00.000-07:002012-10-22T20:57:20.523-07:00Rayleigh ScatteringThe coloration of the sky is primarily a result of Rayleigh scattering. Rayleigh scattering describes the scattering of light by particles much smaller than the wavelength of the light. In the case of the sky, light is scattered by the molecules of air themselves. The amount of scattering is inversely related to the fourth power of the wavelength of the light. This means that bluer light is scattered much more than redder light, which results in the blue color of the sky. And when the sun is near the horizon, its light needs to pass through more atmosphere to reach you, so even more blue light is scattered out of the path, and mostly just longer wavelengths remain, giving the sun it's vivid orangish color.<br />
<div>
<br /></div>
<div>
I implemented Rayleigh scattering from the ground up, including scattering cross sections, scattering coefficients, and phase functions. I am aiming for physical accuracy (and trying to learn about the physics) so I even included subtle factors such as dispersion of both the index of refraction and <a href="http://www.ess.uci.edu/~cmclinden/link/xx/node21.html">depolarization factor</a> of air. The main resource I used in implementing Rayleigh scattering was <a href="http://augerlal.lal.in2p3.fr/pmwiki/uploads/Bucholtz.pdf">this paper</a>.</div>
Peterhttp://www.blogger.com/profile/00411424533792457362noreply@blogger.com0