Sunday, April 5, 2009

Sunlight package for WorldWind Java

Here is the very first iteration of a sun light package for NASA WorldWind Java. It includes a custom tessellator for terrain shading, an atmospheric scattering based sky layer, a sun position calculator and a lens flare effect. Some of the code has been contributed by WWJ Forum member Michael de Hoog aka Omega.

Sun shading in WorldWind JavaTerrain shading

Download the sunlight package (Zip 33K). Unzip in the SDK examples package and run the sunlight.SunShading.java demo application.

Lens flare and atmospheric scattering in WorldWind JavaLens flare and atmospheric scattering

The demo application code will show you how to use the different components. Although this initial version works rather well, you may notice a couple issues. Dark or bright bands may show across the terrain in some places. The atmospheric scattering code is not optimal. It fails to produce a blue sky at ground level and the sky underlying geometry is too coarse to produce nice and smooth sunsets. The sun calculator reported position does not seem right either.

Lens flare and atmospheric scattering in WorldWind JavaSun occlusion


Enjoy!