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.

3 comments:

The Andersons said...

I notice that you get the OrbitView interface in this example but I cannot find any mention of this interface in the WorldWind source...am I missing something??

Patrick Murris said...

There has been a couple WWJ SDK updates since the may release. Please check the WWJ forum.

Billvicious said...

Loved reading this thankks