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.
Terrain shadingDownload the sunlight package (Zip 33K). Unzip in the SDK examples package and run the sunlight.SunShading.java demo application.
Lens flare and atmospheric scatteringThe 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.
Sun occlusionEnjoy!

4 comment(s):
Looks nice. Is this being added to the night builds any time soon?
It may be integrated into the SDK at some point but i can't tell if and when. Right now, we are more worried about sorting out the core components from what can be considered as extensions.
well, integrating the shading in an application was easier than I though, just change the default tessellator.
Shading [of course] slows down thing quite some.
But it would be great if the shader tesselator was as fast as the regular one when the light parameters are set to null; I noticed some slow down in comparison with the normal one.
Any clues?
I haven't noticed much of a slow down, but that does not mean there isn't.
The tessellator is doing extra work to compute the normals needed for shading - whether light is enabled or not. But it does that only once when creating a new terrain geometry tile. After that the normals are cached and passed to the GPU at draw time. However, if light is not enabled, the GPU will not do extra work on lighting.
Normal computation could be postponed until light is on and they are needed though.
Post a Comment