Saturday, July 28, 2007

Picking at objects in WWJ

I recently added 'picking' support to the WorldMapLayer - so you can 'click-and-fly' to any place, and had a bit of head scratching and code reading to figure out the picking process. I thought it would be usefull to write it down, so here are my notes on picking in WWJ.


WWJ is using a 'unique color' rendering scheme - where the world is rendered with unique colors for each object, but we never get to see it. So i also thought it would be nice to have a quick look, and there it is : the frame buffer at the end of the pick process on terrain.


And here we see picking at the globe in the AWT1Up demo. The rectangle at top left is the world map selection area.

Note that only the terrain geometry sector under the mouse cursor is rendered with unique colors for each of its faces.

The above images have been processed to bring out the uniqueness of the colors. The real frame buffer is less explicit, with continuous shades of blue most of the time.

To see it for yourself, in BasicSceneController, comment out the last two steps of the doRepaint() method - clearFrame and draw, run, take a screenshot, convert it to 256 indexed colors with an adaptive palette, then change the palette to Mac or Windows system.

The world map layer with pick support is to come with the next release of the SDK. Some major refactoring have taken place and posting the code here would probably be confusing with the current version. Sorry for the delay.

Sunday, July 22, 2007

Adding a touch of fog to WWJ

Here is a simple fog effect layer for WWJ. It will adjust the fog near and far distance according to the current view altitude. The screenshot shows the Segara Anak caldera and Mount Rinjani (3726m), Indonesia, looking east.


Download FogLayer.java and add it to the worldwinddemo package - after removing the .txt extension. In BasicDemo, insert the layer just before the blue marble, and after the stars and the sky if you have them.

The default fog settings also produces a light atmospheric 'inside' halo around the planet.

Wednesday, July 4, 2007

Adding a blue sky background to WWJ

Here is a very simple sky background color layer for WWJ. It paints a blue background when the 'camera' goes inside the atmosphere, with a smooth fading effect between the stars and the sky.


Download SkyColorLayer.java and add it to the layers.Earth package of the SDK - after removing the .txt extension. In the layer list, add the new layer before blue marble and after the stars if you have them.

This layer along with better versions of the stars, scalebar and worldmap will be included in the next version 0.3 of the SDK - that should be out very soon. Hopefully, i will come up with a more sophisticated sky/atmosphere before long - update sept 27: see the SkyGradientLayer.